Friday 21 February 2014

Installing LAMP (Linux, Apache, MySQL and PHP) On Linux

I'm running XLinux on my laptop and need to install webserver with php and MySQL, LAMP. (Linux, Apache, MySQL, PHP). Really thats a simple task, and I'm going do demostrate how

Step one, Install Apache

Open your terminal CTRL+ALT+T and enter following line.
sudo apt-get install apache2
Test Apache using this address in browser http://localhost/ and you will see a message saying:
It works!
This is the default web page for this server.
The web server software is running but no content has been added, yet.

Step two, install PHP

sudo apt-get install php5 libapache2-mod-php5
Restart Apache
sudo /etc/init.d/apache2 restart
Now we can test php by adding to the terminal
sudo gedit /var/www/test.php
This will open up a file called test.php
Add following line
<?php
phpinfo();
?>
Open http://localhost/test.php in browser, you should see info about your php

Step three, install MySQL

Open the Terminal and then copy/paste or type this line
sudo apt-get install mysql-server
And it's done. You can now access your MySQL server like this
mysql -u root -p
--cheers