404 not found error on localhost .php file

2.7k views Asked by At

I'm just starting to learn php programing and I'm having this frustrating problem that does not let me to go on.

I just set up LAMP server on my linux mint with default settings on localhost. Problem is that when I create .php file in var/www browser can not find it and shows 404 not found message. When I created info file to view php info everything worked fine,

<?php info(); ?>

when creating new random php file in same location then the error comes up.

I lost whole day looking for an answer but not luck.

3

There are 3 answers

3
AnkiiG On

You are using incorrect function.

<?php phpinfo(); ?>

1
GGG On

I tried to reinstall the LAMP and it gave me the same result.

Then I found a post that suggested, default location for .php files might be in /var/www/html and not /var/www, so I tried that and it worked. Hope somebody will find this helpful.

0
acenturyandabit On

I am working on windows, but the issue might be the same - just use a root directory which doesn't have whitespaces. ~~ hope it helps