Apr 29 2008
How to upgrade to PHP 5 on Centos 4.6
I have a VMWare Virtual machine that I use for testing and I needed to upgrade to PHP 5
this can be accomplished this way.
To upgrade to PHP5
edit /etc/yum.repos.d/CentOS-Base.repo
Enable CentOSPlus
Then do yum update php
basically the REPO will look like this after you enable it.
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
gpgcheck=1
[root@localhost ~]# yum update php
Setting up Update Process
Setting up repositories
centosplus 100% |=========================| 951 B 00:00
Reading repository metadata in from local files
primary.xml.gz 100% |=========================| 82 kB 00:00
centosplus: ################################################## 274/274
Resolving Dependencies
–> Populating transaction set with selected packages. Please wait.
—> Downloading header for php to pack into transaction set.
php-5.1.6-3.el4s1.8.i386. 100% |=========================| 17 kB 00:00
—> Package php.i386 0:5.1.6-3.el4s1.8 set to be updated
–> Running transaction check
–> Processing Dependency: php = 4.3.9-3.22.9 for package: php-ldap
–> Processing Dependency: php-cli = 5.1.6-3.el4s1.8 for package: php
–> Processing Dependency: php = 4.3.9-3.22.9 for package: php-pear
–> Processing Dependency: php-common = 5.1.6-3.el4s1.8 for package: php
–> Restarting Dependency Resolution with new changes.
–> Populating transaction set with selected packages. Please wait.
—> Downloading header for php-common to pack into transaction set.
php-common-5.1.6-3.el4s1. 100% |=========================| 19 kB 00:00
—> Package php-common.i386 0:5.1.6-3.el4s1.8 set to be updated
—> Downloading header for php-ldap to pack into transaction set.
php-ldap-5.1.6-3.el4s1.8. 100% |=========================| 16 kB 00:00
—> Package php-ldap.i386 0:5.1.6-3.el4s1.8 set to be updated
—> Downloading header for php-pear to pack into transaction set.
php-pear-1.4.11-1.el4s1.1 100% |=========================| 20 kB 00:00
—> Package php-pear.noarch 1:1.4.11-1.el4s1.1 set to be updated
—> Downloading header for php-cli to pack into transaction set.
php-cli-5.1.6-3.el4s1.8.i 100% |=========================| 17 kB 00:00
—> Package php-cli.i386 0:5.1.6-3.el4s1.8 set to be updated
–> Running transaction check
Dependencies Resolved
=============================================================================
Package Arch Version Repository Size
=============================================================================
Updating:
php i386 5.1.6-3.el4s1.8 centosplus 1.1 M
Installing for dependencies:
php-cli i386 5.1.6-3.el4s1.8 centosplus 2.0 M
php-common i386 5.1.6-3.el4s1.8 centosplus 136 k
Updating for dependencies:
php-ldap i386 5.1.6-3.el4s1.8 centosplus 31 k
php-pear noarch 1:1.4.11-1.el4s1.1 centosplus 345 k
Transaction Summary
=============================================================================
Install 2 Package(s)
Update 3 Package(s)
Remove 0 Package(s)
Total download size: 3.7 M
Is this ok [y/N]:
Click Yes and cross your fingers ;)
Downloading Packages:
(1/5): php-common-5.1.6-3 100% |=========================| 136 kB 00:00
(2/5): php-ldap-5.1.6-3.e 100% |=========================| 31 kB 00:00
(3/5): php-pear-1.4.11-1. 100% |=========================| 345 kB 00:01
(4/5): php-cli-5.1.6-3.el 100% |=========================| 2.0 MB 00:12
(5/5): php-5.1.6-3.el4s1. 100% |=========================| 1.1 MB 00:06
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: php-common ######################### [1/8]
Installing: php-cli ######################### [2/8]
Updating : php ######################### [3/8]
Updating : php-pear ######################### [4/8]
Updating : php-ldap ######################### [5/8]
Cleanup : php-ldap ######################### [6/8]
Cleanup : php-pear ######################### [7/8]
Cleanup : php ######################### [8/8]
Dependency Installed: php-cli.i386 0:5.1.6-3.el4s1.8 php-common.i386 0:5.1.6-3.el4s1.8
Updated: php.i386 0:5.1.6-3.el4s1.8
Dependency Updated: php-ldap.i386 0:5.1.6-3.el4s1.8 php-pear.noarch 1:1.4.11-1.el4s1.1
Complete!
now let’s check our php version.
[root@localhost ~]# php -v
PHP 5.1.6 (cli) (built: Oct 26 2007 13:49:00)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
[root@localhost ~]#
You probably need to restart apache so that apache don’t ask me why but I know that the upgrade recommends to restart apache.
if I run into any issues I will let you know :)
