Apache server does not recognize the htdocs folder

2.6k Views Asked by At

I have installed Apache server correctly and I have downloaded php thread safe from php official website.

I start apache service and create a (phpinfo.php) file which contains the following code:

<?php
phpinfo();
?>

I copy the following file to the directory "Apache\htdocs\" and try to access the following file through the browser with the address "localhost/phpinfo.php". But I get 404 file not found error.

if I try to access "localhost" I get a single text "It Works" but nothing more. I deleted all the files in the htdocs directory but I still get "It Workds" text when I try to navigate "localhost".

Why is it happening? how can I create a .php file and browse it through the browser?

Note that: 1- Apache service is started. 2- I have add the following code to the end of the "apache\conf\httpd.conf" file:

AddType application/x-httpd-php .php
PHPIniDir "C:/php5/"
LoadModule php5_module "C:/php5/php5apache2_4.dll"

Thanks in advance

2

There are 2 best solutions below

0
On BEST ANSWER

The problem was since I had changed the listening port of my apache server I did not wrote it when I was trying to access the pages in the "apache/htdocs" directory.

Now all I have to do is to add the port number when I want to access a page through the browser:

http://localhost:8085/Index.html

Its working...

1
On

Assuming you installed version 2.2 the default document root should be:

C:/Program Files/Apache Software Foundation/Apache2.2/htdocs

If you're using MAMP or some similar package please update your question to reflect that.