Trying to install OpenX, we encountered a segmentation fault that caused the Apache httpd
daemon to crash. The problem was caused by the libphp library. So we decided to upgrade from PHP version 5.1 to 5.2.
We start by creating a new file /etc/yum.repos.d/CentOS-Testing.repo:
# CentOS-Testing: # !!!! CAUTION !!!! # This repository is a proving grounds for packages on their way to CentOSPlus and CentOS Extras. # They may or may not replace core CentOS packages, and are not guaranteed to function properly. # These packages build and install, but are waiting for feedback from testers as to # functionality and stability. Packages in this repository will come and go during the # development period, so it should not be left enabled or used on production systems without due # consideration. [c5-testing] name=CentOS-5 Testing baseurl=http://dev.centos.org/centos/$releasever/testing/$basearch/ enabled=1 gpgcheck=1 gpgkey=http://dev.centos.org/centos/RPM-GPG-KEY-CentOS-testing includepkgs=php*
The last line makes sure that only PHP and related packages will be selected from the Testing repository. As long as you have deployed only the standard PHP packages, this should do the job. You can check out which packages are installed using this command:
rpm -qa |grep php
Updating
Now we are ready to perform the actual upgrade:
[root@services ~]# yum update Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * addons: centos.weepeetelecom.nl * base: centos.mirror.transip.nl * centosplus: centos.mirror.transip.nl * extras: centos.mirror.transip.nl * updates: centos.mirror.transip.nl c5-testing | 1.9 kB 00:00 c5-testing/primary_db | 636 kB 00:01 Reducing CentOS-5 Testing to included packages only Finished Setting up Update Process Resolving Dependencies --> Running transaction check ---> Package php.x86_64 0:5.2.10-1.el5.centos set to be updated ---> Package php-bcmath.x86_64 0:5.2.10-1.el5.centos set to be updated ---> Package php-cli.x86_64 0:5.2.10-1.el5.centos set to be updated ---> Package php-common.x86_64 0:5.2.10-1.el5.centos set to be updated ---> Package php-devel.x86_64 0:5.2.10-1.el5.centos set to be updated ---> Package php-gd.x86_64 0:5.2.10-1.el5.centos set to be updated ---> Package php-ldap.x86_64 0:5.2.10-1.el5.centos set to be updated ---> Package php-mbstring.x86_64 0:5.2.10-1.el5.centos set to be updated ---> Package php-mysql.x86_64 0:5.2.10-1.el5.centos set to be updated ---> Package php-ncurses.x86_64 0:5.2.10-1.el5.centos set to be updated ---> Package php-odbc.x86_64 0:5.2.10-1.el5.centos set to be updated ---> Package php-pdo.x86_64 0:5.2.10-1.el5.centos set to be updated ---> Package php-pear.noarch 1:1.8.1-2.el5.centos set to be updated ---> Package php-pgsql.x86_64 0:5.2.10-1.el5.centos set to be updated ---> Package php-soap.x86_64 0:5.2.10-1.el5.centos set to be updated ---> Package php-xml.x86_64 0:5.2.10-1.el5.centos set to be updated --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================ Package Arch Version Repository Size ============================================================================================================================ Updating: php x86_64 5.2.10-1.el5.centos c5-testing 1.2 M php-bcmath x86_64 5.2.10-1.el5.centos c5-testing 29 k php-cli x86_64 5.2.10-1.el5.centos c5-testing 2.4 M php-common x86_64 5.2.10-1.el5.centos c5-testing 242 k php-devel x86_64 5.2.10-1.el5.centos c5-testing 549 k php-gd x86_64 5.2.10-1.el5.centos c5-testing 114 k php-ldap x86_64 5.2.10-1.el5.centos c5-testing 32 k php-mbstring x86_64 5.2.10-1.el5.centos c5-testing 1.1 M php-mysql x86_64 5.2.10-1.el5.centos c5-testing 83 k php-ncurses x86_64 5.2.10-1.el5.centos c5-testing 37 k php-odbc x86_64 5.2.10-1.el5.centos c5-testing 49 k php-pdo x86_64 5.2.10-1.el5.centos c5-testing 63 k php-pear noarch 1:1.8.1-2.el5.centos c5-testing 419 k php-pgsql x86_64 5.2.10-1.el5.centos c5-testing 67 k php-soap x86_64 5.2.10-1.el5.centos c5-testing 139 k php-xml x86_64 5.2.10-1.el5.centos c5-testing 103 k Transaction Summary ============================================================================================================================ Install 0 Package(s) Upgrade 16 Package(s) Total download size: 6.6 M Is this ok [y/N]: Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Updating : php-common 1/32 warning: /etc/php.ini created as /etc/php.ini.rpmnew Updating : php-pdo 2/32 Updating : php-cli 3/32 Updating : php 4/32 warning: /etc/httpd/conf.d/php.conf created as /etc/httpd/conf.d/php.conf.rpmnew Updating : php-odbc 5/32 Updating : php-mysql 6/32 Updating : php-pgsql 7/32 Updating : php-ncurses 8/32 Updating : php-ldap 9/32 Updating : php-bcmath 10/32 Updating : php-xml 11/32 Updating : php-soap 12/32 Updating : php-gd 13/32 Updating : php-mbstring 14/32 Updating : php-devel 15/32 Updating : php-pear 16/32 Cleanup : php-ncurses 17/32 Cleanup : php-ldap 18/32 Cleanup : php-pear 19/32 Cleanup : php-common 20/32 Cleanup : php-bcmath 21/32 Cleanup : php-xml 22/32 Cleanup : php-soap 23/32 Cleanup : php-devel 24/32 Cleanup : php-gd 25/32 Cleanup : php-odbc 26/32 Cleanup : php 27/32 Cleanup : php-mbstring 28/32 Cleanup : php-cli 29/32 Cleanup : php-pdo 30/32 Cleanup : php-mysql 31/32 Cleanup : php-pgsql 32/32 Updated: php.x86_64 0:5.2.10-1.el5.centos php-bcmath.x86_64 0:5.2.10-1.el5.centos php-cli.x86_64 0:5.2.10-1.el5.centos php-common.x86_64 0:5.2.10-1.el5.centos php-devel.x86_64 0:5.2.10-1.el5.centos php-gd.x86_64 0:5.2.10-1.el5.centos php-ldap.x86_64 0:5.2.10-1.el5.centos php-mbstring.x86_64 0:5.2.10-1.el5.centos php-mysql.x86_64 0:5.2.10-1.el5.centos php-ncurses.x86_64 0:5.2.10-1.el5.centos php-odbc.x86_64 0:5.2.10-1.el5.centos php-pdo.x86_64 0:5.2.10-1.el5.centos php-pear.noarch 1:1.8.1-2.el5.centos php-pgsql.x86_64 0:5.2.10-1.el5.centos php-soap.x86_64 0:5.2.10-1.el5.centos php-xml.x86_64 0:5.2.10-1.el5.centos Complete! [root@services ~]#
New Configuration Files
As you can see, two .rpmnew files were created in the process. So we check whether the new /etc/php.ini.rpmnew file is different from the original /etc/php.ini:
diff php.ini.rpmnew php.ini.org
There are a lot of differences between the two, so we do another diff
on our own current configuration and the original file:
diff php.ini php.ini.org
and we work the differences into the .rpmnew file:
cp php.ini.rpmnew php.ini.new mv php.ini.org php.ini.org.old vim php.ini.new
After which we put the new configuration file in place:
mv php.ini php.ini.old mv php.ini.new php.ini mv php.ini.rpmnew php.ini.org
We do the same for /etc/httpd/conf.d/php.conf:
[root@services conf.d]# diff php.conf.org php.conf.rpmnew [root@services conf.d]#
Since there were no changes to this file made between the two versions, we can simply remove the .rpmnew file:
rm php.conf.rpmnew
Restarting the Web Server
Now we are ready to restart the web server:
[root@services conf.d]# /etc/init.d/httpd restart Stopping httpd: [ OK ] Starting httpd: [ OK ]
And version 5.2 of PHP should be in place:
[root@services conf.d]# rpm -qa |grep php php-mysql-5.2.10-1.el5.centos php-cli-5.2.10-1.el5.centos php-pear-1.8.1-2.el5.centos php-gd-5.2.10-1.el5.centos php-pdo-5.2.10-1.el5.centos php-bcmath-5.2.10-1.el5.centos php-pgsql-5.2.10-1.el5.centos php-devel-5.2.10-1.el5.centos php-5.2.10-1.el5.centos php-soap-5.2.10-1.el5.centos php-common-5.2.10-1.el5.centos php-ldap-5.2.10-1.el5.centos php-mbstring-5.2.10-1.el5.centos php-xml-5.2.10-1.el5.centos php-ncurses-5.2.10-1.el5.centos php-odbc-5.2.10-1.el5.centos
You can check the version and sanity of your PHP installation using this command:
php -v
[…] two months, no solution had came up, so we decided to upgrade to PHP version 5.2, after which this problems was […]
As of today Apli 13 2012 PHP 5.2 is no more included in CentOS Testing repository
[…] was moved to PHP 5.2 using another repo, or maybe by a manual package installation. This has been documented online with the use of the CentOS Testing repository. If your php-common package was a one-off […]