Beginner’s guide to setting up Apache2, PHP5, and MySQL
The following are beginners instructions on how to install Apache2, PHP5, MySQL, and PHPMyAdmin in one swoop. I tried to simplify the process as much as possible. This should work for all distributions (although I have only tested it on Ubuntu). Copy and paste the following command into a terminal:
apt-get install mysql-server mysql-admin apache2 php5 libapache2-mod-php5 libapache2-mod-auth-mysql php5-mysql phpmyadmin
Once all these programs finish installing, you can go to /var/www and anything you put in /www will appear on your server. Open a browser and type “localhost” into the URL and you will see all the files on your server. There should only be two links in your localhost at this point: apach2-default and phpmyadmin.
Before you can begin using MySQL you need to give yourself permission to log into PHPMyAdmin. You can give yourself root access to begin with by typing the following command (obviously replace “yourPassword” with the password you want):
mysqladmin -u root password yourPassword
After you setup your access to PHPMyAdmin you need to restart your server and then you can log in. Type the following commands to restart MySQl and Apache2:
/etc/init.d/mysql restart
/etc/init.d/apache2 restart
Go to localhost/phpmyadmin and log in and you will be able to add databases to MySQL. Let me know if you have any questions and I’ll address them in the comments.
Related Stories
POSTED IN: How To
3 opinions for Beginner’s guide to setting up Apache2, PHP5, and MySQL
Version control your text via Wikis
Nov 26, 2007 at 7:58 pm
[…] there are a lot of PHP-based wikis out there so it’s more or less required for you to have Apache and PHP installed. Some wikis don’t really require a database backend so it’s not always a necessity to […]
only_samurai
Jun 3, 2008 at 3:03 pm
This is surely a beginner’s guide. Not bad for a quick-setup; however, a lot of detail into how things are configured and used are left out. Nice job all the same.
Rob
Aug 11, 2008 at 6:33 am
I would agree with only_samurai, other than this:
I have a major noob problem, in that after installing php, apache and mysql first (and phpmyadmin later) i just get a standard apache test page when i log in. this tutorial only covers if everything works perfectly.
Have an opinion? Leave a comment: