Install, Apache, MySQL, PHP (LAMP) stack on Ubuntu

Step One — Install Apache
open terminal and type in these commands:

How to Find your Server’s IP address
You can run the following command to reveal your server’s IP address.

Step Two — Install MySQL
open terminal and type in these commands:

During the installation, MySQL will ask you to set a root password. If you miss the chance to set the password while the program is installing, it is very easy to set the password later from within the MySQL shell.
Once you have installed MySQL, we should activate it with this command:

Finish up by running the MySQL set up script:

Step Three — Install PHP
open terminal and type in this command.

After you answer yes to the prompt twice, PHP will install itself.
It may also be useful to add php to the directory index, to serve the relevant php index files:

Add index.php to the beginning of index files. The page should now look like this:

PHP Modules

Once you decide to install the module, type:

Step Four—RESULTS: See PHP on your Server
To set this up, first create a new file:

Add in the following line:

Then Save and Exit.

Restart apache so that all of the changes take effect: