Skip to main content
Image for post: Updating PHP version from 5.3 to 5.6 on Linux CentOS

Updating PHP version from 5.3 to 5.6 on Linux CentOS

Not a simple procedure

This task is not so easy, especially if you are updating PHP on a production server. I have taken a note about 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.rpm
wget 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.conf

locate libphp5.so
LoadModule php5_module /usr/lib64/httpd/modules/libphp5.so

Restart Apache and check status


/sbin/service httpd restart

OR


sudo apachectl -k stop
sudo apachectl -k start

apachectl 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 setting into the php.ini files, both for CLI and web:


vim /etc/php.ini

Resources

Share this post

This website and/or any sub domains use cookies to understand how you to improve your experience.