php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33987 .php file in ErrorDocument causes apache crash
Submitted: 2005-08-03 21:46 UTC Modified: 2005-08-18 03:17 UTC
From: php dot net at sharpdreams dot com Assigned:
Status: Closed Package: Apache2 related
PHP Version: 5CVS-2005-08-03 OS: *
Private report: No CVE-ID: None
 [2005-08-03 21:46 UTC] php dot net at sharpdreams dot com
Description:
------------
Using recent PHP5.1 CVS snapshots on Win32, Apache2 crashes when a .php file is set as an ErrorDocument in .htaccess.

There are similiar bugs (21074, 19793) that are marked closed.

This was working with snapshots from a few weeks ago.

Reproduce code:
---------------
.htaccess
---------
ErrorDocument 404 /error.php?status=404

/error.php
---------
die( "File Not Found!" );

Expected result:
----------------
File Not Found!

Actual result:
--------------
Apache2 crashes.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-08-03 22:02 UTC] php dot net at sharpdreams dot com
Tested on 5.0.3 release and it works fine. Some kind of regression between 5.0.3 and 5.1CVS.
 [2005-08-03 22:17 UTC] php dot net at sharpdreams dot com
This only seems to happen in Win32, works fine under our BSD boxes.

Windows XP SP2, Apache 2/2.0.54, PHP 5.1.0-dev (built: Aug 3 2005 20:36:22).

Changing my error document to anything other than a PHP file works (e.g., ErrorDocument error.html or /cgi-bin/error.pl).
 [2005-08-03 22:47 UTC] sniper@php.net
How have you enabled PHP in the httpd.conf file? (what lines did you add there to enable it..)

 [2005-08-04 01:37 UTC] php dot net at sharpdreams dot com
LoadModule php5_module "C:/www/apache2/PHP5-1/php5apache2.dll"
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
PHPIniDir "C:/www/apache2/php5-1"
 [2005-08-04 09:11 UTC] sniper@php.net
What do you get in the apache error_log when this problem happens? Are you sure it really crashes..?

 [2005-08-04 18:45 UTC] php dot net at sharpdreams dot com
There is no entry in either error_log or access_log (I presume it crashes before logging). If I turn on the rewriting log, I can see the request getting rewritten until it hits /error.php. I know it crashes because it pops u the Visual Studio debuger.
 [2005-08-14 05:27 UTC] sniper@php.net
It crashes if ErrorDocument refers to a PHP file.
Anything else and it works fine.
 [2005-08-14 16:14 UTC] sniper@php.net
It happens on Linux too if the child hasn't done any PHP requests yet.

 [2005-08-17 09:59 UTC] sniper@php.net
This happens if PHP has not done any requests -> it has not been initialized properly -> as it's not initialized it's pretty futile to try to execute a script blindly like it is done here:

sapi/apache2handler/sapi_apache2.c:564

See also the earlier block between lines 529-542
where parent_req is set.

 [2005-08-18 03:17 UTC] iliaa@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 17:01:32 2024 UTC