Windows – http://localhost does not work, http://127.0.0.1 works

apache-2.2PHPwindowszendzend-framework

Iam running Zend with Apache and got to see a strange behaviour….

If i type http://127.0.0.1 in my browser url, it works fine, but after typing: http://localhost, i will get a file download window, saying file type as: application/x-httpd-php

And in my httpd.conf file, i have the following under VirtualHost *:80 definition:

ServerName localhost

DocumentRoot E:\zend\Apache2\htdocs\my_project\public

Directory E:\zend\Apache2\htdocs\my_project\public

Perhaps some configuration problem… can anyone guide me..

Best Answer

from the httpd.conf file:

NOTE: Where filenames are specified, you must use forward slashes instead of backslashes (e.g., "c:/apache" instead of "c:\apache"). If a drive letter is omitted, the drive on which Apache.exe is located will be used by default. It is recommended that you always supply an explicit drive letter in absolute paths to avoid confusion.

so change the

DocumentRoot E:\zend\Apache2\htdocs\my_project\public

to

DocumentRoot "e:/zend/Apache2/htdocs/my_project/public"

the Directory E:\zend\Apache2\htdocs\my_project\public is the part of the config file in which services and features are allowed and/or disabled in that directory, so it has to go like this:

<Directory "e:/zend/Apache2/htdocs/my_project/public"> some options </Directory>

it would be easier to point out what's wrong if you would post the httpd.conf here, or upload it somewhere and post a link to that file