#30463 [Opn->Bgs]: popen crashes webservers

From: Date: Thu, 21 Oct 2004 21:18:37 +0000
Subject: #30463 [Opn->Bgs]: popen crashes webservers
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-67917@lists.php.net to get a copy of this message
ID: 30463 Updated by: wez@php.net Reported By: terrafrost at gmail dot com -Status: Open +Status: Bogus Bug Type: Reproducible crash Operating System: Windows XP PHP Version: 4.3.9 New Comment: Running the CGI version of PHP from within a web server will pick up the CGI env vars and ignore your command line parameters, leading to the fork bomb effect you have described. You need to fix your script to call the CLI version of PHP instead. Previous Comments: ------------------------------------------------------------------------ [2004-10-17 08:21:33] terrafrost at gmail dot com The problem also seems to effect proc_open... ------------------------------------------------------------------------ [2004-10-17 08:17:53] terrafrost at gmail dot com Description: ------------ When run from a webserver, the following two scripts cause the webserver to crash. In contrast, no such problem occurs when these scripts are run from the command line. Reproduce code: --------------- ptest.php: <? $p1 = popen("c:\\php\\php -q hello.php","r"); $p2 = popen("c:\\php\\php -q hello.php","r"); while (!feof($p1)) print fgets($p1); while (!feof($p2)) print fgets($p2); pclose($p1); pclose($p2); ?> and hello.php: <? print "hello,\nworld!\n"; ?> Expected result: ---------------- I expect the following to be displayed: hello, world! hello, world! Actual result: -------------- When run from the command line, the expected result is the actual result. However, when run from a webserver (I tried Apache 2.0.52 and Abyss Web Server 1.2.3.0) they create a bunch of php and cmd processes (more than it should) and none of them are terminated. In the case of Apache, processes are no longer created after the first 10 or so are. Afterwards, trying to view php scripts, with Apache, causes an Internal Server Error. In the case of Abyss, processes are no longer created when the system has run out of ram. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=30463&edit=1

« previous php.bugs (#67917) next »