Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to install an Apache web server with PHP on my Windows XP Pro box, but I'm not having any luck.

I'm trying to mimic a production server, so I'd rather not have the latest. The prod environment uses 5.3.6; I'm settling for 5.3.5 on my Windows box.* For Apache, the prod environment uses 2.0.63; I've tried both 2.0.64 and 2.2.22 (I figure matching the language version is more important than the web server version) and gotten fundamentally the same failures.**

I've been following the instructions on this page, and they consistently fail when it's time to add this code to the httpd.conf file:


LoadModule php5_module "c:/php/php5apache2_2.dll"
AddModule application/x-httpd-php .php
PHPIniDir "C:/php"

The directory paths are correct, and c:/php/php5apache2_2.dll is a real file. When I try to Restart/Start the Apache server, I get a "The requested operation has failed!" pop-up message. The logs/error.log file is no help; nothing is getting written to it. (For this failure, I mean. The file exists and isn't empty.)

When I comment those three lines out the web server starts, so I'm quite sure the problem lives there.

I'm fairly sure the PHP install went just fine; I get the output I'd expect when I run php -v from the command line.

Any advice on what I'm doing wrong is welcome and very much appreciated.

'* Why? Because the download page indicated that I wanted VC6 (not VC9) if I'm running it under Apache, and the archive page doesn't have VC6 for 5.3.6; 5.3.5 was as close as I could get.

** -- Upgrading to 2.2.22 was my most recent attempt at solving this before coming here, so that's what I'm running at the moment. I'd gladly step back to 2.0.64 to better replicate the prod environment, but like I said, I figure the language version is more important than the web server.

share|improve this question
    
is the php5apache2_2.dll registered on the machine? (regsvr32 c:\php\php5apache2_2.dll) –  TheCompWiz Feb 10 '12 at 21:42
2  
Why not just install using WAMP? –  Bibhas Feb 10 '12 at 21:43
    
@TheCompWiz: Apparently, no, it is not; that command returns an error message pop-up: "LoadLibrary("[file]") failed - The specified module could not be found." –  BlairHippo Feb 10 '12 at 21:46
    
@Bibhas: Because in all my Googling for installing Apache and PHP on Windows XP I somehow never managed to notice WAMP? That looks extremely relevant to my interests.... –  BlairHippo Feb 10 '12 at 21:48
    
@BlairHippo Got it. –  Bibhas Feb 10 '12 at 21:49

2 Answers 2

Apache startup failures, particularly on initial configuration, are often a result of a module not being found in the DLL load order. (Assuming the config files are properly written.)

Your first problem is that you're attempting to load the Apache 2.2 handler into Apache 2.0, but 2.2.22 should have loaded. :-P

What does the System Event Log say? IIRC, useful information gets logged there when Apache fails to start up.

Can you start Apache without PHP enabled?

What does the output of httpd -t say from a Command Prompt? You'll need to be in the Apache\bin folder for that.

Does the account that you're attempting to run Apache under have read access to your PHP folder? Does it have write access to your log folder?

Are you trying to load any PHP extensions? If so, is your extension_dir set correctly in your php.ini?

Does php -i from a command line work? What's the output from php --ini? Is it finding the correct ini file?

You didn't grab a nts (non-Thread Safe) version of PHP, did you? For loading PHP as an Apache module, you need the thread safe version.

Finally, it might be worth looking at running PHP as a CGI rather than a server module for development purposes. It makes it much easier to switch PHP versions for testing the effects of upgrading the runtime.

-=-=-

One server I have access to running Apache 2.2 and PHP 5.2, uses the following directives:

LoadModule php5_module "C:/php/php5apache2_2.dll"
AddType application/x-httpd-php .php
PHPIniDir "C:/php"
share|improve this answer
    
As mentioned, I'm no longer using Apache 2.0; I uninstalled it and installed 2.2.22. Also, as mentioned, when I comment out those PHP-related lines in httpd.conf, the server does indeed start. The system log records two Information entries and an Error, which says "The Apache2.2 service terminated with service-specific error 1 (0x1)." httpd -t says "Invalid command 'AddModule'" ... hey. That looks suspiciously like paydirt. –  BlairHippo Feb 10 '12 at 22:06
    
So. If "AddModule" is the wrong command to use, do you know what the right one is? –  BlairHippo Feb 10 '12 at 22:08
    
Gah, I missed that. On my phone now. Maybe AddHandler? –  afrazier Feb 10 '12 at 22:44
    
It's AddType. –  afrazier Feb 13 '12 at 18:30

It costs a little money ($125), but I've gotten a lot of good use out of WampDeveloper Pro. For someone like me who is not much of a WAMP admin, it greatly simplified the process of getting everything to work together so I could concentrate on the web applications I was installing on top of the server software stack.

But you also said you needed to use specific earlier versions of some software - not sure if this product will let you do that.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.