I ran into some errors with my PHP modules on a CentOS server running ISPConfig to host web sites. I decided instead of in depth troubleshooting that it might be easier to go ahead and upgrade PHP since by default the yum package manager will limit you to PHP version 5.1 yet I knew that PHP version 5.2 had been out for a long time. What I needed to do was locate a yum repository that would allow me to upgrade PHP to version 5.2 using yum. The catch was to make sure that every necessary PHP module had an updated package available via the new yum repository. Below I describe upgrading PHP version 5.1 to PHP version 5.2 on CentOS running ISPConfig.
Follow These Simple Steps to Install a New Yum Repo, Upgrade PHP, and Upgrade All PHP Modules:
- Install Atmoic Yum Repo: Use the below syntax to download and install the Atomic yum repository which has the necessary PHP packages.Syntax to Install Atomic Yum Repo:
- wget -q -O - http://www.atomicorp.com/installers/atomic |sh
The above command will download and install the atmoic.repo file located in /etc/yum.repos.d.
- Upgrade PHP: Now with the Atomic yum repository installed upgrade PHP by issuing the below command.Syntax to Upgrade PHP via Yum:
- yum update php
By default around 15 to 20 packages will be updated. There are still a couple more PHP modules that need to be installed so don’t restart Apache just yet.
- Install PHP Packages: There are going to still be some PHP packages that need to be upgraded even though they were not included in the initial update PHP command. use the syntax below to install the other necessary PHP modules.Syntax to Upgrade PHP Modules:
- yum install php-mcrypt php-mhash php-mssql php-tidy
You may have other PHP modules that need to be upgraded which we will verify after restarting Apache.
- Restart Apache: Now restart Apache which is typically done using the below syntax.Syntax to Restart Apache:
- /etc/init.d/httpd restart
- Verify Error Free Functionality: Now you will want to view the Apache error log file to make sure there are not any other PHP modules that need to be upgraded via yum. If the default Apache error log is in a different location make sure to update it when using the below command.Syntax to View Apache Error Log File in Real Time:
- tail -f /var/log/httpd/error_log
If no other errors are located you area now running PHP version 5.2 with little effort.
I would suggest going through each site and testing functionality. Also if the server is running ISPConfig or another virtual hosting software package you will need to manually verify phpMyAdmin and the virtual hosting software control panel. Another not as common item that I noticed was the fact that I did not have the 5.2.0 zend_extension loaded so any sites requiring ioncube were not displaying. If you upgraded from PHP version 5.1 then you will need to replace the below in /etc/php.ini.
PHP.ini Zend Ioncube Configuration:
- zend_extension = /usr/sbin/ioncube_loader_lin_5.1.so
Replace the Above With:
- zend_extension = /usr/sbin/ioncube_loader_lin_5.2.so
Once modified you need to restart Apache for the change to start working. I would check back on the Apache error log every so often to make sure that no other errors pop up without you resolving them quickly.