Install Mysql with PHP 7 support in Ubuntu 16.04 server

Sponsored Link
MySQL is a widely used and fast SQL database server. It is a client/server implementation that consists of a server daemon (mysqld) and many different client programs/libraries.

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 Mysql with PHP 7 support in Ubuntu 16.04 server

Install Mysql server in ubuntu 16.04

From the command line run the following command

sudo apt-get install mysql-server mysql-client

You will be asked to provide a password for the Mysql root user

New password for the MySQL "root" user:
Repeat password for the MySQL "root" user:

Install php7 in ubuntu 16.04 server

Run the following commands in ubuntu 16.04 server command prompt this will install mysql 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

<?php
phpinfo();
? >

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.

1

Sponsored Link

Related posts

2 thoughts on “Install Mysql with PHP 7 support in Ubuntu 16.04 server

  1. Would recommend that you use MariaDB instead of MySQL, as you will know what changes has been made in MariaDB while Oracle don’t share that information about the changes in MySQL.

Leave a comment

Your email address will not be published. Required fields are marked *