How to install PHP 5.6 on CentOS 6.10

Published on Author JFLeave a comment

I just did a fresh install of CentOS 6.10 today and needed to install PHP. It had been a while, so I needed a refresher.

Note: PHP 5.6 is pretty much End Of Life, so you should be installing PHP 7.2, or higher at this point in time. That said, sometimes you have to support older systems.

Add some necessary repos:

rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
cd /etc/yum.repos.d
curl -O http://rpms.famillecollet.com/enterprise/remi.repo

Edit rum.repos.d (i prefer nano)

nano /etc/yum.repos.d/remi.repo

The only default repo will be [remi-safe]. Make sure this is enabled.

enabled=1

Then set the [remi-php56] to enabled =1. Default is 0. Make sure to save and close.

You will need to install the latest version of libzip.

yum install -y libzip5

Then install your different php needs. Here’s an example:

yum install -y php php-cli php-common php-gd php-gmp php-mbstring php-mysqlnd php-pdo php-pear.noarch php-pecl-jsonc php-process php-xml runtime php php-devel more-php-mcrypt

Tip:

Instead of editing yum.repos.d you can use a switch like thus:

yum install -y php --enablerepo=remi-php56

Job done.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.