Skip to content

Instantly share code, notes, and snippets.

@koji
Created January 3, 2015 08:00
Show Gist options
  • Save koji/1482469dbaa7df66e3c5 to your computer and use it in GitHub Desktop.
Save koji/1482469dbaa7df66e3c5 to your computer and use it in GitHub Desktop.
Install php 5.4 on CentOS6
If you want to install php5.4, you have to introduce epel and remi to install php5.4.
If you don't have wget, you have to do this, but if you have wget, you don't need this step.
Step1. Install wget
sudo yum install wget -y
Step2. Download epel
https://dl.fedoraproject.org/pub/epel/6/x86_64/
wget https://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
Step3. Download remi
http://rpms.famillecollet.com/
for CentOS6
http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
Step4. Install epel & remi
sudo rpm -U epel-release-6-8.noarch.rpm
sudo rpm -U remi-release-6.rpm
Step5. Edit epel.repo
sudo vi /etc/yum.repos.d/epel.repo
change value of "enabled" 1->0 like below
Before
[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
After
[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
failovermethod=priority
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Step6. Confirmation of php version
yum info --enablerepo=remi php
Step7. Install php
sudo yum --enablerepo=remi install php php-dev php-mysql php-mbstring php-gd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment