Installing php 7.1, php7-fpm and MariaDB 10.x on CentOS 7: Hello good people.  Today let’s look at how to install php 7.1 and MariaDB 10.x on CentOS 7 operating system.

The MariaDB database server is published as free and open source software under the General Public License version 2. MariaDB is a MySQL fork of the original MySQL developer Monty Widenius. MariaDB is compatible with MySQL.

The PHP version that ships with CentOS is quite old (PHP 5.4), therefore I will show you in this step how to get latest version of php.

Before installing php 7.1 and MariaDB 10 on CentOS 7, you’ll first need to add required repositories. Here is how.

Add epel repo:

Extra Packages for Enterprise Linux (or EPEL) is a Fedora Special Interest Group that creates, maintains, and manages a high quality set of additional packages for Enterprise Linux, including, but not limited to, Red Hat Enterprise Linux (RHEL), CentOS and Scientific Linux (SL), Oracle Linux (OL).

Use the command below to add epel repos on CentOS 7.x.

rpm -Uvh

Add webtatic repo which provides php 7.x packages:

rpm -Uvh

Add MariaDB repo:

vim /etc/yum.repos.d/mariadb.repo


# MariaDB 10.2 CentOS repository 
name = MariaDB
baseurl =

Update yum cache:

yum clean all
yum makecache fast
Install php 7.1 packages
yum -y install php71w-cli.x86_64 \
php71w-common.x86_64 \
php71w-fpm.x86_64 \
php71w-gd.x86_64 \
php71w-mbstring.x86_64 \
php71w-mcrypt.x86_64 \
php71w-mysql.x86_64 \
php71w-odbc.x86_64 \
php71w-pdo.x86_64 \
php71w-xml.x86_64 \
mod_php71w \
Install MariaDB 10.2
sudo yum -y install MariaDB-server MariaDB-client
To start mariadb service, use:
sudo systemctl start mariadb
sudo systemctl enable mariadb
To start php fpm, use:
systemctl start php-fpm.service

You should now be enjoying latest version of php and MariaDB on CentOS 7.x machine. If you have any issues with the setup, let me know by dropping a comment.

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!

As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.


Please enter your comment!
Please enter your name here