Basic LAMP (Linux, Apache, MySQL, PHP) installation on a Linux Server

I will assume you have a base system with Ubuntu 13.04 installed and updated.

1. Install Apache2.

sudo apt-get install apache2

[To verify] Direct a browser to the ip address of your server and you should see the placeholder page.

2. Install PHP5.

sudo apt-get install php5 libapache2-mod-php5

Restart Apache after PHP5 installation is completed.

sudo service apache2 restart

[To verify] Create a file named info.php with the following code.

<?php
phpinfo();
?>

Place the file in the directory /var/www/html
Display the file in a browser by going to youripaddress/info.php

You should see something similiar to the following.


3. Install MySQL5.

sudo apt-get install mysql-server mysql-client

4. MySQL support in PHP5

Too see the various PHP5 modules available.

apt-cache search php5

Pick the ones you desire and install them.

(php5-mysqlnd is the native MySQL driver)

apt-get install {module}

Restart Apache.

sudo service apache2 restart