CentOS 5.6 – Update PHP to 5.3.6
Updating PHP to a version which is not already provided by the official centos yum repositories is always a pain in the ass. Fortunately there are some third-partys-repos which provide working rpms for centos 5 and php. The following tutorial shows how to update a centos-5-php to a recent version.
Updating PHP
We will use IUS Community Repo.
1. Install IUS and EPEL repository
wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/ius-release-1.0-8.ius.el5.noarch.rpm
wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/epel-release-5-4.noarch.rpm
rpm -Uhvius-release-1.0-8.ius.el5.noarch.rpm epel-release-5-4.noarch.rpm
Please choose a matching rpm for youre distribution from http://dl.iuscommunity.org/pub/ius/stable/Redhat/
2. Install IUS-yum-plugin-replace
yum install yum-plugin-replace
3. Replace old PHP
yum replace php --replace-with php53u
Replace php53u with recent version provided here: http://dl.iuscommunity.org/pub/ius/stable/Redhat/ (+choose version and architecture)
Please note: The message "Unable to resolve all providers" is OK. IUS describes this here:
As you can see there is a WARNING that the 'replace' operation was unable to resolve all providers. This means that the 'php53' package doesn't provide everything that the 'php' packages did. This is normal, and should be expected when upgrading major versions of software.
4. Finished! After checking httpd.conf syntax you can restart apache webserver and new php should be active (check for example via php -v or phpinfo).
httpd -t
php -v
service httpd restart
Complete Output of php upgrade:
[root@server ~]# wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/ius-release-1.0-8.ius.el5.noarch.rpm
--2011-08-26 10:53:39-- http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/ius-release-1.0-8.ius.el5.noarch.rpm
Auflösen des Rechnernamens »dl.iuscommunity.org«.... 174.143.24.129
Verbindungsaufbau mit dl.iuscommunity.org[174.143.24.129]:80... verbunden.
HTTP-Anfrage gesendet, warte auf Antwort... 200 OK
Länge: 6823 (6,7K) [application/x-rpm]
Speichere nach: »ius-release-1.0-8.ius.el5.noarch.rpm«100%[===================================================================================================================================>] 6.823 --.-K/s in 0,1s
2011-08-26 10:53:40 (52,1 KB/s) - »ius-release-1.0-8.ius.el5.noarch.rpm« gespeichert [6823/6823]
[root@server ~]# wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/epel-release-5-4.noarch.rpm
--2011-08-26 10:53:58-- http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/epel-release-5-4.noarch.rpm
Auflösen des Rechnernamens »dl.iuscommunity.org«.... 174.143.24.129
Verbindungsaufbau mit dl.iuscommunity.org[174.143.24.129]:80... verbunden.
HTTP-Anfrage gesendet, warte auf Antwort... 200 OK
Länge: 12275 (12K) [application/x-rpm]
Speichere nach: »epel-release-5-4.noarch.rpm«100%[===================================================================================================================================>] 12.275 --.-K/s in 0,1s
2011-08-26 10:53:59 (93,3 KB/s) - »epel-release-5-4.noarch.rpm« gespeichert [12275/12275]
[root@server ~]# rpm -Uhv ius-release-1.0-8.ius.el5.noarch.rpm epel-release-5-4.noarch.rpm
Warnung: ius-release-1.0-8.ius.el5.noarch.rpm: Header V4 DSA-Signatur: NOKEY, key ID 9cd4953f
Vorbereiten... ########################################### [100%]
1:epel-release ########################################### [ 50%]
2:ius-release ########################################### [100%]
You have mail in /var/spool/mail/root
[root@server ~]# yum install yum-plugin-replace
Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
* addons: centos.kiewel-online.ch
* base: centos.kiewel-online.ch
* epel: vesta.informatik.rwth-aachen.de
* extras: centos.kiewel-online.ch
* ius: mirrors.ircam.fr
* rpmforge: ftp-stud.fht-esslingen.de
* updates: centos.kiewel-online.ch
epel | 3.7 kB 00:00
epel/primary_db | 3.8 MB 00:00
ius | 2.2 kB 00:00
ius/primary_db | 83 kB 00:00
Excluding Packages in global exclude list
Finished
Reducing Red Hat Enterprise 5 - RPMforge.net - dag to included packages only
Finished
251 packages excluded due to repository priority protections
Setting up Install Process
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them.
The program yum-complete-transaction is found in the yum-utils package.
--> Running transaction check
---> Package yum-plugin-replace.noarch 0:0.2.4-3.el5 set to be updated
--> Finished Dependency ResolutionDependencies Resolved
=============================================================================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================================================================
Installing:
yum-plugin-replace noarch 0.2.4-3.el5 ius 16 kTransaction Summary
=============================================================================================================================================================================
Install 1 Package(s)
Upgrade 0 Package(s)Total download size: 16 k
Is this ok [y/N]: y
Downloading Packages:
yum-plugin-replace-0.2.4-3.el5.noarch.rpm | 16 kB 00:00
Warnung: rpmts_HdrFromFdno: Header V4 DSA-Signatur: NOKEY, key ID 9cd4953f
ius/gpgkey | 1.3 kB 00:00
Importing GPG key 0x9CD4953F "IUS Community Project <coredev@iuscommunity.org>" from /etc/pki/rpm-gpg/IUS-COMMUNITY-GPG-KEY
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : yum-plugin-replace 1/1Installed:
yum-plugin-replace.noarch 0:0.2.4-3.el5Complete!
[root@server ~]# yum replace php --replace-with php53u
Loaded plugins: fastestmirror, priorities, replace
Loading mirror speeds from cached hostfile
* addons: centos.kiewel-online.ch
* base: centos.kiewel-online.ch
* epel: vesta.informatik.rwth-aachen.de
* extras: centos.kiewel-online.ch
* ius: mirrors.ircam.fr
* rpmforge: ftp-stud.fht-esslingen.de
* updates: centos.kiewel-online.ch
Excluding Packages in global exclude list
Finished
Reducing Red Hat Enterprise 5 - RPMforge.net - dag to included packages only
Finished
251 packages excluded due to repository priority protections
Replacing packages takes time, please be patient...WARNING: Unable to resolve all providers: ['config(php)', 'config(php-ldap)', 'php-pcntl', 'php-readline', 'config(php-common)', 'dbase.so()(64bit)', 'php-dbase', 'config(php-pdo)', 'config(php-mysql)', 'config(php-mbstring)', 'config(php-imap)', 'config(php-snmp)', 'config(php-xml)', 'config(php-xmlrpc)', 'php-xmlrpc', 'config(php-soap)', 'config(php-odbc)', 'config(php-gd)', 'config(php-devel)']
This may be normal depending on the package. Continue? [y/N] y
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them.
The program yum-complete-transaction is found in the yum-utils package.
--> Running transaction check
---> Package php.x86_64 0:5.2.9-2.el5.centos set to be erased
---> Package php-cli.x86_64 0:5.2.9-2.el5.centos set to be erased
---> Package php-common.x86_64 0:5.2.9-2.el5.centos set to be erased
--> Processing Dependency: php-api = 20041225 for package: php-tidy
--> Processing Dependency: php-api = 20041225 for package: php-mhash
---> Package php-devel.x86_64 0:5.2.9-2.el5.centos set to be erased
---> Package php-gd.x86_64 0:5.2.9-2.el5.centos set to be erased
---> Package php-imap.x86_64 0:5.2.9-2.el5.centos set to be erased
---> Package php-ldap.x86_64 0:5.2.9-2.el5.centos set to be erased
---> Package php-mbstring.x86_64 0:5.2.9-2.el5.centos set to be erased
---> Package php-mcrypt.x86_64 0:5.2.9-2.el5.centos.3 set to be erased
---> Package php-mssql.x86_64 0:5.2.9-2.el5.centos.3 set to be erased
---> Package php-mysql.x86_64 0:5.2.9-2.el5.centos set to be erased
---> Package php-odbc.x86_64 0:5.2.9-2.el5.centos set to be erased
---> Package php-pdo.x86_64 0:5.2.9-2.el5.centos set to be erased
---> Package php-pear.noarch 1:1.5.1-2.el5s2 set to be erased
---> Package php-snmp.x86_64 0:5.2.9-2.el5.centos set to be erased
---> Package php-soap.x86_64 0:5.2.9-2.el5.centos set to be erased
---> Package php-xml.x86_64 0:5.2.9-2.el5.centos set to be erased
---> Package php-xmlrpc.x86_64 0:5.2.9-2.el5.centos set to be erased
---> Package php53u.x86_64 0:5.3.6-4.ius.el5 set to be updated
--> Processing Dependency: libedit for package: php53u
--> Processing Dependency: t1lib for package: php53u
---> Package php53u-cli.x86_64 0:5.3.6-4.ius.el5 set to be updated
---> Package php53u-common.x86_64 0:5.3.6-4.ius.el5 set to be updated
---> Package php53u-devel.x86_64 0:5.3.6-4.ius.el5 set to be updated
---> Package php53u-gd.x86_64 0:5.3.6-4.ius.el5 set to be updated
---> Package php53u-imap.x86_64 0:5.3.6-4.ius.el5 set to be updated
---> Package php53u-ldap.x86_64 0:5.3.6-4.ius.el5 set to be updated
---> Package php53u-mbstring.x86_64 0:5.3.6-4.ius.el5 set to be updated
---> Package php53u-mcrypt.x86_64 0:5.3.6-4.ius.el5 set to be updated
---> Package php53u-mssql.x86_64 0:5.3.6-4.ius.el5 set to be updated
---> Package php53u-mysql.x86_64 0:5.3.6-4.ius.el5 set to be updated
---> Package php53u-odbc.x86_64 0:5.3.6-4.ius.el5 set to be updated
---> Package php53u-pdo.x86_64 0:5.3.6-4.ius.el5 set to be updated
---> Package php53u-pear.noarch 1:1.9.4-2.ius.el5 set to be updated
---> Package php53u-pgsql.x86_64 0:5.3.6-4.ius.el5 set to be updated
---> Package php53u-process.x86_64 0:5.3.6-4.ius.el5 set to be updated
---> Package php53u-pspell.x86_64 0:5.3.6-4.ius.el5 set to be updated
---> Package php53u-snmp.x86_64 0:5.3.6-4.ius.el5 set to be updated
---> Package php53u-soap.x86_64 0:5.3.6-4.ius.el5 set to be updated
---> Package php53u-xml.x86_64 0:5.3.6-4.ius.el5 set to be updated
---> Package php53u-xmlrpc.x86_64 0:5.3.6-4.ius.el5 set to be updated
--> Running transaction check
---> Package libedit.x86_64 0:2.11-2.20080712cvs.el5 set to be updated
---> Package php-mhash.x86_64 0:5.2.9-2.el5.centos.3 set to be erased
---> Package php-tidy.x86_64 0:5.2.9-2.el5.centos.3 set to be erased
---> Package t1lib.x86_64 0:5.1.1-7.el5 set to be updated
--> Finished Dependency Resolution
--> Running transaction check
---> Package php-mhash.x86_64 0:5.2.9-2.el5.centos.3 set to be erased
--> Processing Dependency: php-api = 20041225 for package: php-mhash
---> Package php-tidy.x86_64 0:5.2.9-2.el5.centos.3 set to be erased
--> Processing Dependency: php-api = 20041225 for package: php-tidy
--> Running transaction check
---> Package php-mhash.x86_64 0:5.2.9-2.el5.centos.3 set to be erased
---> Package php-tidy.x86_64 0:5.2.9-2.el5.centos.3 set to be erased
--> Finished Dependency ResolutionDependencies Resolved
=============================================================================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================================================================
Installing:
php53u x86_64 5.3.6-4.ius.el5 ius 1.6 M
php53u-cli x86_64 5.3.6-4.ius.el5 ius 3.1 M
php53u-common x86_64 5.3.6-4.ius.el5 ius 578 k
php53u-devel x86_64 5.3.6-4.ius.el5 ius 701 k
php53u-gd x86_64 5.3.6-4.ius.el5 ius 114 k
php53u-imap x86_64 5.3.6-4.ius.el5 ius 53 k
php53u-ldap x86_64 5.3.6-4.ius.el5 ius 37 k
php53u-mbstring x86_64 5.3.6-4.ius.el5 ius 1.2 M
php53u-mcrypt x86_64 5.3.6-4.ius.el5 ius 33 k
php53u-mssql x86_64 5.3.6-4.ius.el5 ius 43 k
php53u-mysql x86_64 5.3.6-4.ius.el5 ius 93 k
php53u-odbc x86_64 5.3.6-4.ius.el5 ius 53 k
php53u-pdo x86_64 5.3.6-4.ius.el5 ius 67 k
php53u-pear noarch 1:1.9.4-2.ius.el5 ius 425 k
php53u-pgsql x86_64 5.3.6-4.ius.el5 ius 75 k
php53u-process x86_64 5.3.6-4.ius.el5 ius 39 k
php53u-pspell x86_64 5.3.6-4.ius.el5 ius 26 k
php53u-snmp x86_64 5.3.6-4.ius.el5 ius 29 k
php53u-soap x86_64 5.3.6-4.ius.el5 ius 146 k
php53u-xml x86_64 5.3.6-4.ius.el5 ius 119 k
php53u-xmlrpc x86_64 5.3.6-4.ius.el5 ius 52 k
Removing:
php x86_64 5.2.9-2.el5.centos installed 3.3 M
php-cli x86_64 5.2.9-2.el5.centos installed 5.9 M
php-common x86_64 5.2.9-2.el5.centos installed 649 k
php-devel x86_64 5.2.9-2.el5.centos installed 2.7 M
php-gd x86_64 5.2.9-2.el5.centos installed 362 k
php-imap x86_64 5.2.9-2.el5.centos installed 101 k
php-ldap x86_64 5.2.9-2.el5.centos installed 46 k
php-mbstring x86_64 5.2.9-2.el5.centos installed 1.9 M
php-mcrypt x86_64 5.2.9-2.el5.centos.3 installed 37 k
php-mssql x86_64 5.2.9-2.el5.centos.3 installed 53 k
php-mysql x86_64 5.2.9-2.el5.centos installed 191 k
php-odbc x86_64 5.2.9-2.el5.centos installed 90 k
php-pdo x86_64 5.2.9-2.el5.centos installed 124 k
php-pear noarch 1:1.5.1-2.el5s2 installed 2.1 M
php-snmp x86_64 5.2.9-2.el5.centos installed 28 k
php-soap x86_64 5.2.9-2.el5.centos installed 307 k
php-xml x86_64 5.2.9-2.el5.centos installed 267 k
php-xmlrpc x86_64 5.2.9-2.el5.centos installed 89 k
Installing for dependencies:
libedit x86_64 2.11-2.20080712cvs.el5 epel 80 k
t1lib x86_64 5.1.1-7.el5 epel 208 k
Removing for dependencies:
php-mhash x86_64 5.2.9-2.el5.centos.3 installed 9.4 k
php-tidy x86_64 5.2.9-2.el5.centos.3 installed 43 kTransaction Summary
=============================================================================================================================================================================
Install 23 Package(s)
Upgrade 0 Package(s)
Remove 20 Package(s)
Reinstall 0 Package(s)
Downgrade 0 Package(s)Total download size: 8.8 M
Is this ok [y/N]: y
Downloading Packages:
(1/23): php53u-pspell-5.3.6-4.ius.el5.x86_64.rpm | 26 kB 00:00
(2/23): php53u-snmp-5.3.6-4.ius.el5.x86_64.rpm | 29 kB 00:00
(3/23): php53u-mcrypt-5.3.6-4.ius.el5.x86_64.rpm | 33 kB 00:00
(4/23): php53u-ldap-5.3.6-4.ius.el5.x86_64.rpm | 37 kB 00:00
(5/23): php53u-process-5.3.6-4.ius.el5.x86_64.rpm | 39 kB 00:00
(6/23): php53u-mssql-5.3.6-4.ius.el5.x86_64.rpm | 43 kB 00:00
(7/23): php53u-xmlrpc-5.3.6-4.ius.el5.x86_64.rpm | 52 kB 00:00
(8/23): php53u-imap-5.3.6-4.ius.el5.x86_64.rpm | 53 kB 00:00
(9/23): php53u-odbc-5.3.6-4.ius.el5.x86_64.rpm | 53 kB 00:00
(10/23): php53u-pdo-5.3.6-4.ius.el5.x86_64.rpm | 67 kB 00:00
(11/23): php53u-pgsql-5.3.6-4.ius.el5.x86_64.rpm | 75 kB 00:00
(12/23): libedit-2.11-2.20080712cvs.el5.x86_64.rpm | 80 kB 00:00
(13/23): php53u-mysql-5.3.6-4.ius.el5.x86_64.rpm | 93 kB 00:00
(14/23): php53u-gd-5.3.6-4.ius.el5.x86_64.rpm | 114 kB 00:00
(15/23): php53u-xml-5.3.6-4.ius.el5.x86_64.rpm | 119 kB 00:00
(16/23): php53u-soap-5.3.6-4.ius.el5.x86_64.rpm | 146 kB 00:00
(17/23): t1lib-5.1.1-7.el5.x86_64.rpm | 208 kB 00:00
(18/23): php53u-pear-1.9.4-2.ius.el5.noarch.rpm | 425 kB 00:00
(19/23): php53u-common-5.3.6-4.ius.el5.x86_64.rpm | 578 kB 00:00
(20/23): php53u-devel-5.3.6-4.ius.el5.x86_64.rpm | 701 kB 00:00
(21/23): php53u-mbstring-5.3.6-4.ius.el5.x86_64.rpm | 1.2 MB 00:00
(22/23): php53u-5.3.6-4.ius.el5.x86_64.rpm | 1.6 MB 00:00
(23/23): php53u-cli-5.3.6-4.ius.el5.x86_64.rpm | 3.1 MB 00:00
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 547 kB/s | 8.8 MB 00:16
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 217521f6
epel/gpgkey | 1.7 kB 00:00
Importing GPG key 0x217521F6 "Fedora EPEL <epel@fedoraproject.org>" from /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : php53u-common 1/43
warning: /etc/php.ini created as /etc/php.ini.rpmnew
Installing : php53u-pdo 2/43
Installing : libedit 3/43
Installing : php53u-cli 4/43
Installing : t1lib 5/43
Installing : php53u 6/43
Installing : php53u-devel 7/43
Installing : php53u-odbc 8/43
Installing : php53u-mssql 9/43
Installing : php53u-imap 10/43
Installing : php53u-pspell 11/43
Installing : php53u-pear 12/43
Installing : php53u-xmlrpc 13/43
Installing : php53u-mbstring 14/43
Installing : php53u-ldap 15/43
Installing : php53u-mysql 16/43
Installing : php53u-xml 17/43
Installing : php53u-gd 18/43
Installing : php53u-pgsql 19/43
Installing : php53u-mcrypt 20/43
Installing : php53u-snmp 21/43
Installing : php53u-soap 22/43
Installing : php53u-process 23/43
Erasing : php-pdo 24/43
Erasing : php-mysql 25/43
Erasing : php-gd 26/43
Erasing : php 27/43
Erasing : php-snmp 28/43
Erasing : php-devel 29/43
Erasing : php-mssql 30/43
Erasing : php-tidy 31/43
Erasing : php-odbc 32/43
Erasing : php-mcrypt 33/43
Erasing : php-soap 34/43
Erasing : php-xmlrpc 35/43
Erasing : php-imap 36/43
Erasing : php-xml 37/43
Erasing : php-mbstring 38/43
Erasing : php-ldap 39/43
Erasing : php-common 40/43
Erasing : php-pear 41/43
Erasing : php-mhash 42/43
Erasing : php-cli 43/43Removed:
php.x86_64 0:5.2.9-2.el5.centos php-cli.x86_64 0:5.2.9-2.el5.centos php-common.x86_64 0:5.2.9-2.el5.centos php-devel.x86_64 0:5.2.9-2.el5.centos
php-gd.x86_64 0:5.2.9-2.el5.centos php-imap.x86_64 0:5.2.9-2.el5.centos php-ldap.x86_64 0:5.2.9-2.el5.centos php-mbstring.x86_64 0:5.2.9-2.el5.centos
php-mcrypt.x86_64 0:5.2.9-2.el5.centos.3 php-mssql.x86_64 0:5.2.9-2.el5.centos.3 php-mysql.x86_64 0:5.2.9-2.el5.centos php-odbc.x86_64 0:5.2.9-2.el5.centos
php-pdo.x86_64 0:5.2.9-2.el5.centos php-pear.noarch 1:1.5.1-2.el5s2 php-snmp.x86_64 0:5.2.9-2.el5.centos php-soap.x86_64 0:5.2.9-2.el5.centos
php-xml.x86_64 0:5.2.9-2.el5.centos php-xmlrpc.x86_64 0:5.2.9-2.el5.centosDependency Removed:
php-mhash.x86_64 0:5.2.9-2.el5.centos.3 php-tidy.x86_64 0:5.2.9-2.el5.centos.3Installed:
php53u.x86_64 0:5.3.6-4.ius.el5 php53u-cli.x86_64 0:5.3.6-4.ius.el5 php53u-common.x86_64 0:5.3.6-4.ius.el5 php53u-devel.x86_64 0:5.3.6-4.ius.el5
php53u-gd.x86_64 0:5.3.6-4.ius.el5 php53u-imap.x86_64 0:5.3.6-4.ius.el5 php53u-ldap.x86_64 0:5.3.6-4.ius.el5 php53u-mbstring.x86_64 0:5.3.6-4.ius.el5
php53u-mcrypt.x86_64 0:5.3.6-4.ius.el5 php53u-mssql.x86_64 0:5.3.6-4.ius.el5 php53u-mysql.x86_64 0:5.3.6-4.ius.el5 php53u-odbc.x86_64 0:5.3.6-4.ius.el5
php53u-pdo.x86_64 0:5.3.6-4.ius.el5 php53u-pear.noarch 1:1.9.4-2.ius.el5 php53u-pgsql.x86_64 0:5.3.6-4.ius.el5 php53u-process.x86_64 0:5.3.6-4.ius.el5
php53u-pspell.x86_64 0:5.3.6-4.ius.el5 php53u-snmp.x86_64 0:5.3.6-4.ius.el5 php53u-soap.x86_64 0:5.3.6-4.ius.el5 php53u-xml.x86_64 0:5.3.6-4.ius.el5
php53u-xmlrpc.x86_64 0:5.3.6-4.ius.el5Dependency Installed:
libedit.x86_64 0:2.11-2.20080712cvs.el5 t1lib.x86_64 0:5.1.1-7.el5Complete!
You have mail in /var/spool/mail/root
[root@server ~]# httpd -t
Syntax OK
[root@server ~]# service httpd restart
httpd beenden: [ OK ]
httpd starten: [ OK ]