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 https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Add webtatic repo which provides php 7.x packages:
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
Add MariaDB repo:
# MariaDB 10.2 CentOS repository # http://downloads.mariadb.org/mariadb/repositories/ [mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.2/centos7-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1
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 \ php71w-opcache
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.