Updating PHP version from 5.3 to 5.6 on Linux CentOS
This task is not so easy, especially if you are updating PHP on a production server. I have taken note of the steps I have followed. Let's open our shell with root permissions: First check your PHP version
php -v
Download some repository and edit some configuration:
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm && rpm -Uvh epel-release-latest-6.noarch.rpmwget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm && rpm -Uvh remi-release-6*.rpm
Edit the configuration:
vim /etc/yum.repos.d/remi.repo
On the [remi] section update the row: enabled=1 Do the same on [remi-php56] section and upgrade yum:
yum -y upgrade php*
If the system asks you about SSL certificates, you can ignore them if necessary:
echo "check_certificate = off" >> ~/.wgetrc
Edit the httpd.conf file of your Apache web server:
vim /etc/httpd/conf/httpd.conflocate libphp5.soLoadModule php5_module /usr/lib64/httpd/modules/libphp5.so
Restart Apache and check status
/sbin/service httpd restart
OR
sudo apachectl -k stopsudo apachectl -k startapachectl status
You can check your PHP version even before restart Apache with php -v. Once you have PHP installed, remember to set the DateTime zone or check other settings into the php.ini files, both for CLI and web:
vim /etc/php.ini