How to install php 5.6 on CentOS 7 with php-fpm nginx and mariadb with vsftpd
Oct 09 2015

2  20K+ {{}}
Today I'm going to show you, how real quick to install PHP 5.6 on CentOS 7 with MariaDB and php-fpm as FastCGI handler, with nginx.

First update current packages.
sudo yum update

sudo yum groupinstall "Development tools"

Then check if you are on CentOS 7
cat /etc/*-release

If this shows some other version then 7.0, you might want to search for another tutorial.
Now install epel-release, if you don't have one.
sudo yum install epel-release

If that fails, use this repo
wget && sudo rpm -Uvh epel-release-7*.rpm

IUS repo is required for php 5.6
wget && sudo rpm -Uvh ius-release.rpm

Update packages
sudo yum update

Now install nginx, php 5.6, its extensions and php-fpm as FastCGI handler, and MariaDB instead of MySQL.
sudo yum install nginx php56u php56u-devel php56u-fpm php56u-gd php56u-mbstring php56u-mcrypt php56u-mysql php56u-pdo php56u-opcache php56u-pear php56u-xml php56u-xmlrpc php56u-memcached mariadb mariadb-server mariadb-client vsftpd

Also if you want ability to send emails, with postfix or to act as a relay, with ssl, install these dependencies
yum install postfix cyrus-sasl cyrus-sasl-plain cyrus-sasl-md5 cyrus-imapd postfix cyrus-sasl cyrus-sasl-plain cyrus-sasl-md5 cyrus-imapd openssl openssl-devel

Now configure MariaDB, therefore run this:

Install memcached
sudo yum install memcached

Start them all
sudo service start nginx && sudo service start mariadb && sudo service start php-fpm && sudo service start memcached && sudo service start postfix

Add them, so they start on reboot:
systemctl enable nginx

systemctl enable php-fpm

systemctl enable mariadb

systemctl enable vsftpd

systemctl enable memcached

systemctl enable postfix

Make sure none of rules are blocking you to access your page.
You can just flush them all
sudo service iptables stop

That's it, you should be able to access or replace it with your IP/hostname.

I'll describe in next tutorial, how to setup and configure properly nginx.conf virtual dirs, www.conf (php-fpm) (postfix) my.cnf (MariaDB) and vsftpd.

If this tutorial was helpful, or you have any issues comment below.
it's not working in my case.
bcab    Sep 16 2019
Hello bcab,

what exactly is not working?
Staff StephenS    Nov 23 2019

Please Login or Sign Up to leave a reply.