Apache/PHP on Windows 8
apache, php, windows-8
Solution
Download and follow instructions from this link: http://www.apachelounge.com/download/
The latest download (2.4) works on Windows 8 and Server 2012.
I downloaded and tested with the following on Windows 8: Each zip has a readme.txt or install.txt with instructions.
Apache 2.4 http://www.apachelounge.com/download/win32/binaries/httpd-2.4.3-win32.zip
PHP 5.4.8 http://windows.php.net/downloads/releases/php-5.4.8-Win32-VC9-x86.zip
- PHP 5.4.8 handler for Apache http://www.apachelounge.com/download/win32/modules-2.4/php5apache2_4.dll-php-5.4-win32.zip
My httpd.conf lines that were added/modified were:
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule php5_module "C:/Apache24/php-5.4.8/php5apache2_4.dll"
LoadFile "C:/Apache24/php-5.4.8/php5ts.dll"
PHPIniDir "C:/Apache24/php-5.4.8"
<IfModule php5_module>
<Location />
AddType text/html .php
AddHandler application/x-httpd-php .php
#AddHandler application/x-httpd-php-source .phps
</Location>
</IfModule>
Problem
I'm having trouble with Apache/PHP on Windows 8. I have previously been using them on XP (along with MySQL) with no problems. I never used Windows 7. Apache installs without issues. Everything works OK, including all my virtual servers. PHP installs OK, the installation puts entries into httpd.conf without giving errors. However, when I try to load Apache after installing PHP, Apache won't load. I'm confused by the error that Apache returns when the PHP entries are included in httpd.conf: ``` Syntax error on line 1029 of C:/Program Files/Apache Group/Apache2/conf/httpd.conf: Cannot load C:/Program Files/PHP/php5apache2_2.dll into server: The specified module could not be found. ``` The lines are: ``` #BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL PHPIniDir "C:\Program Files\PHP\" LoadModule php5_module "C:\Program Files\PHP\php5apache2_2.dll" #END PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL ``` (line 1029 is the LoadModule line). That location for the dll is definitely correct. The syntax of the line is as inserted by PHP. I have compared the syntax to previous versions of httpd.conf that I have and it appears correct. I think the syntax error is a red herring. I have tried: - Switching backslashes to slashes in the dll location. - Adding PHP to the path. - Installing Apache and PHP in both sequences. - Checking the permissions to the PHP folder and the individual files to ensure that SYSTEM has read/execute. Comment out the PHP lines and Apache loads fine. If I comment out the LoadModule line and and just leave the PHPIniDir line, it still fails. Apache seems to be behaving as though it can't see the PHP directory, but I can't work out why. There is nothing on the Windows event log. Latest versions of PHP and Apache. I'm at a bit of a loss what to try next. Any suggestions please?