Apache / PHP for Windows 8

I am having problems with Apache / PHP on Windows 8. I previously used them on XP (along with MySQL) without any problems. I have never used Windows 7.

Apache installs without problems. Everything is working fine, including all my virtual servers. PHP installs OK, the installation puts the entries in httpd.conf without errors. However, when I try to download Apache after installing PHP, Apache does not load.

I am confused by the error that Apache returns when 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. 

Lines:

 #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 - line LoadModule). This place for dll is definitely correct. The string syntax is inserted as PHP. I have compared the syntax with previous versions of httpd.conf that I have and it looks correct. I think the syntax error is a red herring.

I tried:

  • Switch backslashes to slashes at dll location.
  • Adding PHP to the path.
  • Install Apache and PHP in both sequences.
  • Checking permissions on the PHP folder and individual files to ensure SYSTEM read / execute.

Comment out the PHP lines and download Apache. If I comment on the LoadModule line and just leave the PHPIniDir line, it still fails. Apache seems to behave as if it cannot see the PHP directory, but I cannot understand why.

There is nothing in the Windows event log. Latest versions of PHP and Apache. I'm a little early, what to try next. Any suggestions please?

+4
source share
5 answers

Download and follow the instructions at this link: http://www.apachelounge.com/download/

The latest download (2.4) works on Windows 8 and Server 2012.

I downloaded and tested the following on Windows 8: Each zip has a readme.txt or install.txt file with instructions.

My httpd.conf lines that were added / changed were as follows:

 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> 
+11
source

It is mentioned in the Readme.txt file, packaged with a dll in ApacheLounge, but nowhere on the download page or in the file name (as in all other versions):

"Works with PHP 5.4 Thread Safe (TS) and only with Apache 2.4 Win32 VC9 or VC10"

DLL files are only for the TS version, so if you downloaded another, you are mostly screwed. TS php files fixed this for me.

GL.

+1
source

Assuming this is your development, not your deployment environment, why don't you just download xampp from apache friends ? It must be preconfigured, and you will still deploy it in a different setting.

0
source

I encountered a similar problem when reinstalling Apache and PHP on Win 8 (but I'm more of a Linux user). And it looks like the original post, no matter what I tried to do in httpd.conf and php.ini, Apache just didn't start or didn't see PHP. After spending an unreasonable amount of time, I decided to download PHP 5.3 (5.3.27) -VC9 x86 Thread Safe (2013-Jul-10 21:56:58) Installer [45.86MB] instead of the treadless version that I used before. There is a difference in .msi settings. The one that for the thread-safe version actually contains the required files, and if you follow the instructions of the installer, it will really ask you if the php installation should be β€œbound” to the Apache server. Then you just provide the hhtpd.conf directory and everything works fine. Thats my 2c on this :)

0
source

I think the problem is empty "Program Files".

-1
source

Source: https://habr.com/ru/post/1446661/


All Articles