How to Install Apache,MySQL and PHP

In this tutorial, we will see how to prepare ubuntu for PHP development.

step 1

Install apache2 package

 main@work:~# sudo apt install apache2

step 2

Install mysql-server package

 main@work:~# sudo apt install mysql-server

You will be asked to set a password for mysql user root - the mysql administrator.

step 3

Install php package and libapache2-mod-php package (apache2 module for php).

 main@work:~# sudo apt install php libapache2-mod-php

step 4

Install php extensions packages: php-mysql , php-dom , php-zip

 main@work:~# sudo apt install php-mysql php-dom php-zip

step 5

Since Composer is the defacto dependency management tool for PHP and have gain popularity with PHP developers, we will install it.

 main@work:~# sudo apt install composer