How to install apache, php, mysql and phpmyadmin in Ubuntu
Recommended Ubuntu book
Installing LAMP (Linux, Apache, Mysql, Php) in Ubuntu is pretty easy. Follow the following steps.
Open the terminal window and type:
sudo apt-get install apache2
This would install apache, which you could test by typing http://localhost/ in the browser. It will give you a successful message if it works.
sudo apt-get install php5 libapache2-mod-php5
This would install the latest stable version of php5 and apache mod. Now lets create a sample php file to see if it works:
sudo gedit /var/www/phpinfo.php
Once the new gedit window opens, type:
<?php phpinfo(); ?>
Save the file and restart apache for php to kick in:
sudo /etc/init.d/apache2 restart
Now go to http://localhost/phpinfo.php in the browser and it should show all the php settings.
We still need mysql, these commands will install it:
sudo apt-get install mysql-server
Next, we need apache mode, php5-mysql and phpmyadmin (if you want, it gets pretty handy):
sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin
Next, enable mysql in for php by editing php.ini file:
sudo gedit /etc/php5/apache2/php.ini
and uncomment the line
;extension=msql.so
by removing ‘;’ symbol in the beginning. Save the file and restart apache again:
sudo /etc/init.d/apache2 restart
Now navigate to http://localhost/phpmyadmin in your browser to start setting up the databases.
That’s it.
August 26th, 2011 03:24
[…] How To Use Ubuntu, Starting From Lucid Lynx « How to install apache, php, mysql and phpmyadmin in Ubuntu […]
November 16th, 2011 11:45
Nice tutorial…. thanks !!!
July 11th, 2012 11:59
you forgot to add this
To set up under Apache all you need to do is include the following line in /etc/apache2/apache2.conf.
Include /etc/phpmyadmin/apache.conf
September 26th, 2012 01:04
@edgs Thanks, mine worked as is, but this step may be required in some cases.