Installing LAMP


I have already discussed what is LAMP , so please refer to my earlier post .

For all lazy people ,I am giving the link to the post .

http://kar2905.wordpress.com/2009/01/23/lamp/

In this post , I would be describing the process of installing LAMP on Ubuntu . I currently have Ubuntu 8.1 , apache 2.2 , php 5 .

I am explaining the process in a very simple manner starting from the basics . As being new to this , I know how difficult it is to do anything on Linux . It took me a lot of time to understand fully LAMP and then install it ( thanx to the poor speeds by ION) .

Note : Sentences between quotes are the commands you need to type as it is .

First of all we will be installing apache

1. Open Terminal . ( Applications -> Accessories -> Terminal )

type “sudo get-apt install apache2

2. The terminal will ask for your password , just enter it . ( if it doesnt ask , dont panic there is nothing wrong in it)

Now To test apache

1. open a web browser . Go to a new tab . Type “http://localhost” , press enter .

If everything is all right , it should display “IT WORKS!! ”

Hurray , you have successfully installed apache

Now , we have to install php

1. open a terminal ( same procedure as told above ) .

2. type “sudo apt-get install php5 libapache2-mod-php5= ”

It will take a little time to download ( the time depends upon your net connection)

3. Now , restart apache  , as apache doeesnt know that you have installed php and hence we are restarting it so that it can integrate php into it .

To restart type “sudo /etc/init.d/apache2 restart” into the terminal .

TESTING PHP

1. In the terminal , type “sudo gedit /var/www/testphp.php

This will open a file named testphp.php

2. type this into the file “<?php phpinfo(); ?>” . phpinfo() is a inbuilt php function which finds out the details about apache and phph.test1

3. Save the file .

4. Now , opena browser , type “http://localhost/testphp.php

5. Something like this should open . I am pasting a screenshot of it .

If this comes , then it means your php and apache are working fine . Hurray !!

TIP : If your net connection ( as is the case with me ) , you can always open two terminals thereby working on both of them and saving time .

Now to install MY SQL

1. Open the terminal . Type “sudo apt-get install mysql-server” .

2. We are now going to install a program called phpmyAdmin which is an easy tool to edit your databases. Copy/paste the following line into Terminal:

sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin

After that is installed our next task is to get PHP to work with MySQL. To do this we will need to open a file entitled php.ini. To open it type the following:

gksudo gedit /etc/php5/apache2/php.ini

Now we are going to have to uncomment the following line by taking out the semicolon (;).

Change this line:

;extension=mysql.so

To look like this:

extension=mysql.so

Now just restart Apache and you are all set!

sudo /etc/init.d/apache2 restart” .

Do one more thing ,

Type this in the terminal “sudo ln -s /usr/share/phpmyadmin/ /var/www/phpmyadmin“  .

This actually copies the files to the document root directory i.e www .

# /usr/share/phpmyadmin/ is the directory where phpmyadmin installed
# /var/www/ is your document root directory

Voila , you are all set with LAMP .

Thanks every1 for reading this . It took me a lot of time to write this .

As always , Comments are welcome .

Tags: , , , , , , ,

This entry was posted on Saturday, January 31st, 2009 at 9:59 pm and is filed under Computer. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

3 Responses to “Installing LAMP”

kar2905 February 2nd, 2009 at 4:45 pm

i read it .
But the new mysel doesnt need the password to be set up like the method in the forum .
I myself first installed LAMP and then only wrote the procedure .

Andrea February 22nd, 2009 at 10:16 pm

Thanks dude, well done and it works!

Leave a Reply