MariaDB turns data into structured information in a wide array of applications, ranging from banking to websites. It is an enhanced, drop-in replacement for MySQL. MariaDB is used because it is fast, scalable and robust, with a rich ecosystem of storage engines, plugins and many other tools make it very versatile for a wide variety of use cases.
PHP is a popular general-purpose scripting language that is especially suited to web development.
Fast, flexible and pragmatic, PHP powers everything from your blog to the most popular websites in the world.
This tutorial will explain how to install MariaDB with PHP 7 support in Ubuntu 16.04 server
Install MariaDB server in ubuntu 16.04
From the command line run the following command
sudo apt-get -y install mariadb-server mariadb-client
set a root password for MariaDB using the following command
This will prompt the following questions
Enter current password for root (enter for none): <-- press enter Set root password? [Y/n] <-- y New password: <-- Enter the new MariaDB root password here Re-enter new password: <-- Repeat the password Remove anonymous users? [Y/n] <-- y Disallow root login remotely? [Y/n] <-- y Reload privilege tables now? [Y/n] <-- y Test the login to MariaDB with the "mysql command"
mysql -u root -p
Install php7 in ubuntu 16.04 server
Run the following commands in ubuntu 16.04 server command prompt this will install mariaDB supported module for php7
sudo apt-get -y install php7.0 php7.0-mysql
If you want some other modules for php7 you can use the following command to search
sudo apt-cache search php7.0
Now you need to restart apache2 server using the following command
sudo systemctl restart apache2
Test PHP installation
We need to create test.php file under /var/www/html
sudo vi /var/www/html/test.php
add the following code and save the file
Change the owner of the file test.php to the www-data user and group
sudo chown www-data:www-data /var/www/html/test.php
Now go to http://serverip/test.php and you should see similar to the following screen here you can see php7 is enabled for Mysql.