how to Install Apache MySQL and PHP on Ubuntu 16.04 and 18.04

how to Install Apache MySQL and PHP on Ubuntu 16.04 and 18.04

Today, In this tutorial, we will explain to you how to Install Apache MySQL and PHP on Ubuntu 16.04 and 18.04. PHP stands for Hypertext Preprocessor and it’s a run based on the server-side, so we have to need the apache server and MySQL database. Let’s start how to install an Apache, MySQL, and php7, php7.2 on Ubuntu 16.04 and 18.04.

If you want to install a particular version wise then you can do. such as php7.0 or php7.2

Overview

Step 1: Install the apache2 server

Step 2: Install and configure MySql server

Step 3: Install PHP

Install Apache, install MySQL, install PHP, install PHP with apache, Install PHP 7 on Ubuntu, install PHP 7.3, 7.2, 7.1 & 7.0 on Ubuntu, Install Apache with PHP 7.0, Install Apache with PHP 7.2

Step 1: Install the apache2 server

In this step, we will install the apache2 server using the below command.

Install the apache2 server

if you want to check Apache2 is installed or no then you can open the browser and type the 127.0.0.1 or localhost to test the installation. if If you see the following screenshot of your browser, it has been successfully installed.
install apache2

If you want to check status or start or restart the apache server then you can do.

Step 2: Install and configure MySql server

Now, we install the MySQL database server using the below command.

When you install MySQL you will be asked to set MySQL password as shown below screenshot.
configure MySql server
If you want to know the server status or you want to start or stop server then you can do using the below command.

Configure MySQL
It is suggested that you run Sudo mysql_secure_installation. This program enables you to improve the security of your MySQL installation by making some security suggestions real.

You will be asked to enter the MySQL root password and some configuration settings.

The Press Y then install password plugin and choose password policy.

Press 2 and “enter” key. Now, You’ll be asked to set a new password

Enter the secret password and hit Enter. When finished with setting the secret password you will be then asked to remove the unknown user and test database and disable remote login as demonstrated as follows.
Press Y for the remove anonymous users and hit enter.

Press Y for the disallow remote login

Press Y for the remove the test database

Press y from the flush privileges.
Now, you can test your MySql login with your username and password. you can use the root password.

Step 3: Install PHP

In this step, we will install the PHP using the below command.

If you want to know that, which version installed of PHP in the current system? then you can use the below command.

Please follow and like us: