php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53721 Upgrade breaks Apache config
Submitted: 2011-01-12 13:22 UTC Modified: 2016-06-29 18:02 UTC
Votes:18
Avg. Score:4.6 ± 0.7
Reproduced:16 of 16 (100.0%)
Same Version:4 (25.0%)
Same OS:3 (18.8%)
From: martijn at thany dot nl Assigned: cmb (profile)
Status: Closed Package: Windows Installer
PHP Version: 5.3.5 OS: Windows 2008 R2
Private report: No CVE-ID: None
 [2011-01-12 13:22 UTC] martijn at thany dot nl
Description:
------------
This happens basically everytime PHP is upgraded by simply executing the windows installer. The problem is that the apache config is modified (which is reallt not even neccesary in a minor upgrade), in a way that breaks apache.

This is what gets added:

#BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL
PHPIniDir ""
LoadModule php5_module "php5apache2_2.dll"
#END PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL

This is plain WRONG, because this piece of config assumes php5apache2_2.dll to be in apache's installation directory, which it isn't. The installer installs it in "C:\Program Files (x86)\PHP", which is a totally different directory, obviously. This problem produces two consecutive errors in the event log, upon starting Apache:

>>> httpd.exe: Syntax error on line 426 of C:/Program Files (x86)/Apache Software Foundation/Apache2.2/conf/httpd.conf: Cannot load C:/Program Files (x86)/Apache Software Foundation/Apache2.2/php5apache2_2.dll into server: The specified module could not be fo     .

>>> und.     .

The solution is to include the path to the dll, like so:

LoadModule php5_module "C:/Program Files (x86)/PHP/php5apache2_2.dll"

This should (can can) be handled by the installer.

Also, second error is the PHPIniDir. It shouldn't be empty. That's WRONG as well, and produces the following error:

>>> PHPINIDir takes one argument, Directory containing the php.ini file     .

Why on earth would the installer produce such errors in the apache conf?? The solution, again, is to simply include the path to where php.ini has been put, which is almost always the installation dir:

PHPIniDir "C:/Program Files (x86)/PHP/"


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-23 17:20 UTC] kristjang at ffsn dot is
I just downloaded Apache 2.2.17 (x86 MSI installer) and PHP 5.3.5 (V6 x86 MSI 
installer). As mentioned by martijn, I had to edit httpd.conf and add the path 
to the PHP module. Even then, Apache will crash on startup if I have PHPIniDir 
enabled, with the error 

"[crit] (OS 6)The handle is invalid.  : master_main: create child process 
failed. Exiting.".

If I comment PHPIniDir out, Apache starts normally and loads .php files, 
however, according to phpinfo(), the "Configuration File (php.ini) Path" is set 
to "C:\WINDOWS" which doesn't contain any php.ini file. I had also set PHP's 
'error_log' but it doesn't seem to read my php.ini file.
 [2012-02-15 19:27 UTC] paulo230 at msn dot com
Thanks for solving that for me, it was INCREDIBLY STUPID AND FRUSTRATING !!
 [2016-06-29 18:02 UTC] cmb@php.net
-Status: Open +Status: Closed -Package: Apache2 related +Package: Windows Installer -Assigned To: +Assigned To: cmb
 [2016-06-29 18:02 UTC] cmb@php.net
php.net does not distribute MSI packages anymore, so this ticket
can be closed.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 13:01:31 2024 UTC