September 13, 2016

How to Install PHP 5.4, 5.5 or 5.6 on CentOS 6 and CentOS 7



Repo Installation
SSH connection to your server and run the following commands 
For CentOS 7 (including EPEL install)



#wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
#wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
#rpm -Uvh remi-release-7*.rpm epel-release-7*.rpm
If you already have EPEL installed:


#rpm -Uvh remi-release-7*.rpm
For CentOS 6 (including EPEL install)



#rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
If you already have EPEL installed:


#rpm -Uvh remi-release-6*.rpm
Enabling the Repo
# vi /etc/yum.repos.d/remi.repo.
We need to make sure that the first section [remi] is enabled:







[remi]
name=Les RPM de remi pour Enterprise Linux 6 - $basearch
enabled=1
gpgcheck=1
If we want PHP 5.5 or PHP 5.6 we need to do a bit more work, further down in the repo.repo file you will see two additional sections [remi-php55] and [remi-php56], decide which PHP version you want to install and then enable the correct. So for PHP 5.6 we would change to:








[remi-php56]
name=Les RPM de remi de PHP 5.6 pour Enterprise Linux 6 - $basearch
# WARNING: If you enable this repository, you must also enable "remi"
enabled=1
gpgcheck=1
Once you made your changes save your modified file and quit your editor.
Installing PHP



#sudo yum -y install httpd mysql mysql-server mysql-devel php php-mysql php-fpm
#service httpd restart
#php-v


Enjoyed!

0 comments:

Post a Comment