Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have been following this tutorial

And I have got to the part where I am running a simple test to determine whether php has been installed properly

the installation went fine, I installed php5 using the following command apt-get install php5 libapache2-mod-php5 and I then restarted the server.

to see whether php5 has been installed I did the following

created a file vi /var/www/info.php

edited the file <?php phpinfo(); ?>

after trying to run it on my server I get a 404 Not Found error. What could be the problem?

share|improve this question

closed as off-topic by Seth Jun 28 '14 at 22:09

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This describes a problem that can't be reproduced that seemingly went away on its own or was only relevant to a very specific period of time. It's off-topic as it's unlikely to help future readers." – Seth
If this question can be reworded to fit the rules in the help center, please edit the question.

Try changing the permission of files under /var/www and check localhost/info.php – devav2 Sep 5 '12 at 14:50
@devav2 Im not running the server on my computer I can't use local host, but I'll look into changing permissions – mk_89 Sep 5 '12 at 14:52
okay got you :) – devav2 Sep 5 '12 at 14:54
If the apache place holder worked for you but the php info did not try sudo chown -R www-data:www-data /var/www – damien Sep 6 '12 at 2:42
Create the file info.php in /var/www/html/ instead of /var/www/. – user283810 May 21 '14 at 10:47

First check your Ubuntu Version.

cat /etc/lsb-release

Restarting apache services will solved your problem.

sudo service apache2 restart

If you are getting Ubuntu 14.04 LTS

cat /etc/lsb-release

Then your apache root directory will be /var/www/html/

 sudo vim /var/www/html/info.php


write your php script.

Restart apache2 service.

sudo service apache2 restart

Try it.

share|improve this answer

If it is a permission problem it should return 403, not 404. Check the files in /etc/apache2/sites-enabled/ . There is probably only one file (000-default) if you didn't create any new hostnames yourself. Does it say 'DocumentRoot /var/www' ? And does it say:

<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all


share|improve this answer

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