There is a new revision of this tutorial available for Ubuntu 15.04 (Vivid Vervet).

Installing Apache2 With PHP5 And MySQL Support On Ubuntu 10.04 (LAMP) - Page 2

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


Share this page:

8 Comment(s)

Add comment


From: Anonymous

Simpler does not always entail safer.

From: Anonymous

Funny! I installed LAMP on my Ubunut netbook using the following command:

$ sudo apt-get install lamp-server^

NOTE: the carat (^) at the end of the lamp-server name is NECESSARY.

LAMP Server installation prompted me to assign a passwd for mysql root account.

I installed phpmyadmin using the following command:

$ sudo apt-get install phpmyadmin

PHPMyAdmin installation prompted me to give it mysql root passwd and then create a phpmyadmin account.

I feel the steps in my note/comment are simpler than the steps outlined in the article. Why would you recommend the steps outlined in your article? Am I missing something?


From: Abe

It is a lot simpler when you use XAMPP

 You get all the following installed in couple easy steps.

 Apache 2.2.14, MySQL 5.1.41, PHP 5.3.1 & PEAR + SQLite 2.8.17/3.6.16 + multibyte (mbstring) support, Perl 5.10.1, ProFTPD 1.3.2c, phpMyAdmin 3.2.4, OpenSSL 0.9.8l, GD 2.0.1, Freetype2 2.1.7, libjpeg 6b, libpng 1.2.12, gdbm 1.8.0, zlib 1.2.3, expat 1.2, Sablotron 1.0, libxml 2.7.6, Ming 0.4.2, Webalizer 2.21-02, pdf class 009e, ncurses 5.3, mod_perl 2.0.4, FreeTDS 0.63, gettext 0.17, IMAP C-Client 2007e, OpenLDAP (client) 2.3.11, mcrypt 2.5.7, mhash 0.8.18, eAccelerator, cURL 7.19.6, libxslt 1.1.26, libapreq 2.12, FPDF 1.6, XAMPP Control Panel 0.8, bzip 1.0.5, PBXT 1.0.09-rc, PBMS 0.5.08-alpha, ICU4C Library 4.2.1 

From: Anonymous

Funny! to the 1st poster why not just type tasksel and select LAMP

From: Anonymous

hun ? and get hacked :|

From: Anonymous

i've followed the steps and it works perfectly when i am connected to the internet, but when i am offline it doesn't work. could anyone help me solve this problem.

From: Marcio Mariano

Great job man !!!

A long time i search a good information and now i founddddddddd !!!

sorry for my bad english


From: Daniel Malaquias

Great Job from Brazil man