Today, In this tutorial, we will explain to you how to install an Apache, MySQL, and php7, php7.2 on an Ubuntu 18.04. PHP stands for Hypertext Preprocessor and it’s a run based on 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 an Ubuntu 18.04.

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

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

Install Apache with PHP 7.0

Here, we install the apache server with PHP 7.0 version using the below command.

sudo apt-get -y install php7.0 libapache2-mod-php7.0

Install Apache with PHP 7.2

Here, we install the apache server with PHP 7.2 version using the below command.

sudo apt-get -y install php7.2 libapache2-mod-php7.2

Restart and start the Apache :

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

sudo systemctl start apache2.service
sudo systemctl restart apache2

Install Mysql

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

sudo apt install 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.

sudo service mysql status
sudo service mysql stop
sudo service mysql start