php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23092 exec("foo.php") hangs
Submitted: 2003-04-07 10:06 UTC Modified: 2003-04-23 04:36 UTC
From: jlg at huelladigital dot net Assigned:
Status: Not a bug Package: Program Execution
PHP Version: 4.3.2-RC OS: Redhat 7.3 (kernel 2.4.18)
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jlg at huelladigital dot net
New email:
PHP Version: OS:

 

 [2003-04-07 10:06 UTC] jlg at huelladigital dot net
I have php compiled as cgi in /usr/local/bin/php:

./configure --with-mysql --enable-ftp --enable-sockets --with-ncurses --enable-cgi

I have 2 scripts, named foo1 and foo2:

foo1:
#!/usr/local/bin/php
<?php
exec("./foo2");
?>

foo2:
#!/usr/local/bin/php
<?php
print "foo";
?>

When I call foo1 from shell the result is OK (it echoes "foo"). But when I call it as a cgi (http://myserver/cgi-bin/foo1) it calls recursively the script "foo2" and hangs. I must restart apache.

It is Apache/1.3.27.
The script directory cgi-bin has "Options ExecCGI" directive.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-04-08 02:46 UTC] jlg at huelladigital dot net
I did, with no result. I also tried the other execution functions: passthru(), system(), shell_exec() and proc_open(). I tried, as well, redirecting the output to /dev/null &. The result was always the same.
 [2003-04-23 04:07 UTC] sniper@php.net
Remove those hasbang lines and it will work fine.

 [2003-04-23 04:36 UTC] edink@php.net
Better yet make sure /usr/local/bin/php is CLI and not CGI version of PHP. CGI cannot be executed from withing web server environment like that.

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Feb 05 11:01:31 2025 UTC