Skip to content

Instantly share code, notes, and snippets.

@ayonliu
Last active February 3, 2023 22:56
Show Gist options
  • Star 13 You must be signed in to star a gist
  • Fork 9 You must be signed in to fork a gist
  • Save ayonliu/19a0bfe91f5d1fc7dec00eebc13b3314 to your computer and use it in GitHub Desktop.
Save ayonliu/19a0bfe91f5d1fc7dec00eebc13b3314 to your computer and use it in GitHub Desktop.
Install php5.6 on Centos 7

Install php5.6 on Centos 7

Remi's RPM repository - Configuration wizard, PHP on CentOS 7 (PHP-FPM)

Command to install the Remi repository configuration package:

yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm

Command to install the yum-utils package (for the yum-config-manager command):

yum install yum-utils

The php56 collection is available in the remi-safe repository

Command to install:

yum install php56

Command to install additional packages:

yum install php56-php-xxx

yum install php56-php-mbstring php56-php-memcache php56-php-redis  php56-php-mysqli php56-php-pdo

Command to check the installed version and available extensions:

php56 --version

php56 --modules

Enable php-fpm:

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

Find [remi] and [remi-php56] block, enable this repository, you have to change enabled=0 into enabled=1, after the change the blocks look like this:

[remi]
name=Remi’s RPM repository for Enterprise Linux 7 – $basearch
#baseurl=http://rpms.remirepo.net/enterprise/7/remi/$basearch/
mirrorlist=http://rpms.remirepo.net/enterprise/7/remi/mirror
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
…
[remi-php56]
name=Remi’s PHP 5.6 RPM repository for Enterprise Linux 7 – $basearch
#baseurl=http://rpms.remirepo.net/enterprise/7/php56/$basearch/
mirrorlist=http://rpms.remirepo.net/enterprise/7/php56/mirror
# WARNING: If you enable this repository, you must also enable “remi”
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

Save the file. You are now ready to install PHP-FPM

yum install php-fpm

To ensure it also starts automatically with the server, run the following command:

systemctl enable php-fpm

Running:

systemctl start php-fpm

@Sarfroz
Copy link

Sarfroz commented Feb 1, 2018

instead of editing remi.rpo file we can also use :
yum-config-manager --enable remi-php56

@Pranay-IOS
Copy link

Pranay-IOS commented May 5, 2021

Hi i am new to this, after doing all this php pages are still not running.
When I try to open my website it is showing
run();

Do I need to enable php extension somewhere?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment