Installing Apache2 With PHP5 And MySQL Support On Ubuntu 10.10 (LAMP)

Want to support HowtoForge? Become a subscriber!
Submitted by falko (Contact Author) (Forums) on Sun, 2010-10-31 20:37. :: Ubuntu | Web Server | Apache | MySQL | PHP

Installing Apache2 With PHP5 And MySQL Support On Ubuntu 10.10 (LAMP)

Version 1.0
Author: Falko Timme <ft [at] falkotimme [dot] com>
Follow me on Twitter
Last edited 10/19/2010

LAMP is short for Linux, Apache, MySQL, PHP. This tutorial shows how you can install an Apache2 webserver on an Ubuntu 10.10 server with PHP5 support (mod_php) and MySQL support.

I do not issue any guarantee that this will work for you!


1 Preliminary Note

In this tutorial I use the hostname with the IP address These settings might differ for you, so you have to replace them where appropriate.

I'm running all the steps in this tutorial with root privileges, so make sure you're logged in as root:

sudo su


2 Installing MySQL 5

First we install MySQL 5 like this:

aptitude install mysql-server mysql-client

You will be asked to provide a password for the MySQL root user - this password is valid for the user root@localhost as well as, so we don't have to specify a MySQL root password manually later on:

New password for the MySQL "root" user: <-- yourrootsqlpassword
Repeat password for the MySQL "root" user: <-- yourrootsqlpassword


3 Installing Apache2

Apache2 is available as an Ubuntu package, therefore we can install it like this:

aptitude install apache2

Now direct your browser to, and you should see the Apache2 placeholder page (It works!):

Apache's default document root is /var/www on Ubuntu, and the configuration file is /etc/apache2/apache2.conf. Additional configurations are stored in subdirectories of the /etc/apache2 directory such as /etc/apache2/mods-enabled (for Apache modules), /etc/apache2/sites-enabled (for virtual hosts), and /etc/apache2/conf.d.


4 Installing PHP5

We can install PHP5 and the Apache PHP5 module as follows:

aptitude install php5 libapache2-mod-php5

We must restart Apache afterwards:

/etc/init.d/apache2 restart


5 Testing PHP5 / Getting Details About Your PHP5 Installation

The document root of the default web site is /var/www. We will now create a small PHP file (info.php) in that directory and call it in a browser. The file will display lots of useful details about our PHP installation, such as the installed PHP version.

vi /var/www/info.php


Now we call that file in a browser (e.g.

As you see, PHP5 is working, and it's working through the Apache 2.0 Handler, as shown in the Server API line. If you scroll further down, you will see all modules that are already enabled in PHP5. MySQL is not listed there which means we don't have MySQL support in PHP5 yet.


6 Getting MySQL Support In PHP5

To get MySQL support in PHP, we can install the php5-mysql package. It's a good idea to install some other PHP5 modules as well as you might need them for your applications. You can search for available PHP5 modules like this:

aptitude search php5

Pick the ones you need and install them like this:

aptitude install php5-mysql php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-mhash php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl php5-json

Now restart Apache2:

/etc/init.d/apache2 restart

Now reload in your browser and scroll down to the modules section again. You should now find lots of new modules there, including the MySQL module:


7 phpMyAdmin

phpMyAdmin is a web interface through which you can manage your MySQL databases. It's a good idea to install it:

aptitude install phpmyadmin

You will see the following questions:

Web server to reconfigure automatically: <-- apache2
Configure database for phpmyadmin with dbconfig-common? <-- No

Afterwards, you can access phpMyAdmin under


8 Links

Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by Anonymous (not registered) on Mon, 2014-04-21 19:31.
Thank you! Very helpful
Submitted by Anonymous (not registered) on Sat, 2014-02-01 06:59.

tnx tnx tnx very very tnx tnx tnxtnx tnx tnxtnx tnx tnx its best & very good article tnx

Submitted by Makarand (not registered) on Fri, 2012-07-13 04:55.

Hello, I have setup the ubuntu server, and the server Ip shows the default webpage.

I have pointed a sub domain to this IP address, but it is not showing the webpage.

 What would be the issue?

Submitted by Gurpreet (not registered) on Sat, 2012-02-18 11:57.
Great document... well done.
Submitted by Anonymous (not registered) on Fri, 2011-12-23 10:40.
Thank you much, very easy to do, runs great!
Submitted by Robert Craig (not registered) on Sun, 2011-10-23 06:37.

Thank you very much.

This worked wonderfully.  I only bumped into 1 error where I could not pull up phpmyadmin on Ubuntu Server 11.10.  I ran the following command to properly pull up the page:

sudo ln -s /usr/share/phpmyadmin /var/www

Submitted by Anonymous (not registered) on Thu, 2012-11-01 22:21.
that fixed mine too thx :O
Submitted by Kalin Mandaliev (not registered) on Thu, 2011-10-13 10:38.
Bravo !!! Very Nice Falko :)
Submitted by Talat (not registered) on Tue, 2011-07-12 09:31.

Very good guide, I followed step by step every think worked well.

Now I'll be looking for installation Joomla

Submitted by XepC (not registered) on Wed, 2011-06-15 15:59.

Thank you for this huge explanation (Ctrl+D). :-)

Anyway I have to type http://localhost/info.php instead of (cause 192... it just doesn't work).

Submitted by Alex (not registered) on Sun, 2011-10-09 11:00.

"In this tutorial I use the hostname with the IP address These settings might differ for you, so you have to replace them where appropriate."

Probably, you have different IP. run ifconfig and look somewhere eth0.

Submitted by Danyel Lawson (not registered) on Sat, 2011-06-11 13:59.
Not to be a pest but LAMP has a more expansive meaning than just Linux Apache MySQL PHP. In fact the P in LAMP originally only stood for Perl and Python back in the CGI and mod_perl and mod_python as the superior Internet scripting solutions days. It can be a little weird to hear people say LAMP and know that they are only talking about PHP. The L can stand for almost any posix operating system like Linux SunOS FreeBSD OSX etc The A can stand for Apache Nginx Lighttpd etc The M can stand for MySQL PostgreSQL etc The P can stand for Perl PHP Python etc Sometimes the definition is extended even further with the WAMP one click installs.
Submitted by rahul chaubisa (not registered) on Tue, 2011-05-31 19:48.
This tutorial help me a lot in installation
Submitted by Marcelly (not registered) on Thu, 2011-05-12 16:58.

Hello Falko!

Thank you so much for this tutorial!

It helped me a lot!

Great Work!

Submitted by Russ (not registered) on Tue, 2011-04-12 02:57.

Thanks for the help!  I have been trying to connect a PSP script to a MySQL SB on my new server and thanks to this tutorial realized I didn't have the most up to date php5-mysql installed on my system!  

 Thanks again!

Submitted by Dennis (not registered) on Fri, 2011-04-01 19:08.
Very good tutorial. I've got the whole thing working on Ubuntu 10.10. Thanks
Submitted by Steph (not registered) on Wed, 2011-03-30 22:53.
Thank you.  That was a superb tutorial.  Very clear and concise.  Got my LAMP up and running perfectly.
Submitted by Ferey (not registered) on Fri, 2011-03-25 20:58.

first, i say if that is good tutorial, i've done it and it, i have trouble on phpmyadmin, and i tried to resolve it from some sources, and i done everything but don't works.the trouble is in the bottom of says :"The additional features for working with linked tables have been deactivated. To find out why click here." so, how can i fix it. Sorry if my english so bad, because i'm from indonesia.Thanks for the nice tutorial....

Submitted by Anonymous (not registered) on Wed, 2011-03-23 18:05. to view the placeholder page if at first you don't succeed.
Submitted by Anonymous (not registered) on Sun, 2011-10-09 11:02.
It is not
Submitted by Deepak More (not registered) on Mon, 2011-03-14 13:03.

i am deepak more from india 

the documentaion ais step by step and i have used as per instructed it work fine

thanks you

Submitted by ifeelcash (not registered) on Mon, 2011-02-28 19:27.

Easy just work in me VPS !

I used in me VPS ubuntu 10.10 in installation not checked any from that server packgates !

Me normal user of ubuntu not noob not expert but that easy maked in 5 minits ! 

Submitted by Anonymous (not registered) on Fri, 2011-02-18 19:56.

Thanks for a great tutorial i have used this as a lazy way to install a development server for some time now.

 There is however one thing i feel it could use and that is to add ruby/ror and to state how to make it purely a dev server.

Submitted by kusnan hadinata (not registered) on Sun, 2011-02-06 14:26.
thank you for the tutorial. that's all very usefull
Submitted by Guidobert (not registered) on Tue, 2011-02-01 15:14.
very well boys ........on Ubuntu 10.10 I do it all using just "synaptic", instaling mysql-server, apache2, php5, php5-mysql, phpmyadmin ..... thanks a lot ....
Submitted by Anonymous (not registered) on Sat, 2011-01-08 18:59.
 Great article. Many Thanks
Submitted by Anonymous (not registered) on Tue, 2010-12-14 12:10.
can i use this guide on desktop edition?
Submitted by webonzio (not registered) on Sun, 2010-11-28 08:38.

This is a very nice tutorial and it works great for me but some things are missing.

 if phpmyadmin doesn't work. use

 sudo ln -s /usr/share/phpmyadmin /var/www/

 and if you can access to the /var/www to copy info.php use:

 cd /var

sudo chmod 777 www

 that's all. Thank it really helps me.

 and sorry for me english. is not my native language.



Submitted by progone (registered user) on Tue, 2011-01-04 20:22.

sudo chmod 777 www is very unsecured. Basically you will be giving out permissions to the entire universe.  Try a different command.

 chmod 777 defined as: 

chmod 777 file change the permissions of the file file to read, write, and execute for all.

 *notice  write, and execute for all are in bold.

Submitted by Anonymous (not registered) on Thu, 2011-05-19 14:59.

 This should do the trick:

sudo chown -R username /var/www
sudo chmod -R 755 /var/www

 Replace username to the username you'd like to give permission to. To add multiple users to chown:

sudo chown -R username1:username2:username3 /var/www


Submitted by Peltanus (not registered) on Mon, 2011-01-03 20:42.
Thanks for this tip, I couldn't find a solution for this problem
Submitted by Agung (not registered) on Sun, 2010-11-14 12:49.
How to install joomla on ubuntu server 9.10 everyone can tell me step by step how to install it, thank's
Submitted by Dante Lopez (not registered) on Fri, 2010-11-12 02:17.

Great tutorial you have there.

 I did follow your tutorial, but it seems that whenever I run "http://localhost/phpmyadmin" on my browser, it's now working. The installation went fine, do you have any idea how can I fix this?

Huge thanks. 

Submitted by suman (not registered) on Sat, 2010-11-13 20:44.

see this. It worked fine for me

Submitted by Knightlie (not registered) on Sat, 2010-11-13 19:07.

You may need to add an Alias and <Directory> section to /etc/apache2/sites-enabled/000-default to get phpmyadmin working, that's what I did.

 This is a great tutorial, worked first time, thanks.

Submitted by William (not registered) on Sun, 2010-11-07 22:30.


 Thank you very much, it helped me a lot ;)


Best Regards

Submitted by nganjukonline (not registered) on Wed, 2010-11-03 15:02.
could these all applications running automatically when i turn on my ubuntu ??
Submitted by Anonymous (not registered) on Wed, 2010-11-03 10:27.

sudo apt-get install lamp-server^

Submitted by Anonymous (not registered) on Mon, 2010-11-01 17:53.
Great tutorial. I'm a newbie to Linux and am trying to get rid of my windows servers. This is a great first step for to learning. Worked the first time. Thank you.
Submitted by palhmbs (not registered) on Tue, 2010-11-02 10:34.

I have created a basic control panel to help non-commandline users to easily access their LAMP settings -- See the details here....