Can't access http://localhost on Vista

There should be something like:


LoadModule php5_module        modules/libphp5.so
AddHandler php5-script php

If there isn’t, add it. modules/libphp5.so should be the path to the php module.

None of that is in the httpd file that I can see. I just went through it 4 times. To my untrained eye, I think I can see the code in this file is grouped into sections. Can you tell me to which section I would actually add this code, and would it be preceded by a # sign or no?

Its alot easier to just uninstall and reinstall PHP using the PHP5 binary installer. The installer should prompt you for the directory where httpd.conf file is located and it will modify it for you.

O.k. I uninstalled and re-installed PHP. Doing so reminded me of something I had forgotten earlier and that I am too “green” to have known the significance of. Every time I install or uninstall PHP, I get an error message that says “Error trying access httpd.conf file. You will need to manually configure the web server”.

Your tip told me to use the binary installer, but I don’t know that term…the way I did it was to save the installer.msi file from the PHP website to my desktop, then clicked on it to begin the installation. Should I install a different way?

That is the binary installer :slight_smile:

Oh, duh! O.k., sorry. So…when trying to install PHP, I get the “Error trying access httpd.conf file. You will need to manually configure the web server” error. Any advice on manully configuring the web server?

Did you direct the installer to the directory with the httpd.conf file? If you have to manually edit the httpd.conf file your going to have to know the path to php5apache2.dll which will require looking through your – I’m assuming you used the default preferences – C:\Program Files\PHP directory to file it. Once you find it you need to add something similar to what I showed you previously.


LoadModule php5_module "C:/Program Files/php/{--PATH HERE--}/php5apache2.dll"
AddType application/x-httpd-php .php
PHPIniDir "C:/Program Files/php"

Add it to your httpd.conf file after the section with all the LoadModule statements.

Ok, I sure appreciate your patience with me. Once I get this I’ll probably give myself a big dope slap and say “oh, that’s what he meant!!” But…when I installed PHP, the installer didn’t give me any configuration options at all, it just produced the aforementioned error, so I have to do it manually.

I copied your code right into httpd.conf, which is located in my conf folder in Apache. (I noticed there’s a folder called “extra” and a folder called “original” with httpd files but I didn’t go into those folders.) I copied your code as is, right below the other LoadModule statements. The code example you gave me has {–Path Here–} in the path to the .dll file, but if I take that out, which I did, then I have the exact path to the .dll file. Am I supposed to insert something into {–Path Here–} ? The actuall path to the .dll file is “C:/Program Files/php/php5apache2_2.dll”, so I was figuring I didn’t need anything in place of {–Path Here–}. At any rate, when I put your code into the httpd file, Apache will no longer start. Do I need # before each line? Did I misinterpret your code? Here’s a snapshot of the bottom of that LoadModule section, including how I put your new code in (the first two lines were already in the file):

#LoadModule version_module modules/mod_version.so
#LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule php5_module “C:/Program Files/php/php5apache2_2.dll”
AddType application/x-httpd-php .php
PHPIniDir “C:/Program Files/php”

Ok, I just fixed one small error…the PHP folder is capitalized, so I made that change in two spots:

#LoadModule version_module modules/mod_version.so
#LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule php5_module “C:/Program Files/PHP/php5apache2_2.dll”
AddType application/x-httpd-php .php
PHPIniDir “C:/Program Files/PHP”

Now the Apache server will start again, but http://localhost still only returns “IT WORKS!” and doesn’t execute the script in C:\Inetpub\wwwroot

STOP THE PRESSES! It works! Whew! I was correct in that entering http://localhost only returns “IT WORKS”, but then I entered http://localhost/test.php after sending you my last message, and lo and behold it ran the script!

So is this common to have to enter the file name after localhost?

If you remove “index.*” or rename that file you should get a directory listing.

Yes if that’s the file you want to be executed :3

I appreciate all who have contributed to my problem. This is such a valuable resource that I can hardly express my thanks. I have the feeling that I am only scratching the surface as I wade into this area that I know nothing about, and that I’ll be posting again soon! This problem has been maddening and without Sitepoint and those who contributed, I could not have gone beyond my original problem. Thanks to all of you.