Upgrade PHP 5 to PHP 7 on CentOS/RHEL 6/7

As we all know, PHP 7 brings 2x the increase in performance to PHP powered systems. The main purpose of this guide will be focusing on the steps to upgrade your web server from PHP 5 to PHP 7 on CentOS.

Pre-requisite

If you are upgrading an existing system to PHP 7, it is advised to test your current system with this upgrade on a separate web server.

Check that your current PHP source codes is compatible with PHP 7 at the following link.

https://secure.php.net/manual/en/migration70.php

1. Install YUM Repository

CentOS/RHEL 7.x

CentOS/RHEL 6.x

1. Upgrade PHP

2. Install PHP 7

[Optional] APC

If you have existing APC (Alternative PHP Cache) installed in your web server, you will have to remove it as APC does not support PHP 7.

After uninstalling APC, modify the following file.

Comment the following line of code by adding a semicolon ‘;’ in front of it.

Check PHP Version

Run the following command to check your current version of PHP.

You should see the following.

 

That’s it! You are done upgrading from PHP 5 to PHP 7.

Install OpenCart 2 on CentOS

This guide focuses on how to install OpenCart 2 on CentOS 6. Before proceeding with this guide, make sure your server have met the following requirements.

1. Download OpenCart

Download OpenCart 2 from the following link, http://www.opencart.com/?route=download/download.

Then unzip the downloaded package.

2. Upload OpenCart to server

Use any FTP client (FileZilla, Transmit, etc) to upload your OpenCart files that you have just unzip to the server.

After uploading the files, renaming the following files:

  • /config-dist.php to /config.php
  • /admin/config-dist.php to /config.php

Note: For Apache servers, the directory that you are to upload to is /var/www/.

3. Enable file read/write permissions

Modify the file read/write permissions for the following files/directories:

  • /var/www/store/config.php
  • /var/www/store/admin/config.php
  • /var/www/store/system/cache/
  • /var/www/store/system/logs/
  • /var/www/store/system/download/
  • /var/www/store/system/upload/
  • /var/www/store/image/
  • /var/www/store/image/cache/
  • /var/www/store/image/catalog/
  • /var/www/store/system/modification/

Command to modify file read/write permissions

And one more additional command to run on image/cache directory

 

4. Begin Installation

Now head over to your web browser and access the following url.

5. Installation Step 1

OpenCart Installation Step 1
OpenCart Installation Step 1

Click on Continue to proceed.

6. Installation Step 2

OpenCart Installation Step 2
OpenCart Installation Step 2

If you have followed the previous steps correctly, then you should see all green ticks and all files/directories status are labelled as Writable.

Click on Continue to proceed.

7. Installation Step 3

OpenCart Installation Step 3
OpenCart Installation Step 3

Fill up your database connection details and an account for administration.

Then click on Continue to proceed.

8. Installation Step 4

OpenCart Installation Step 4
OpenCart Installation Step 4

That’s it! You have successfully setup an E-Commerce store online for yourself.

Feel free to drop me an email at [email protected] or leave a comment if you have any questions.

Install Zabbix Agent on CentOS/RHEL

Zabbix is an open source software for application and network monitoring. There are two types of Zabbix installation, namely Zabbix server and Zabbix agent. Zabbix server is installed on the server where you will oversee and monitor all the networks or devices. Zabbix agent is installed on all networks or devices so that the Zabbix server is able to communicate with it.

This tutorial guides you step by step on how to install and configure a Zabbix agent on CentOS/RHEL server.

Installing Zabbix Agent

1. Configure Yum Repository

Run the following commands accordingly to the version of CentOS/RHEL you are using.

CentOS/RHEL 7

CentOS/RHEL 6

CentOS/RHEL 5

2. Install Zabbix Agent

Command to install Zabbix agent

3. Update Zabbix Agent Configuration File

Your Zabbix agent configuration file should be located at /etc/zabbix/zabbix_agentd.conf.

Edit configuration file

Modify the following lines

Save and exit nano editor

4. Restart Zabbix Agent

Command to restart Zabbix agent

(Additional Information) Alternately, you can start/stop your Zabbix agent via the following commands.

 

That’s it! You are done installing Zabbix agent on your server.

In case you have missed out on how to install Zabbix server on your server, you can refer to the guide on how to install Zabbix server on CentOS/RHEL.

Feel free to email me at [email protected] if you have any questions.

Install Zabbix Server on CentOS/RHEL

Zabbix is an open source software for application and network monitoring. There are two types of Zabbix installation, namely Zabbix server and Zabbix agent. Zabbix server is installed on the server where you will oversee and monitor all the networks or devices. Zabbix agent is installed on all networks or devices so that the Zabbix server is able to communicate with it.

This tutorial guides you step by step on how to install and configure a Zabbix server on CentOS/RHEL server.

1. Set up Apache, MySQL and PHP

Install Apache

Install MySQL

Install PHP

Start Apache and MySQL services

Setup MySQL by running the following command

2. Configure Yum Repository

RPM repository needs to be configured before installing Zabbix.

Run the following commands according to the version of OS that you are using.

CentOS/RHEL 7

CentOS/RHEL 6

CentOS/RHEL 5

3. Install Zabbix Server with MySQL

Command to install zabbix server

4. Setup Zabbix Apache Configuration

Locate Zabbix’s own Apache configuration file. By default it should be located at /etc/httpd/conf.d/zabbix.conf. Modify the config file by added your time zone.

Added time zone to config file

Restart Apache service after changing the time zone value

5. Create Zabbix MySQL Database

Zabbix MySQL user and database is required as part of Zabbix server installation.

Login to your MySQL first

After which you will be prompt to enter your root password that you have configured previously when you setup MySQL.

Create Zabbix database

Create Zabbix MySQL user to access Zabbix database

Grant privileges to Zabbix user on Zabbix database

Flush privileges

Exit MySQL

After creating MySQL user and database for Zabbix, you will need to restore the default MySQL database provided by Zabbix. The files can be found at /usr/share/doc/zabbix-server-mysql-<version>/create/ directory.

Note: remember to change the version accordingly to the version that you are installing.

6. Start Zabbix Server

Command to start Zabbix server

7. Start Zabbix Web Installer

You can now access your Zabbix web installer via the following url

Zabbix Setup Welcome Screen

Following is the welcome screen of Zabbix web installer. Click on Next to proceed.

Screen Shot 2015-08-15 at 11.55.34 am

Installation pre-requisites

If everything is ok, click Next to proceed.

Screen Shot 2015-08-15 at 11.57.54 am

Configure Database Connection

Enter the database information that you have created previously. Then click on Test Connection. If everything is correct, click Next to proceed.

Screen Shot 2015-08-15 at 12.00.35 pm

Zabbix Server Details

Click on Next to proceed.

Screen Shot 2015-08-15 at 12.01.46 pm

Pre-Installation Summary Screen

If all information is correct, click on Next to proceed.

Screen Shot 2015-08-15 at 12.12.48 pm

Installation Success

Click on Finish to proceed.

Screen Shot 2015-08-15 at 12.03.40 pm

Zabbix Login Screen

You can now login to Zabbix via the following url

Default username and password is as follows

Screen Shot 2015-08-15 at 12.15.08 pm

 

 

That’s it! You are done installing Zabbix server on your server. For installation of Zabbix agent, you can refer to my guide on how to install Zabbix agent on CentOS/RHEL.

Feel free to email me at [email protected] if you have any questions.

Install and Secure phpMyAdmin on CentOS 6.4

PhpMyAdmin is a popular web interface for web developers to manage MySQL databases. This tutorial will guide you through on how to install and secure PhpMyAdmin on your CentOS web server.

Pre-requisites

This guide assumes that you already have Apache and MySQL installed on your CentOS web server.
(Optional) Note that if you want to access PhpMyAdmin using SSL, then you will need to configure SSL certificate by referring to the following guide.

Setting up an SSL Secured Web Server with CentOS

1. Add EPEL Repositories

PhpMyAdmin is not included in CentOS packages, therefore you will need to add EPEL (Extra Packages for Enterprise Linux) to your web server.

(Optional) Run the following command to install wget if you haven’t install wget yet

Command to install EPEL packages to your web server

Check that EPEL has been added to your repository

You should see the following

Once done remove the respository configuration package

2. Download PhpMyAdmin

Command to download PhpMyAdmin

3. Configure PhpMyAdmin

Find your IP Address first
Then edit PhpMyAdmin config file

Modify the following 4 lines in the config file

Then save and close the config file

4. Open PhpMyAdmin in your Web Browser

Open the following url in your web browser

 

That’s it you are done!

Feel free to contact me at [email protected] if you have any questions.

Setting up an SSL secured Webserver with CentOS

This guide will teach you how to configure and setup your own SSL certification on your CentOS web server.

1. Install required software

Use yum to get the following software if its not yet installed on your web server.

yum install mod_ssl openssl

2. Generate a self-signed certificate

The following steps guides you on how to generate your own self-signed certificate.

Generate private key

openssl genrsa -out ca.key 2048

Generate CSR

openssl req -new -key ca.key -out ca.csr

Generate self-signed key

openssl x509 -req -days 365 -in ca.csr -signkey ca.key -out ca.crt

Copy the files to the respective locations

cp ca.crt /etc/pki/tls/certs

cp ca.key /etc/pki/tls/private/ca.key

cp ca.csr /etc/pki/tls/private/ca.csr

In cased you have moved the files and not copied them, use the following command to correct SELinux

restorecon -RvF /etc/pki

Update Apache SSL configuration file

sudo nano +/SSLCertificateFile /etc/httpd/conf.d/ssl.conf

Modified the paths to match where the new Key is stored

SSLCertificateFile /etc/pki/tls/certs/ca.crt

Then set the correct path for Certification Key file

SSLCertificateKeyFile /etc/pki/tls/private/ca.key

Finally quit and save the file then restart Apache

sudo service httpd restart

3. Configure firewall

The last step to setting up your own SSL certificate is to configure the firewall to accept requests from port 443, which is used for SSL connections.

Command to accept port 443 requests

iptables -A INPUT -p tcp --dport 443 -j ACCEPT

Save ip table

/sbin/service iptables save

iptables -L -v

 

That’s it! Your web server is now configured and ready for SSL connections.

Feel free to drop me any questions you have at [email protected]

 

Install Linux, Apache, MySQL, PHP (LAMP) stack on CentOS 6

LAMP stack is a group of open source softwares used to get web servers up and running. This guide assumes that you already have your CentOS installed successfully.

1. Install Apache

Apache is the web server in the lamp stack.

Install apache command

Start apache on your server

(Optional) Test if apache is alive

Get your IP address first

Then open the following url in your web browser

2. Install MySQL

MySQL is the database management system used in LAMP stack.

Install MySQL command

Start MySQL service

Set a root MySQL password

This will prompt you for your current MySQL root password, which you will most likely have none, because you have just installed MySQL only. So just leave it blank by pressing enter.

Next a series of yes/no questions will appear. All you have to do is just say Yes to all the options.

3. Install PHP

Install PHP command

(Optional) Install additional php modules

Search for PHP modules command

Next a bunch of php modules with their description will appear. So just use yum to install which ever modules that you want.

4. Configure Apache and MySQL to run on boot

5. Test if PHP is working on your server

By default apache web root directory is at /var/www/html

Create a file called info.php 

(Optional) If nano is not installed yet

Add the following code to info.php

Then save and exit

Restart Apache and visit the url on your web browser as follows

Then you should see your server’s php information

 

Feel free to contact me at [email protected] if you have any further questions.

Install APC (Alternative PHP Cache) in CentOS 5/6/7 and Fedora 20/21

APC (Alternative PHP Cache) is a free and open source tool to cache PHP codes.

phpapc

1. Install Dependency Packages for APC

2. Install APC using PECL (PHP Extension Community Library)

Press “Enter” for the following options

2a. [Alternative]

If the above command fails, you can use the following method to install APC as well.

3. Enable APC PHP Extension

4. Restart Apache Service for APC

CentOS

Fedora

5. Verify APC Installation

Create a file named phpinfo.php in Apache web root directory. For example our Apache web root directory is /var/www

And add the following code to the php file

[Optional] If you do not have nano installed

Open the following url in your web browser

Screen Shot 2015-08-02 at 2.48.22 pm

 

6. Enable PHP APC administration

Copy the following file to any web directory that you want. For example, in this case we will copy it to the web root directory.

Open the file apc.php 

In nano editor, use “Ctrl-w” to search for the username and password field to modify.

Open the following link in your web browser.

You should see your APC stats and that’s it!