404 Error

While running info.php file I got the error 404 server not found. Means there’s a problem with the path. Either Document root is not correct in /etc/apache2/sites-avaialble/000-default.conf configuration file or may be php code is not in right place.

By default the path for Document root in 000-default.conf file is /var/www/html but we can change this by changing it here. Make sure the you are giving here is correct.


$ sudo vim /etc/apache2/sites-available/000-default.conf

ServerAdmin webmaster@localhost
DocumentRoot /var/www/html

So, our php code should also be stored here.

$ cd /var/www/html

simran@playstation:/var/www/html$ sudo vim info.php

:wq to save and quit from vim

To check:

Go to the browser and type- http://localhost/info.php

It will display the output file.

Leave a comment