To start ssh to your server
Install dependencies through yum:
yum install -y wget gcc libxml2-devel openssl openssl-devel openssl-libs curl libcurl-devel libjpeg-turbo-devel libpng-devel freetype-devel libmcrypt libmcrypt-devel libxslt libxslt-devel
Obtain the PHP source package:
For this guide we are going to use the 5.6 release branch:
wget -O /usr/src/php-5.6.30.tar.gz http://php.net/get/php-5.6.30.tar.gz/from/this/mirror
Or select another mirror to download it from.
Unzip the compressed package:
cd /usr/src; tar xfvz php-5.6.30.tar.gz
Go into the directory:
Install the package:
Configure the package:
./configure --with-mysql --with-mysqli --with-pdo-mysql --enable-soap --with-gd --with-curl --with-jpeg-dir=/opt --with-png-dir=/opt --with-freetype-dir=/opt --with-zlib --enable-mbstring --with-mcrypt=/usr/local/lib --with-xsl --with-openssl --enable-ftp --enable-exif --with-apxs2=/usr/sbin/apxs
The above configuration line assumes you have Apache installed, if not remove –with-apxs2=/usr/sbin/apxs. In this example we are just letting php install in the default location, however you can specific where you would like to install.
make && make install
Make sure it works:
The above command should return the version of php you have installed.
Enable PHP in Apache
Add the following line to your apache configuration:
LoadModule php5_module lib/apache/libphp5.so
service httpd restart
To edit the default configuration file’s location by typing the following
php -i|grep php.ini
It will return the path and file it is using and you can edit it to add more configuration options. Check out Zend OpCache to add more performance to your installation.