So there is plenty of information out there about installing a standard LAMP server out there.
I’ve had a LAMP server on my Ubuntu laptop for quite some time. But i ran into troubles when I wanted to have a CakePHP installation on my local machine because I couldn’t get Apache’s mod_rewrite to work.
I’ve finally figured it out, and, given the difficulty I had finding the information I thought I should probably share my experience with the world.
So, firstly, installing LAMP. In case you’d missed it, LAMP stands for Linux, Apache, MySQL, PHP.
- php5-mysql (may be installed by default with the mysql-server package – sorry, can’t remember)
- webmin (a very helpful program
Read what others have written on this topic as well though.
Next, in order to give yourself permissions to the /var/www/ directory, you need to run the following command in your terminal:
sudo chown -R $USER:$USER /var/www/
It’s not a secure thing to do (I don’t think) but it will make your life much easier (no permissions to worry about, no need to “sudo nautilus”).
Finally, getting mod_rewrite to work.
First, initiate it with the following command:
Then edit the file /etc/apache2/sites-enabled/000-default. You can do this with the following command:
Then change the “AllowOverride None” to “AllowOverride All” in the “
In other words, when you run the nano command above you see the following in amongst some other stuff:
Options Indexes FollowSymLinks MultiViews
allow from all
Change the AllowOverride to ‘All’.
Then restart your server with the following command:
sudo /etc/init.d/apache2 restart
And you’re done!
Disclaimer: I’m a terrible systems admin and make no guarantee for the above. However, it did work for me which makes me happy.