How to install and configure Apache, PHP, MySql and phpMyadmin on ubuntu
Hello everyone ,
If you want to start php coding , this will be useful for you ๐
..
Step 1 : Installing apache
Open Terminal.
To open terminal click the Dash home from unity launcher. And type terminal in the search field.And click Terminal .
type the below code in terminal and enter.
sudo apt-get install apache2
You will see a message ” Do you want to Continue [Y / N]ย ? “
Type (y) and enter to confirm the apache installation.
After the successful installation, open your browser and type
http://localhost
You suppose to see โIt works!โ message. If you saw it, then your apache works fine.
..
Step 2 : Installing PHP
Open Terminal.
Copy the below code in terminal and enter.
sudo apt-get install php5 libapache2-mod-php5
You will see a message ” Do you want to Continue [Y / N]ย ? “
Type (y) and enter to confirm PHP installation.
After the successful installation, restart Apache using the below code:
sudo /etc/init.d/apache2 restart
Test PHP installation ย :
– To test your PHP , open terminal and type :
sudo gedit /var/www/phpinfo.php
and type your ubuntu password if needed. It will open the “phpinfo.php” file in the gedit editor.
Type below code in the phpinfo.php file, save and close it.
<?php phpinfo() ?>
Now open your browser and type
http://localhost/phpinfo.php
If you will see the below page , then your php works fine.
..
Step 3 : Installing MySql
Open Terminal. And type the below code in terminal and enter.
sudo apt-get install mysql-server
You will see a message ” Do you want to Continue [Y / N]ย ? “
Type (y) and enter to confirm MySql installation.
During the installation you will find a menu asks you for a MySQL root password.
Repeat the password and enter again.
…
Step 4 : Installing phpMyadmin
phpMyAdmin is a free software tool written in PHP intended to handle the administration of MySQL databases.
Open Terminal and type the below code and enter :
sudo apt-get install phpmyadmin
You will see a message ” Do you want to Continue [Y / N]ย ? “
Type (y) and enter to confirm phpMyadmin installation.
During the installation you will be asked to choose a Web server to reconfigure automatically :
Select ”ย apache2 ” then ok .
..
Now you will be asked toย configure datebase for phpmyadmin with db-config common .. select (No) .
..
Open terminal and write the below command :
sudo cp /etc/phpmyadmin/apache.conf /etc/apache2/conf.d
Then .. restart your apache server :
sudo /etc/init.d/apache2 restart
Open your browser and type :
http://localhost/phpmyadmin/
Type your mysql rootย username and password to login.
..
Youโre now ready to start building your local website. Just put all of your files into
/var/www
..
Happy Coding ๐
enjoy !