0

I am using XAMPP and Apache is running fine. My file is saved at:

C:\xampp\htdocs\php\index.php

But when I open this URL in the browser:

http://localhost/php/index.php  

I get this error:

Not Found
The requested URL was not found on this server.

I have tried restarting Apache, checking the file path, and using different browsers, but the issue still exists.

Here is my PHP code:

<?php 
$stdname = "Ali";
$stdage = "22";
echo $stdname . "" . $stdage;
?>
5
  • 5
    This suggests that the web server may not be serving files from the directory you expect. Have you checked that configuration? Commented May 19 at 18:26
  • 1
    If you simply do: http://localhost does an It works! message or some other default apache page appear? Also, try removing the htdocs portion of the URL, as the document root is likely already refers to that folder. Commented May 20 at 2:28
  • @PaulT. the OP didn't put htdocs into the URL they tried... Commented May 20 at 8:36
  • @ADuson ... You are correct, I was fooled by the first path. The URL http path is correct. Commented May 20 at 12:06
  • 1
    I'd suggest troubleshooting the virtual host itself before digging into PHP configuration. For that, put some static document (text file, picture...) and see whether it loads. Commented May 20 at 14:48

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.