I installed lamp on ubuntu. Apache2 and Mysql are working fine.

The folder apache2 is in /etc and contains:

apache2.conf  envvars     magic           mods-enabled  sites-available
conf.d        httpd.conf  mods-available  ports.conf    sites-enabled

The httpd.conf file is empty. As far as windows is concerned apache had a "www" folder where we used to store our php files. What should I do in this case ? The tutorials given on the internet could not help! :| Please help!

  • What tutorials you followed? How you installed apache? Is it using package manager like apt-get or software center or some other process – Anwar Aug 9 '12 at 16:40

The equivalent folder in Ubuntu should be /var/www, unless you changed it yourself. This directory is (by default) defined in /etc/apache2/sites-enabled/000-default, in the line that begins with the word DocumentRoot.

| improve this answer | |
  • You'll probably need to change permissions for that folder. sudo chmod 777 /var/www/ – tyjkenn Aug 16 '12 at 1:07
  • 3
    777 is rarely the solution to any problem. – Marios Zindilis Aug 29 '12 at 17:14
  • 2
    set permission to 777 is not recommended solution, everyone will be able to access your folder, of course that's related with security reason. – metamorph May 15 '14 at 10:45
  • I have my php files in the folder you specify @MariosZindilis but when I access 'localhost' I think my browser is looking for index.html, not index.php (which is what I have). How do I get the php file to run? Also, I have a child theme i would like to run and that is in a separate folder. – GoProCameraByGoPro Mar 11 '15 at 21:40
  • It seems that since 2012, when this answer was first posted, Ubuntu has changed the location of files for the default website on Apache, and it is now /var/www/html. That directory includes a sample index.html in a fresh installation. – Marios Zindilis Mar 12 '15 at 1:12

If you are running your file just for the localhost then change the chmod to 777 for /var/www/html save every php file in html folder which is found in the path mentioned above. The new apache loads the file from the server only if it is present in the HtMl folder. i hope it will work. (Though 777 chmod is not recommended of course because of the security issues)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.