How to upgrade PHP5.3 to PHP5.4 on LINUX


In the previous tutorial, we learn How to upgrade PHP on LINUX, but in that tutorial, we install PHP5.3. Now, how to upgrade PHP5.3 to PHP5.4 on LINUX?

Step 1: Find out the version of Centos
You can use 2 methods:

[root@tutorialspots build]# cat /etc/issue
CentOS release 5.3 (Final)
Kernel \r on an \m

[root@tutorialspots build]# cat /etc/redhat-release
CentOS release 5.3 (Final)

In this example, we use CentOS 5.3.

Step 2: Add new Repository
CentOS/RHEL 7.x:

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

CentOS/RHEL 6.x:

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm

CentOS/RHEL 5.x:

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-5.noarch.rpm
rpm -Uvh http://mirror.webtatic.com/yum/el5/latest.rpm

Sample output:

[root@tutorialspots build]# rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
Retrieving https://mirror.webtatic.com/yum/el6/latest.rpm
error: skipping https://mirror.webtatic.com/yum/el6/latest.rpm - transfer failed
 - Unknown or unexpected error
[root@tutorialspots build]# rpm -Uvh http://mirror.webtatic.com/yum/el5/latest.rpm
Retrieving http://mirror.webtatic.com/yum/el5/latest.rpm
warning: /var/tmp/rpm-xfer.WYtIbb: Header V4 DSA signature: NOKEY, key ID cf4c4f
f9
Preparing...                ########################################### [100%]
   1:webtatic5-release      ########################################### [100%]

Step 3: install yum-plugin-replace

[root@tutorialpots build]# yum install yum-plugin-replace
Loaded plugins: fastestmirror, protectbase
Loading mirror speeds from cached hostfile
 * epel: linux.mirrors.es.net
 * base: mirror.keystealth.org
 * updates: mirror.pac-12.org
 * webtatic-el5: us-east.repo.webtatic.com
 * extras: mirrors.easynews.com
 * addons: mirror.chpc.utah.edu
webtatic-el5                                             | 2.5 kB     00:00
824c428e0a3abafaa54c85714ea04653bd6bd8ad-primary.sqlite. |  87 kB     00:00
0 packages excluded due to repository protections
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package yum-plugin-replace.noarch 0:0.2.7-1.ius.el5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                Arch       Version               Repository        Size
================================================================================
Installing:
 yum-plugin-replace     noarch     0.2.7-1.ius.el5       webtatic-el5      17 k

Transaction Summary
================================================================================
Install      1 Package(s)
Update       0 Package(s)
Remove       0 Package(s)

Total download size: 17 k
Is this ok [y/N]: y
Downloading Packages:
yum-plugin-replace-0.2.7-1.ius.el5.noarch.rpm            |  17 kB     00:00
warning: rpmts_HdrFromFdno: Header V4 DSA signature: NOKEY, key ID cf4c4ff9
Importing GPG key 0xCF4C4FF9 "Andy Thompson <andy@webtatic.com>" from /etc/pki/r
pm-gpg/RPM-GPG-KEY-webtatic-andy
Is this ok [y/N]: y
Downloading Packages:
yum-plugin-replace-0.2.7-1.ius.el5.noarch.rpm            |  17 kB     00:00
warning: rpmts_HdrFromFdno: Header V4 DSA signature: NOKEY, key ID cf4c4ff9
Importing GPG key 0xCF4C4FF9 "Andy Thompson <andy@webtatic.com>" from /etc/pki/r
pm-gpg/RPM-GPG-KEY-webtatic-andy
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/1]

Installed: yum-plugin-replace.noarch 0:0.2.7-1.ius.el5
Complete!

Step 4:
Now we can replace PHP 5.3 TO PHP 5.4

yum replace php53 --replace-with=php54w

Sample output:

[root@tutorialpots build]# yum replace php53 --replace-with=php54w
Loaded plugins: fastestmirror, protectbase, replace
Loading mirror speeds from cached hostfile
 * epel: linux.mirrors.es.net
 * base: mirror.keystealth.org
 * updates: mirror.pac-12.org
 * webtatic-el5: us-east.repo.webtatic.com
 * extras: mirrors.easynews.com
 * addons: mirror.chpc.utah.edu
0 packages excluded due to repository protections
Replacing packages takes time, please be patient...

WARNING: Unable to resolve all providers: ['config(php53-common)', 'php53-common
', 'php53-cli', 'config(php53)', 'php53', 'config(php53-devel)', 'php53-devel',
'config(php53-pdo)', 'php53-pdo', 'config(php53-mysql)', 'php53-mysql']

This may be normal depending on the package.  Continue? [y/N] y
Resolving Dependencies
--> Running transaction check
---> Package php54w-mysql.i386 0:5.4.45-2.w5 set to be updated
---> Package php53-mysql.i386 0:5.3.3-26.el5_11 set to be erased
---> Package php54w-pdo.i386 0:5.4.45-2.w5 set to be updated
---> Package php53-common.i386 0:5.3.3-26.el5_11 set to be erased
---> Package php53-pdo.i386 0:5.3.3-26.el5_11 set to be erased
---> Package php54w-devel.i386 0:5.4.45-2.w5 set to be updated
--> Processing Dependency: pcre-devel for package: php54w-devel
--> Processing Dependency: libedit.so.0 for package: php54w-devel
---> Package php53-devel.i386 0:5.3.3-26.el5_11 set to be erased
---> Package php54w-cli.i386 0:5.4.45-2.w5 set to be updated
---> Package php53.i386 0:5.3.3-26.el5_11 set to be erased
---> Package php53-cli.i386 0:5.3.3-26.el5_11 set to be erased
---> Package php54w.i386 0:5.4.45-2.w5 set to be updated
---> Package php54w-common.i386 0:5.4.45-2.w5 set to be updated
--> Running transaction check
---> Package libedit.i386 0:2.11-2.20080712cvs.el5 set to be updated
---> Package pcre-devel.i386 0:8.02-1.el5_5.1 set to be updated
--> Processing Dependency: pcre = 8.02-1.el5_5.1 for package: pcre-devel
--> Running transaction check
---> Package pcre.i386 0:8.02-1.el5_5.1 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package          Arch    Version                     Repository           Size
================================================================================
Installing:
 php54w           i386    5.4.45-2.w5                 webtatic-el5        2.9 M
 php54w-cli       i386    5.4.45-2.w5                 webtatic-el5        2.9 M
 php54w-common    i386    5.4.45-2.w5                 webtatic-el5        1.3 M
 php54w-devel     i386    5.4.45-2.w5                 webtatic-el5        2.9 M
 php54w-mysql     i386    5.4.45-2.w5                 webtatic-el5        148 k
 php54w-pdo       i386    5.4.45-2.w5                 webtatic-el5        103 k
Updating:
 pcre             i386    8.02-1.el5_5.1              lxcenter-updates    460 k
Removing:
 php53            i386    5.3.3-26.el5_11             installed           3.2 M
 php53-cli        i386    5.3.3-26.el5_11             installed           6.1 M
 php53-common     i386    5.3.3-26.el5_11             installed           2.9 M
 php53-devel      i386    5.3.3-26.el5_11             installed           2.9 M
 php53-mysql      i386    5.3.3-26.el5_11             installed           177 k
 php53-pdo        i386    5.3.3-26.el5_11             installed           108 k
Installing for dependencies:
 libedit          i386    2.11-2.20080712cvs.el5      epel                 79 k
 pcre-devel       i386    8.02-1.el5_5.1              lxcenter-updates    395 k

Transaction Summary
================================================================================
Install      8 Package(s)
Update       1 Package(s)
Remove       6 Package(s)

Total download size: 11 M
Is this ok [y/N]: y
Downloading Packages:
(1/9): libedit-2.11-2.20080712cvs.el5.i386.rpm           |  79 kB     00:00
(2/9): php54w-pdo-5.4.45-2.w5.i386.rpm                   | 103 kB     00:00
(3/9): php54w-mysql-5.4.45-2.w5.i386.rpm                 | 148 kB     00:00
(4/9): pcre-devel-8.02-1.el5_5.1.i386.rpm                | 395 kB     00:00
(5/9): pcre-8.02-1.el5_5.1.i386.rpm                      | 460 kB     00:00
(6/9): php54w-common-5.4.45-2.w5.i386.rpm                | 1.3 MB     00:00
(7/9): php54w-cli-5.4.45-2.w5.i386.rpm                   | 2.9 MB     00:00
(8/9): php54w-devel-5.4.45-2.w5.i386.rpm                 | 2.9 MB     00:00
(9/9): php54w-5.4.45-2.w5.i386.rpm                       | 2.9 MB     00:00
--------------------------------------------------------------------------------
Total                                           1.8 MB/s |  11 MB     00:06
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating       : pcre                                            [ 1/16]
  Installing     : pcre-devel                                      [ 2/16]
  Installing     : php54w-common                                   [ 3/16]
warning: /etc/php.ini created as /etc/php.ini.rpmnew
  Installing     : libedit                                         [ 4/16]
  Installing     : php54w-cli                                      [ 5/16]
  Installing     : php54w-pdo                                      [ 6/16]
  Installing     : php54w                                          [ 7/16]
  Installing     : php54w-mysql                                    [ 8/16]
  Installing     : php54w-devel                                    [ 9/16]
  Cleanup        : pcre                                            [10/16]
  Erasing        : php53-devel                                     [11/16]
  Erasing        : php53-pdo                                       [12/16]
  Erasing        : php53-cli                                       [13/16]
  Erasing        : php53-mysql                                     [14/16]
  Erasing        : php53                                           [15/16]
  Erasing        : php53-common                                    [16/16]

Removed: php53.i386 0:5.3.3-26.el5_11 php53-cli.i386 0:5.3.3-26.el5_11 php53-com
mon.i386 0:5.3.3-26.el5_11 php53-devel.i386 0:5.3.3-26.el5_11 php53-mysql.i386 0
:5.3.3-26.el5_11 php53-pdo.i386 0:5.3.3-26.el5_11
Installed: php54w.i386 0:5.4.45-2.w5 php54w-cli.i386 0:5.4.45-2.w5 php54w-common
.i386 0:5.4.45-2.w5 php54w-devel.i386 0:5.4.45-2.w5 php54w-mysql.i386 0:5.4.45-2
.w5 php54w-pdo.i386 0:5.4.45-2.w5
Dependency Installed: libedit.i386 0:2.11-2.20080712cvs.el5 pcre-devel.i386 0:8.
02-1.el5_5.1
Updated: pcre.i386 0:8.02-1.el5_5.1
Complete!

Note: if you see the WARNING:

Unable to resolve all providers: ['config(php53-common)', 'php53-common
', 'php53-cli', 'config(php53)', 'php53', 'config(php53-devel)', 'php53-devel',
'config(php53-pdo)', 'php53-pdo', 'config(php53-mysql)', 'php53-mysql']

you can continue by tying “y“

Step 5: service httpd restart

Done! Welcome to PHP 5.4

centos upgrade php 5.4

Related Post

,

No comments yet.

Leave a Reply