Setup To Upgrade PHP 5.3 To PHP 5.6 On CentOS

You will need to type below command to verify current PHP version on you system. You can also verify running PHP version using phpinfo page if you have no Linux console access to run command.
Using command line:
#php -v
You will get some output like below.
PHP 5.3.3 (cli) (built: Jul 24 2017 15:39:00)
Copyright (c) 1997‐2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998‐2010 Zend Technologies
Using PHP info page:
Create info.php page on your web document root with below text.
#vim /var/www/html/info.php
<?php
phpinfo();
?>
Save and exit.
Type URL in your browser.
http://10.59.60.185/info.php
PHP Version 5.3
To Upgrade PHP 5.6 you will need to install and enable third party repositories like REMI and EPEL. Follow the below command to install and enable repository.
EPEL Repository installation:
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm && rpm -Uvh epel-release-latest-6.noarch.rpm
–2016-12-21 00:07:22– https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
Resolving dl.fedoraproject.org… 209.132.181.27, 209.132.181.26, 209.132.181.23, …
Connecting to dl.fedoraproject.org|209.132.181.27|:443… connected.
HTTP request sent, awaiting response… 200 OK
Length: 14540 (14K) [application/x-rpm]
Saving to: `epel-release-latest-6.noarch.rpm.2′
100%[==============================================================================================================>] 14,540 –.-K/s in 0.04s
2016-12-21 00:07:28 (363 KB/s) – `epel-release-latest-6.noarch.rpm.2′ saved [14540/14540]
Preparing… ########################################### [100%]
1:epel-release ########################################### [100%]
REMI Repository installation:
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm && rpm -Uvh remi-release-6*.rpm
–2016-12-21 00:09:38– http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
Resolving rpms.famillecollet.com… 195.154.241.117, 2001:bc8:33a1:100::1
Connecting to rpms.famillecollet.com|195.154.241.117|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 8159 (8.0K) [application/x-rpm]
Saving to: `remi-release-6.rpm’
100%[================================================================================================================>] 8,159 –.-K/s in 0.001s
2016-12-21 00:09:44 (12.4 MB/s) – `remi-release-6.rpm’ saved [8159/8159]
warning: remi-release-6.rpm: Header V4 DSA/SHA1 Signature, key ID 00f97f56: NOKEY
Preparing… ########################################### [100%]
1:remi-release ########################################### [100%]
After installaling REMI repository you will need to enable it globally.
Enabling REMI Repository:
To enable remi repostiry for PHP 5.6 you will need to make following changes.
#vim /etc/yum.repos.d/remi.repo
[remi]
name=Remi’s RPM repository for Enterprise Linux 6 – $basearch
#baseurl=http://rpms.remirepo.net/enterprise/6/remi/$basearch/
mirrorlist=http://rpms.remirepo.net/enterprise/6/remi/mirror
enabled=1(change)
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
Also you will need to make below changes in [remi-php56] section to install PHP 5.6.
[remi-php56]
name=Remi’s PHP 5.6 RPM repository for Enterprise Linux 6 – $basearch
#baseurl=http://rpms.remirepo.net/enterprise/6/php56/$basearch/
mirrorlist=http://rpms.remirepo.net/enterprise/6/php56/mirror
NOTICE: common dependencies are in “remi-safe”
enabled=1(change)
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
Save and exit.
REMOVING PHP 5.3
Now you will need to run below command to remove your PHP 5.3 version.
yum remove php-common –y
Loaded plugins: fastestmirror
Setting up Remove Process
Resolving Dependencies
–> Running transaction check
—> Package php-common.x86_64 0:5.3.3-49.el6 will be erased
–> Processing Dependency: php-common(x86-64) = 5.3.3-49.el6 for package: php-cl                                                                                                                                                             i-5.3.3-49.el6.x86_64
–> Processing Dependency: php-common(x86-64) = 5.3.3-49.el6 for package: php-5.                                                                                                                                                             3.3-49.el6.x86_64
–> Running transaction check
—> Package php.x86_64 0:5.3.3-49.el6 will be erased
—> Package php-cli.x86_64 0:5.3.3-49.el6 will be erased
–> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package             Arch            Version               Repository      Size
================================================================================
Removing:
php-common          x86_64          5.3.3-49.el6          @base          2.9 M
Removing for dependencies:
php                 x86_64          5.3.3-49.el6          @base          3.5 M
php-cli             x86_64          5.3.3-49.el6          @base          6.2 M
 
Transaction Summary
================================================================================
Remove        3 Package(s)
Installed size: 13 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
Erasing    : php-5.3.3-49.el6.x86_64                                      1/3
Erasing    : php-cli-5.3.3-49.el6.x86_64                                  2/3
Erasing    : php-common-5.3.3-49.el6.x86_64                               3/3
Verifying  : php-5.3.3-49.el6.x86_64                                      1/3
Verifying  : php-cli-5.3.3-49.el6.x86_64                                  2/3
Verifying  : php-common-5.3.3-49.el6.x86_64                               3/3
Removed:
php-common.x86_64 0:5.3.3-49.el6
Dependency Removed:
php.x86_64 0:5.3.3-49.el6            php-cli.x86_64 0:5.3.3-49.el6
Complete!
INSTALLING PHP 5.6 VERSION
After removing PHP 5.3. You will need to run below command to install PHP 5.6 version
yum install php php-gd php-mysql php-mcrypt –y
You will get some output like below.
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
epel/metalink                                            | 5.3 kB     00:00

  • base: mirror.nbrc.ac.in

  • epel: repo.ugm.ac.id

  • extras: mirror.nbrc.ac.in

  • remi: mirrors.thzhost.com

  • remi-php56: mirrors.thzhost.com

  • remi-safe: mirrors.thzhost.com

  • updates: mirror.nbrc.ac.in

epel                                                     | 4.3 kB     00:00
epel/primary_db                                          | 5.9 MB     00:04
remi                                                     | 2.9 kB     00:00
remi-php56                                               | 2.9 kB     00:00
remi-safe                                                | 2.9 kB     00:00
remi-safe/primary_db                                     | 735 kB     00:01
Package php-mysql is obsoleted by php-mysqlnd, trying to install php-mysqlnd-5.6                                                                                                                                                             .31-1.el6.remi.x86_64 instead
Resolving Dependencies
–> Running transaction check
—> Package php.x86_64 0:5.6.31-1.el6.remi will be installed
–> Processing Dependency: php-common(x86-64) = 5.6.31-1.el6.remi for package: p                                                                                                                                                             hp-5.6.31-1.el6.remi.x86_64
–> Processing Dependency: php-cli(x86-64) = 5.6.31-1.el6.remi for package: php-                                                                                                                                                             5.6.31-1.el6.remi.x86_64
—> Package php-gd.x86_64 0:5.6.31-1.el6.remi will be installed
–> Processing Dependency: gd-last(x86-64) >= 2.1.1 for package: php-gd-5.6.31-1                                                                                                                                                             .el6.remi.x86_64
–> Processing Dependency: libt1.so.5()(64bit) for package: php-gd-5.6.31-1.el6.                                                                                                                                                             remi.x86_64
–> Processing Dependency: libgd.so.3()(64bit) for package: php-gd-5.6.31-1.el6.                                                                                                                                                             remi.x86_64
–> Processing Dependency: libXpm.so.4()(64bit) for package: php-gd-5.6.31-1.el6                                                                                                                                                             .remi.x86_64
—> Package php-mcrypt.x86_64 0:5.6.31-1.el6.remi will be installed
–> Processing Dependency: libmcrypt.so.4()(64bit) for package: php-mcrypt-5.6.3                                                                                                                                                             1-1.el6.remi.x86_64
—> Package php-mysqlnd.x86_64 0:5.6.31-1.el6.remi will be installed
–> Processing Dependency: php-pdo(x86-64) = 5.6.31-1.el6.remi for package: php-                                                                                                                                                             mysqlnd-5.6.31-1.el6.remi.x86_64
–> Running transaction check
—> Package gd-last.x86_64 0:2.2.4-1.el6.remi will be installed
–> Processing Dependency: libwebp.so.5()(64bit) for package: gd-last-2.2.4-1.el                                                                                                                                                             6.remi.x86_64
—> Package libXpm.x86_64 0:3.5.10-2.el6 will be installed
—> Package libmcrypt.x86_64 0:2.5.8-9.el6 will be installed
—> Package php-cli.x86_64 0:5.6.31-1.el6.remi will be installed
—> Package php-common.x86_64 0:5.6.31-1.el6.remi will be installed
–> Processing Dependency: php-pecl-zip(x86-64) for package: php-common-5.6.31-1                                                                                                                                                             .el6.remi.x86_64
–> Processing Dependency: php-pecl-jsonc(x86-64) for package: php-common-5.6.31                                                                                                                                                             -1.el6.remi.x86_64
—> Package php-pdo.x86_64 0:5.6.31-1.el6.remi will be installed
—> Package t1lib.x86_64 0:5.1.2-6.el6_2.1 will be installed
–> Running transaction check
—> Package libwebp.x86_64 0:0.4.3-3.el6 will be installed
—> Package php-pecl-jsonc.x86_64 0:1.3.10-2.el6.remi.5.6 will be installed
—> Package php-pecl-zip.x86_64 0:1.15.1-1.el6.remi.5.6 will be installed
–> Processing Dependency: libzip.so.5()(64bit) for package: php-pecl-zip-1.15.1                                                                                                                                                             -1.el6.remi.5.6.x86_64
–> Running transaction check
—> Package libzip5.x86_64 0:1.2.0-1.el6.remi will be installed
–> Finished Dependency Resolution
 
Dependencies Resolved
================================================================================
Package            Arch       Version                     Repository      Size
================================================================================
Installing:
php                x86_64     5.6.31-1.el6.remi           remi-php56     2.7 M
php-gd             x86_64     5.6.31-1.el6.remi           remi-php56      79 k
php-mcrypt         x86_64     5.6.31-1.el6.remi           remi-php56      49 k
php-mysqlnd        x86_64     5.6.31-1.el6.remi           remi-php56     277 k
Installing for dependencies:
gd-last            x86_64     2.2.4-1.el6.remi            remi           126 k
libXpm             x86_64     3.5.10-2.el6                base            51 k
libmcrypt          x86_64     2.5.8-9.el6                 epel            96 k
libwebp            x86_64     0.4.3-3.el6                 epel           210 k
libzip5            x86_64     1.2.0-1.el6.remi            remi            53 k
php-cli            x86_64     5.6.31-1.el6.remi           remi-php56     4.0 M
php-common         x86_64     5.6.31-1.el6.remi           remi-php56     1.1 M
php-pdo            x86_64     5.6.31-1.el6.remi           remi-php56     119 k
php-pecl-jsonc     x86_64     1.3.10-2.el6.remi.5.6       remi-php56      52 k
php-pecl-zip       x86_64     1.15.1-1.el6.remi.5.6       remi-php56      52 k
t1lib              x86_64     5.1.2-6.el6_2.1             base           160 k
 
Transaction Summary
================================================================================
Install      15 Package(s)
Total size: 9.0 M
Total download size: 1.1 M
Installed size: 32 M
Is this ok [y/N]: y
Downloading Packages:
(1/9): gd-last-2.2.4-1.el6.remi.x86_64.rpm               | 126 kB     00:00
(2/9): libXpm-3.5.10-2.el6.x86_64.rpm                    |  51 kB     00:00
(3/9): libmcrypt-2.5.8-9.el6.x86_64.rpm                  |  96 kB     00:00
(4/9): libwebp-0.4.3-3.el6.x86_64.rpm                    | 210 kB     00:00
(5/9): php-gd-5.6.31-1.el6.remi.x86_64.rpm               |  79 kB     00:00
(6/9): php-mcrypt-5.6.31-1.el6.remi.x86_64.rpm           |  49 kB     00:00
(7/9): php-mysqlnd-5.6.31-1.el6.remi.x86_64.rpm          | 277 kB     00:00
(8/9): php-pdo-5.6.31-1.el6.remi.x86_64.rpm              | 119 kB     00:00
(9/9): t1lib-5.1.2-6.el6_2.1.x86_64.rpm                  | 160 kB     00:00


Total                                           320 kB/s | 1.1 MB     00:03
warning: rpmts_HdrFromFdno: Header V4 DSA/SHA1 Signature, key ID 00f97f56: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
Importing GPG key 0x00F97F56:
Userid : Remi Collet <RPMS@FamilleCollet.com>
Package: remi-release-6.9-1.el6.remi.noarch (installed)
From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-remi
Is this ok [y/N]: y
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOK                                                                                                                                                             EY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Importing GPG key 0x0608B895:
Userid : EPEL (6) <epel@fedoraproject.org>
Package: epel-release-6-8.noarch (installed)
From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : libXpm-3.5.10-2.el6.x86_64                                  1/15
Installing : libmcrypt-2.5.8-9.el6.x86_64                                2/15
Installing : libzip5-1.2.0-1.el6.remi.x86_64                             3/15
Installing : php-pecl-zip-1.15.1-1.el6.remi.5.6.x86_64                   4/15
 
WARNING : These php-* RPMs are not official Fedora / Red Hat build and
overrides the official ones. Don’t file bugs on Fedora Project nor Red Hat.
Use dedicated forum at http://forum.remirepo.net/
Installing : php-common-5.6.31-1.el6.remi.x86_64                         5/15
Installing : php-pecl-jsonc-1.3.10-2.el6.remi.5.6.x86_64                 6/15
Installing : php-cli-5.6.31-1.el6.remi.x86_64                            7/15
Installing : php-pdo-5.6.31-1.el6.remi.x86_64                            8/15
Installing : t1lib-5.1.2-6.el6_2.1.x86_64                                9/15
Installing : libwebp-0.4.3-3.el6.x86_64                                 10/15
Installing : gd-last-2.2.4-1.el6.remi.x86_64                            11/15
Installing : php-gd-5.6.31-1.el6.remi.x86_64                            12/15
Installing : php-mysqlnd-5.6.31-1.el6.remi.x86_64                       13/15
Installing : php-5.6.31-1.el6.remi.x86_64                               14/15
Installing : php-mcrypt-5.6.31-1.el6.remi.x86_64                        15/15
Verifying  : php-pecl-jsonc-1.3.10-2.el6.remi.5.6.x86_64                 1/15
Verifying  : libwebp-0.4.3-3.el6.x86_64                                  2/15
Verifying  : php-pecl-zip-1.15.1-1.el6.remi.5.6.x86_64                   3/15
Verifying  : t1lib-5.1.2-6.el6_2.1.x86_64                                4/15
Verifying  : libXpm-3.5.10-2.el6.x86_64                                  5/15
Verifying  : php-cli-5.6.31-1.el6.remi.x86_64                            6/15
Verifying  : php-mcrypt-5.6.31-1.el6.remi.x86_64                         7/15
Verifying  : php-5.6.31-1.el6.remi.x86_64                                8/15
Verifying  : libzip5-1.2.0-1.el6.remi.x86_64                             9/15
Verifying  : php-common-5.6.31-1.el6.remi.x86_64                        10/15
Verifying  : php-pdo-5.6.31-1.el6.remi.x86_64                           11/15
Verifying  : php-gd-5.6.31-1.el6.remi.x86_64                            12/15
Verifying  : php-mysqlnd-5.6.31-1.el6.remi.x86_64                       13/15
Verifying  : gd-last-2.2.4-1.el6.remi.x86_64                            14/15
Verifying  : libmcrypt-2.5.8-9.el6.x86_64                               15/15
Installed:
php.x86_64 0:5.6.31-1.el6.remi         php-gd.x86_64 0:5.6.31-1.el6.remi
php-mcrypt.x86_64 0:5.6.31-1.el6.remi  php-mysqlnd.x86_64 0:5.6.31-1.el6.remi
Dependency Installed:
gd-last.x86_64 0:2.2.4-1.el6.remi
libXpm.x86_64 0:3.5.10-2.el6
libmcrypt.x86_64 0:2.5.8-9.el6
libwebp.x86_64 0:0.4.3-3.el6
libzip5.x86_64 0:1.2.0-1.el6.remi
php-cli.x86_64 0:5.6.31-1.el6.remi
php-common.x86_64 0:5.6.31-1.el6.remi
php-pdo.x86_64 0:5.6.31-1.el6.remi
php-pecl-jsonc.x86_64 0:1.3.10-2.el6.remi.5.6
php-pecl-zip.x86_64 0:1.15.1-1.el6.remi.5.6
t1lib.x86_64 0:5.1.2-6.el6_2.1
Complete!
Check PHP version:
Php -v
PHP 5.6.31 (cli) (built: Jul  6 2017 08:16:47)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
 
Posted By Nijakat Ali

1 Comment

Leave a Reply

Your email address will not be published.


*