Edit report at http://bugs.php.net/bug.php?id=44942&edit=1

 ID:               44942
 Comment by:       andy dot hilbig at clubsys dot co dot uk
 Reported by:      inqualab1985 at gmail dot com
 Summary:          exec() hangs apache
 Status:           No Feedback
 Type:             Bug
 Package:          Program Execution
 Operating System: Windows 2000 SP4
 PHP Version:      5.2.5

 New Comment:

I have been plagued with PHP freezing after a few minutes, days or maybe
weeks. 

I use exec() to link to custom vb.exe

I have searched and searched until today tried the
session_write_close(); before the exec()call and session_start ();
after.



I can now click [Next Day]/[Next Day] as fast as I like and all appears
solid now. Other users have connected at the same time.



So, thank you all very much for the cure.



I have umpteen years programming in machine code and 15 in VB6 with the
Jet engine to Access. All works well with Apache/PHP/VB exes. Do I
really need .Net ???


Previous Comments:
------------------------------------------------------------------------
[2009-08-27 10:00:24] listephp at andrioli dot com

I've the same problem too.

I tried the latest snapshot 5.2.11RC2-dev build date: Aug 26 2009
23:42:35 , but it shows up.



Configuration

- Windows 2003 R2

- Apache 2.2.11



Both, exec() running java.exe and system() running .NET program, hang
Apache as described above.

------------------------------------------------------------------------
[2009-06-08 16:41:29] alex at bartl dot net

Reproducable with PHP 5.2.9-1 on Windows2003 Server with Apache2.2

Workaround with calling session_write_close() before calling exec()

confirmed working



NOT reproducable with PHP 5.2.1 on Windows 2000 Server with IIS5



anyway, seems to be a duplicate of Bug#44994

------------------------------------------------------------------------
[2009-04-07 15:12:50] gouldee at netscape dot com

I am having the same or similar issue:

    OS: MS2003

    PHP: 5.2.6

    APACHE2: 2.2



The bug occurs with an PHP script that has a PHP passthru exec call that
hangs every now and then.  After the first hang occurs then any passthru
call hangs in the same manner.



I believe that the passthru call runs as I am calling a sendmail.exe
process that does send the E-Mail, however, the Browser page hangs after
the E-Mail has been sent by sendmail.exe called via passthru().



There are no PHP or Apache2 errors or warnings.  It seems that the
problem happens when (2) calls to the same .exe happens at the same
time, but, I have no real proof of this, as I can't provide execution
times for each instance of the sendmail.exe running.



This is a serious problem, as all pages that call an .exe process after
the initial hang will hang up as well. I can clear the bug by simply
stopping and restarting the Apache service.



I also note that If I run the page, that hangs up, manually in a Command
Prompt DOS window like:  D:\php page.php there are no hangs and the
process performs correctly even during and after the first showing of
the bug.  So the problem seems to be when PHP does an exec call in
conjunction with Apache, as I said even during the time a hang occurs I
can still exec passthru commands from a command prompt.



I can also run any page that calls PHP as long as the page does not have
any exec or passthru calls in it, and all pages with HTML only runs fine
as well during the hang period.

------------------------------------------------------------------------
[2009-02-26 15:14:32] frase at cs dot wisc dot edu

This is happening to me as well, PHP 5.2.8, Apache 2.2.11, Windows 2000
Pro SP4.



However, it only seems to happen when PHP is configured as an Apache
module (php5apache2_2.dll); when I configure it as CGI, it works fine.



I also have anecdotal evidence that it's related somehow to other
sockets being open on the system.  In my case, we have a VB (compiled)
application with an embedded IE control, and also opens the serial port
to communicate with some hardware.  If that hardware is plugged in (and
PHP is loaded as a module), then our scripts hang at 'exec("ping -n 1
somehost")'.  If I unplug the hardware (so the serial port can't be
opened), it works.

------------------------------------------------------------------------
[2009-02-17 10:12:38] russell_anam at hotmail dot com

I can indeed confirm that this bug exists in the latest PHP version (PHP
5.2.8). exec() would randomly hang the Apache and the only solution was
to restart the whole server (service restart did not help). I can also
confirm that vlabella's solution INDEED worked for us. Since this
workaround works I think it's safe to say this is indeed a PHP bug that
needs to be fixed ASAP.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    http://bugs.php.net/bug.php?id=44942


-- 
Edit this bug report at http://bugs.php.net/bug.php?id=44942&edit=1

Reply via email to