To set up Apache, PHP and MySQL, all you have to do is run a few commands in the terminal. Given below is the brief instruction set for the same.
Run the following commands in your Ubuntu terminal.
- sudo apt-get install apache2
- sudo /etc/init.d/apache2 restart
Now that you have installed and restarted apache2, check if it is working in your local machine.
For this type
in your web browser. If you read “It works”, it proves that apache is working.
Run the following commands on your Ubuntu terminal.
- sudo apt-get install libapache2-mod-php5
- sudo a2enmod php5
To check if your php is working, create a file one.php in var/www folder and try if it can be written. Otherwise, you can use the following commands:
- cd /var
- sudo chmod -R 777 www
This will set write permission for files in www.
Run the command:
sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql
To access the mysql console, you have to type:
mysql -u root
and if you have an already set password then the command will change as:
mysql -u root -p
To set up phpmyadmin:
run the command:
sudo apt-get install phpmyadmin
Go to your browser, type in localhost/phpmyadmin.
If this doesn’t show up the phpmyadmin page, got var/www and see if the phpmyadmin folder is there. Else, goto usr->share and copy the phpmyadmin folder to var/www
Now localhost/phpmyadmin should work.
These are the very basic steps of installation explained above.
Hope this post made installation a bit easy for you.