php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44596 PHP crashes after calling exit() from an auto_prepend_file many times.
Submitted: 2008-04-01 20:07 UTC Modified: 2008-04-11 01:00 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: php at timkoop dot com Assigned: fb-req-jani (profile)
Status: No Feedback Package: Reproducible crash
PHP Version: 5.2.5 OS: Windows NT WEBSERVER 5.2 build 3
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2008-04-01 20:07 UTC] php at timkoop dot com
Description:
------------
When using an auto_prepend file, if you call exit() in this prepended file, it works fine for a while.  But after about 400 or 500 or 600 times calling any php page on the website, you receive a simple "No input file specified".  And every site in IIS also displays this message on php pages.

This page describes why you would want to do this: http://www.ilovejackdaniels.com/php/caching-output-in-php/

Reproduce code:
---------------
In php.ini, set an auto_prepend file like this:
auto_prepend_file = prepend.php

In prepend.php, put something like this:
<?
echo "<html><body>This comes from prepend.php</body></html>";
exit();
?>

(Actually, this above code might have to be in an included file that was called from prepend.php)

Now you have to call any page in the website a few hundred times before the error kicks in.  The first few times will appear to work as expected.  A small bash script to do this for you might look like this (for your convenience only; not a part of the bug):

for ((i=1;i<=1000;i+=1)); do
echo $i
wget http://yoursite.com/anyfile.php --quiet --output-document=/dev/null
done


Expected result:
----------------
I would expect the prepended file to produce the following code and the actual called file would not produce anything, so this would be the entire html returned no matter what file you called:

<html><body>This comes from prepend.php</body></html>


This does actually work the first few hundred times.

Actual result:
--------------
The expected result is returned (correctly) a few hundred times.  Then after that, the following line is returned:

No input file specified.

After this, IIS must be restarted to get back to normal.

I will happily provide a backtrace if needed.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-04-02 09:29 UTC] jani@php.net
And you're absolutely 100% sure it's exit() in auto prepended file that causes this? Do you by any chance have APC installed and enabled when this happens?
 [2008-04-02 19:30 UTC] php at timkoop dot com
I don't have APC installed.  I used to have EAccelerator installed, but it isn't now.  My php.ini file has no major differences to the one that came with 5.2.5.

As to how sure I am, all I know is that when exit() is called in the auto prepended file, PHP crashes in about 485 page requests and when it is not there everything works fine.

Thanks so much for looking into this.  If there is anything more I can provide, please just say the word.

--
Tim
 [2008-04-03 11:23 UTC] jani@php.net
For starters, try the snapshot (it's upcoming 5.2.6RC actually):

Zip: http://snaps.php.net/win32/php5.3-win32-latest.zip
or
Installer): http://snaps.php.net/win32/php5.3-win32-installer-latest.msi

And make sure you have _all_ 3rd party Zend extensions disabled in your php.ini. For example Zend optimizer, any opcode caches, debugger (like Xdebug), etc. 
 [2008-04-11 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 21:01:36 2024 UTC