Forum Moderators: phranque

Message Too Old, No Replies

httpd.conf with PHP 5

         

jdickens10

6:36 am on May 19, 2011 (gmt 0)

10+ Year Member



I've downloaded Apache's HTTP 2.2.18 Server from [httpd.apache.org...] (Win32 Binary without crypto (no mod_ssl) (MSI Installer) and installed it with localhost as the domain and server name. Everything worked fine (tried starting, stopping and restarting), but then I modified httpd.conf with the following lines:


LoadModule php5_module "C:\PHP\php5apache2_2.dll"


and


AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
PHPIniDir "C:\PHP"


so it can work with PHP5 installed in C:\PHP (downloaded from [windows.php.net...] PHP 5.2 (5.2.17), VC6 x86 Non Thread Safe). After modifying httpd.conf, I tried to restart Apache but I get a pop-up error message saying "The requested operation has failed!". Restoring httpd.conf to its original configuration, Apache works fine again. The file php5apache2_2.dll in C:\PHP is working correctly and no problems were experienced during PHP installation. Any idea?

coopster

11:24 pm on May 23, 2011 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, jdickens10.

AddType is often incorrect and noted many times in forums and even on the PHP site. Use AddHandler instead. Also, in the Apache config you should use the unix directory separator.

# configure the path to php.ini 
PHPIniDir "C:/php"
# For PHP 5 do something like this:
LoadModule php5_module "c:/php/php5apache2_2.dll"
AddHandler php5-script php

If you still have issues after restarting, try rebooting your machine, then start the http server. Use the Windows "Event Viewer" to check your logs for any additional error messages.