How to install Apache, PHP, MySQL and phpMyAdmin on Ubuntu 12.04


LAMP is brief for UNIX system, Apache, MySQL, PHP. This tutorial shows however you'll be able to install associate Apache2 webserver on associate Ubuntu eleven.04 server with PHP5 support (mod_php) and MySQL support.
I don't issue any guarantee that this can work for you!

1 Preliminary Note
In this tutorial i exploit the hostname server1.example.com with the informatics address 192.168.0.100. These settings may disagree for you, therefore you have got to switch them wherever acceptable.

I'm running all the steps during this tutorial with root privileges, therefore check that you are logged in as root:
sudo su

2 putting in MySQL five
First we tend to install MySQL five like this:

sudo apt-get install mysql-server mysql-client

You will be asked to produce a word for the MySQL root user - this word is valid for the user root@localhost likewise as root@server1.example.com, therefore we do not ought to specify a MySQL root word manually later on:

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

3 putting in Apache2
Apache2 is on the market as associate Ubuntu package, thus we will install it like this:
sudo apt-get install apache2

Now direct your browser to http://192.168.0.100, and you ought to see the Apache2 placeholder page (It works!):


Apache's default document root is /var/www on Ubuntu, and therefore the configuration file is /etc/apache2/apache2.conf. extra configurations ar keep in subdirectories of the /etc/apache2 directory like /etc/apache2/mods-enabled (for Apache modules), /etc/apache2/sites-enabled (for virtual hosts), and /etc/apache2/conf.d.

4 putting in PHP5
We can install PHP5 and therefore the Apache PHP5 module as follows:
sudo apt-get install php5 libapache2-mod-php5

We should restart Apache afterwards:
sudo /etc/init.d/apache2 restart

5 Testing PHP5 / obtaining Details regarding Your PHP5 Installation
The document root of the default information processing system is /var/www. we'll currently produce atiny low PHP file (info.php) therein directory and decision it during a browser. The file can show countless helpful details regarding our PHP installation, like the put in PHP version.

sudo vi /var/www/info.php

<?php
phpinfo();
?>
Now we tend to decision that go in a browser (e.g. http://192.168.0.100/info.php):




As you see, PHP5 is functioning, and it's operating through the Apache a pair of.0 Handler, as shown within the Server API line. If you scroll additional down, you'll see all modules that ar already enabled in PHP5. MySQL isn't listed there which implies we do not have MySQL support in PHP5 nevertheless.


6 obtaining MySQL Support In PHP5
To get MySQL support in PHP, we will install the php5-mysql package. it is a sensible plan to put in another PHP5 modules likewise as you would possibly would like them for your applications. you'll be able to explore for on the market PHP5 modules like this:
sudo apt-cache search php5

Pick those you wish and install them like this:
sudo apt-get install php5-mysql php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl

Now restart Apache2:
sudo /etc/init.d/apache2 restart

Now reload http://192.168.0.100/info.php in your browser and scroll right down to the modules section once more. you ought to currently realize countless new modules there, together with the MySQL module:



7 phpMyAdmin
phpMyAdmin may be a net interface through that you'll be able to manage your MySQL databases. it is a sensible plan to put in it:
sudo apt-get install phpmyadmin

You will see the subsequent questions:

Web server to reconfigure automatically: &lt;-- apache2
Configure info for phpmyadmin with dbconfig-common? &lt;-- No

Afterwards, you'll be able to access phpMyAdmin underneath http://192.168.0.100/phpmyadmin/:


1 comments: