Install Apache2 With PHP5 And MySQL on Ubuntu/Linux to setup Lamp
Install Apache2 With PHP5 And MySQL on Ubuntu/Linux to setup Lamp
Linux Apache MySQL & PHP is the abbreviated form of LAMP. It is similar to WAMP, XAMP etc. We use LAMP/WAMP/XAMP to make the our PC as a local server.To Setup LAMP on UBUNTU/LINUX you've to install Apache, PHP, MySQL in sequence.
To do it follow the following steps.
At first open terminal by Pressing CTRL+ALT+T or run it from Dash-Home.
1) Install Apache2: Type the below command to install Apache.
sudo apt-get install apache2
Enter your Administrative/Root User password.
Now type the below command and goto localhost on your web browser to check it works or not.
sudo /etc/init.d/apache2 restart
If the webpage shows "It Works!", it means apache2 has installed properly.
2) Install MySQL 5: Type below command into terminal to install MySQL.
sudo apt-get install mysql-server mysql-client
Now you'll be asked for setting password to MySQL. (N.B. You default username is "root")
3) Install PHP 5: Type following command to install PHP 5.
sudo apt-get install php5 libapache2-mod-php5
Now restart apache.
sudo /etc/init.d/apache2 restart
4) Test that PHP 5 is installed properly: Type below command into terminal.
sudo gedit /var/www/info.php
A document file will open with gedit. Type the below php code and save. Then goto loaclhost/info.php on you web browser. You'll get the information about php in a table.
<?php
phpinfo();
?>
5) Set MySQL support in PHP5 To do it type below commands into terminal.
sudo apt-cache search php5
Pick the ones you need & install them like below-
sudo apt-get install php5-mysql php5-curl php5-gd php5-intl 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
Restart Apache by typing below command.
sudo /etc/init.d/apache2 restart
6) Install phpmyadmin: Type the following command to install phpmyadmin.
sudo apt-get install phpmyadmin
Select apache2 on asking of Web server to reconfigure automatically.. & select No on asking of Configure database for phpmyadmin with dbconfig-common?.
Now type the below command to configure apache with phpmyadmin
sudo gedit /etc/apache2/apache2.conf
A document will open with gedit. Goto the bottom of it. And add Include /etc/phpmyadmin/apache.conf and save it.
Restart apache for the last time.
sudo /etc/init.d/apache2 restart
Now goto localhost/phpmyadmin on your web browser. Login with username as "root" & your selected password. You'll see the user interface of phpmyadmin.
Thats it. :-) Enjoy!
Previous published on - vInfoSpot.com
Comments
Post a Comment