Installing Linux Apache MySQL and PHP, as what LAMP stands for, is described here. Since We've mentioned that we're installing it on Ubuntu 10.04 which is a linux, we're done with the first part. We will thus install Apache MySQL and PHP here.
Open the Terminal and type the following.
Now it prompts for your password. Enter and press Return. Apache will be installed.sudo apt-get install apache2
Open any web browser and type the following in the address bar.
It should open up the test page which must say - "It Works!". If you aren't getting that, then something's wrong and repeat the installation procedure again.http://localhost/
Open up the Terminal again (Applications -> Accessories -> Terminal) and type the following line (or just copy-paste this).
php5 is your PHP engine and libapache2-mod-php5 is a library file that enables apache to recognize php scripts.sudo apt-get install php5 libapache2-mod-php5
In order to test PHP you should write a PHP script in the /var/www/ directory. Here's a quick guide to write and run a php script.
Open up a Terminal again and type the following.
A editor opens up. Copy paste the following simple program.sudo gedit /var/www/phptest.php
It should open up the php information sheet which is something like this.<?php phpinfo(); ?>
If you can see this then you're done with Apache and PHP installation.
Installing MySQL is little troublesome and may go awry. The following guide is pretty perfect and if anything goes wrong and doesn't act the way it is supposed to be then just comment here and I can help you out.
Open up the Terminal and type the following :
This should install the mysql-server.sudo apt-get install mysql-server
At the end of the installation it asks you to set a password for the mysql running on your local system. Set it.
Now you can open MySQL in command line by typing the following in the command line (terminal).
It requests your mysql password now. Enter and press return to enter the mysql prompt. If you can see the mysql prompt then you've successfully installed mysql.mysql -u root -p
phpMyAdmin is a GUI to the MYSQL and can be used for easy creation of databases. To install phpMyAdmin Copy/Paste the following in the terminal.
Now the last thing is to get your PHP working with MySQL and for that you've to edit a file called php.ini. Here's how.sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin
Open the terminal and type the following.
A file in an editor opens. Search for this linegksudo gedit /etc/php5/apache2/php.ini
And edit it to this;extension=mysql.so
(we've only removed the semi colon). Save and Exit.extension=mysql.so
Now restart apache
That is it. LAMP is set up on your Ubuntu Linux Machine. :)sudo /etc/init.d/apache2 restart
PS: If you find any problems anywhere in this guide then please comment on the post. I will be glad to help.