Bug #44942 [Com]: exec() hangs apache

2012-12-05 Thread claudix dot kernel at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=44942&edit=1

 ID: 44942
 Comment by: claudix dot kernel at gmail dot com
 Reported by:inqualab1985 at gmail dot com
 Summary:exec() hangs apache
 Status: Duplicate
 Type:   Bug
 Package:Program Execution
 Operating System:   Windows 2000 SP4
 PHP Version:5.2.5
 Block user comment: N
 Private report: N

 New Comment:

Seen the same behavior, not only in exec(), but also in similar functions as 
proc_open/proc_close. When there are concurrent scripts during a same PHP 
session, the script spawning the process randomly hangs.
System:
- Windows 2003 server SP2
- Apache 2.2.22/ PHP 5.4.3

I can confirm that calling session_write_close() and then session_start() does 
the trick. 

I've observed, though, that the code below doesn't work:

$proc = proc_open($cmd,$pipedesc,$pipes);
//do stuff with pipes... 
//... and close pipes
session_write_close();  //Close session before hanging function
$retval = proc_close($proc);
session_start(); //restore session

But the code below *does* work:

session_write_close();  //Close the session before proc_open()
$proc = proc_open($cmd,$pipedesc,$pipes);
//do stuff with pipes... 
//... and close pipes
$retval = proc_close($proc);
session_start(); //restore session

This made me go into the PHP source code (actually the source file 
"proc_open.c"). I've noticed that the command passed to proc_open() is spawned 
by calling the WINAPI function CreateProcess(...) with the parameter 
"bInheritHandles" set to TRUE. As of MSDN documentation, if this parameter is 
TRUE then all handles are inherited by the child process. It seems that the 
handle of the session is being inherited by the child process but for some 
reason the OS doesn't release it when the process ends, eventually yielding a 
deadlock. The code snippets above show this: the session has to be closed 
before calling proc_open() to prevent the spawned command from inheriting the 
session handle. People using exec() cannot see this effect because exec() 
virtually embeds proc_open/proc_close.

May this give a clue to PHP developers?

Claudi


Previous Comments:

[2012-10-15 15:00:52] mail at GerhardBechtold dot com

Pajoye,

I didn't find any documentation on the service sensitivity of the new PHP.

You might be right, that the eof of the console stream is not taken care 
properly, but in my case the system is now working (again).


[2012-10-15 09:12:30] paj...@php.net

@mail at GerhardBechtold dot com

this is documented, the shell/exec permissions have to be given.

However I do not think it is related to the original issue which is caused by a 
real bug in the php stream, where the eof of the console stream is not 
correctly 
detected and ends in an endless loop.


[2012-10-14 15:28:38] mail at GerhardBechtold dot com

After many hours of testing, I managed to solve my problem of exec() calls in 
PHP. This might be useful also for other developers, as I have seen many 
struggling with te same problem.

1. xampp must be installed in real (!) administrator mode (in Windows 7 / 32 & 
64 bit). 

2. In many environments, Apache and MySQL should not run as services, but be 
manually started (even not with interaction with desktop).

I have put a step-by-step procedure to troubleshoot at:

http://www.gerhardbechtold.com/LUPMIS/Manual/a15_xamppmap_maker_installation.html

(Ignore the references to our system LUPMIS).

Good luck to everybody 
Gerhard


[2012-09-27 21:02:13] mail at GerhardBechtold dot com

Thanks for looking into my problems with exec() at the latest PHP.

Example for actual code, as in application (was running nicely in earlier PHP 
installations, but not under PHP 2.4 anymore):

$str1Name = "C:\Map Maker\MMmacro.exe"; 
$str2Name = "command=remove layer"; 
exec(chr(34).$str1Name.chr(34).chr(32).chr(34).$str2Name.chr(34));

I am using a GIS called Map Maker, with powerful MMmacro functions 
(www.mapmaker.com). 'remove layer' is one of the most basic parameters of 
MMmacro.

A more simple test version also failed:

$str1Name = "C:\Windows\Notepad.exe";
exec($str1Name);

I also tested, all without success:
- with bat file, which then calls notepad.exe
- with exe/bat in different folders: document root (C:\xampp\htdocs) or from 
calling directory (C:\xampp\htdocs\lupmis_s)
- with 'start .'
- with popen
- with exec(  < file.in > file.out 2> nul", $output);
- with exec(,$output, $return);
- with exec("ping google.com", $output, $return);

-

My environment:

PHP 5.4.4 (VC 9)
Apache 2.4

Bug #44942 [Com]: exec() hangs apache

2012-10-15 Thread mail at GerhardBechtold dot com
Edit report at https://bugs.php.net/bug.php?id=44942&edit=1

 ID: 44942
 Comment by: mail at GerhardBechtold dot com
 Reported by:inqualab1985 at gmail dot com
 Summary:exec() hangs apache
 Status: Duplicate
 Type:   Bug
 Package:Program Execution
 Operating System:   Windows 2000 SP4
 PHP Version:5.2.5
 Block user comment: N
 Private report: N

 New Comment:

Pajoye,

I didn't find any documentation on the service sensitivity of the new PHP.

You might be right, that the eof of the console stream is not taken care 
properly, but in my case the system is now working (again).


Previous Comments:

[2012-10-15 09:12:30] paj...@php.net

@mail at GerhardBechtold dot com

this is documented, the shell/exec permissions have to be given.

However I do not think it is related to the original issue which is caused by a 
real bug in the php stream, where the eof of the console stream is not 
correctly 
detected and ends in an endless loop.


[2012-10-14 15:28:38] mail at GerhardBechtold dot com

After many hours of testing, I managed to solve my problem of exec() calls in 
PHP. This might be useful also for other developers, as I have seen many 
struggling with te same problem.

1. xampp must be installed in real (!) administrator mode (in Windows 7 / 32 & 
64 bit). 

2. In many environments, Apache and MySQL should not run as services, but be 
manually started (even not with interaction with desktop).

I have put a step-by-step procedure to troubleshoot at:

http://www.gerhardbechtold.com/LUPMIS/Manual/a15_xamppmap_maker_installation.html

(Ignore the references to our system LUPMIS).

Good luck to everybody 
Gerhard


[2012-09-27 21:02:13] mail at GerhardBechtold dot com

Thanks for looking into my problems with exec() at the latest PHP.

Example for actual code, as in application (was running nicely in earlier PHP 
installations, but not under PHP 2.4 anymore):

$str1Name = "C:\Map Maker\MMmacro.exe"; 
$str2Name = "command=remove layer"; 
exec(chr(34).$str1Name.chr(34).chr(32).chr(34).$str2Name.chr(34));

I am using a GIS called Map Maker, with powerful MMmacro functions 
(www.mapmaker.com). 'remove layer' is one of the most basic parameters of 
MMmacro.

A more simple test version also failed:

$str1Name = "C:\Windows\Notepad.exe";
exec($str1Name);

I also tested, all without success:
- with bat file, which then calls notepad.exe
- with exe/bat in different folders: document root (C:\xampp\htdocs) or from 
calling directory (C:\xampp\htdocs\lupmis_s)
- with 'start .'
- with popen
- with exec(  < file.in > file.out 2> nul", $output);
- with exec(,$output, $return);
- with exec("ping google.com", $output, $return);

-

My environment:

PHP 5.4.4 (VC 9)
Apache 2.4.2
Xampp 'default' installation 1.8 on C:\xampp
Apache with PHP, MySQL running as services

Win 7 Home Premium / 64 bit
4 GB RAM
HP Pavilion g7 Notebook
Bought in Germany, but OS and all programs installed in English
Running as administrator

Total application has > 220 PHP programs, with > 250 exec calls. 

If you give me your full email address, I can also send you the php.ini and 
httpd.conf.

Thanks for any advice
Gerhard


[2012-09-27 10:51:24] paj...@php.net

Tell us which command you use and how you call it, along with the parameters 
(external files and the likes can be sent to my email (my handle @ php.net).


[2012-09-27 10:39:33] mail at Gerhard-Bechtold dot com

Thanks for follow-up. Where can I send it to?
Regards
Gerhard




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

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


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


Bug #44942 [Com]: exec() hangs apache

2012-10-14 Thread mail at GerhardBechtold dot com
Edit report at https://bugs.php.net/bug.php?id=44942&edit=1

 ID: 44942
 Comment by: mail at GerhardBechtold dot com
 Reported by:inqualab1985 at gmail dot com
 Summary:exec() hangs apache
 Status: Duplicate
 Type:   Bug
 Package:Program Execution
 Operating System:   Windows 2000 SP4
 PHP Version:5.2.5
 Block user comment: N
 Private report: N

 New Comment:

After many hours of testing, I managed to solve my problem of exec() calls in 
PHP. This might be useful also for other developers, as I have seen many 
struggling with te same problem.

1. xampp must be installed in real (!) administrator mode (in Windows 7 / 32 & 
64 bit). 

2. In many environments, Apache and MySQL should not run as services, but be 
manually started (even not with interaction with desktop).

I have put a step-by-step procedure to troubleshoot at:

http://www.gerhardbechtold.com/LUPMIS/Manual/a15_xamppmap_maker_installation.html

(Ignore the references to our system LUPMIS).

Good luck to everybody 
Gerhard


Previous Comments:

[2012-09-27 21:02:13] mail at GerhardBechtold dot com

Thanks for looking into my problems with exec() at the latest PHP.

Example for actual code, as in application (was running nicely in earlier PHP 
installations, but not under PHP 2.4 anymore):

$str1Name = "C:\Map Maker\MMmacro.exe"; 
$str2Name = "command=remove layer"; 
exec(chr(34).$str1Name.chr(34).chr(32).chr(34).$str2Name.chr(34));

I am using a GIS called Map Maker, with powerful MMmacro functions 
(www.mapmaker.com). 'remove layer' is one of the most basic parameters of 
MMmacro.

A more simple test version also failed:

$str1Name = "C:\Windows\Notepad.exe";
exec($str1Name);

I also tested, all without success:
- with bat file, which then calls notepad.exe
- with exe/bat in different folders: document root (C:\xampp\htdocs) or from 
calling directory (C:\xampp\htdocs\lupmis_s)
- with 'start .'
- with popen
- with exec(  < file.in > file.out 2> nul", $output);
- with exec(,$output, $return);
- with exec("ping google.com", $output, $return);

-

My environment:

PHP 5.4.4 (VC 9)
Apache 2.4.2
Xampp 'default' installation 1.8 on C:\xampp
Apache with PHP, MySQL running as services

Win 7 Home Premium / 64 bit
4 GB RAM
HP Pavilion g7 Notebook
Bought in Germany, but OS and all programs installed in English
Running as administrator

Total application has > 220 PHP programs, with > 250 exec calls. 

If you give me your full email address, I can also send you the php.ini and 
httpd.conf.

Thanks for any advice
Gerhard


[2012-09-27 10:51:24] paj...@php.net

Tell us which command you use and how you call it, along with the parameters 
(external files and the likes can be sent to my email (my handle @ php.net).


[2012-09-27 10:39:33] mail at Gerhard-Bechtold dot com

Thanks for follow-up. Where can I send it to?
Regards
Gerhard


[2012-09-27 06:57:05] paj...@php.net

We need something to reproduce it, as we can't.

Do you have a common exe app that we can use to try to reproduce the problem 
you 
are experiencing?


[2012-09-24 08:28:46] mail at GerhardBechtold dot com

Despite various updates and fixes, I dont think, the 'exec problem' in PHP is 
solved.

In my PHP programs, I have plenty of calls from PHP 5.3.0 to external exe files 
with 'exec(...)' (on local drive, with Apache 2.2.12, installed through xampp 
1.7.x, on Vista and Win 7) on dozens of computers: Everything works well.

But when I migrated to new computer with PHP 5.4.4 (VC9, with Apache 2.4.2, 
installed through xampp 1.8, on Win 7/64), the SAME exec() calls dont work 
anymore. No display, no error messages, no entries in log file. Configuration 
in httpd.conf and php.ini are identical.

Any advice is appreciated. I also posted in xampp forum 
(http://www.apachefriends.org/f/viewtopic.php?f=6&t=51537, with confirmation, 
that I am not the only one with this problem).

Kind regards
Gerhard




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

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


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


Bug #44942 [Com]: exec() hangs apache

2012-09-27 Thread mail at GerhardBechtold dot com
Edit report at https://bugs.php.net/bug.php?id=44942&edit=1

 ID: 44942
 Comment by: mail at GerhardBechtold dot com
 Reported by:inqualab1985 at gmail dot com
 Summary:exec() hangs apache
 Status: Duplicate
 Type:   Bug
 Package:Program Execution
 Operating System:   Windows 2000 SP4
 PHP Version:5.2.5
 Block user comment: N
 Private report: N

 New Comment:

Thanks for looking into my problems with exec() at the latest PHP.

Example for actual code, as in application (was running nicely in earlier PHP 
installations, but not under PHP 2.4 anymore):

$str1Name = "C:\Map Maker\MMmacro.exe"; 
$str2Name = "command=remove layer"; 
exec(chr(34).$str1Name.chr(34).chr(32).chr(34).$str2Name.chr(34));

I am using a GIS called Map Maker, with powerful MMmacro functions 
(www.mapmaker.com). 'remove layer' is one of the most basic parameters of 
MMmacro.

A more simple test version also failed:

$str1Name = "C:\Windows\Notepad.exe";
exec($str1Name);

I also tested, all without success:
- with bat file, which then calls notepad.exe
- with exe/bat in different folders: document root (C:\xampp\htdocs) or from 
calling directory (C:\xampp\htdocs\lupmis_s)
- with 'start .'
- with popen
- with exec(  < file.in > file.out 2> nul", $output);
- with exec(,$output, $return);
- with exec("ping google.com", $output, $return);

-

My environment:

PHP 5.4.4 (VC 9)
Apache 2.4.2
Xampp 'default' installation 1.8 on C:\xampp
Apache with PHP, MySQL running as services

Win 7 Home Premium / 64 bit
4 GB RAM
HP Pavilion g7 Notebook
Bought in Germany, but OS and all programs installed in English
Running as administrator

Total application has > 220 PHP programs, with > 250 exec calls. 

If you give me your full email address, I can also send you the php.ini and 
httpd.conf.

Thanks for any advice
Gerhard


Previous Comments:

[2012-09-27 10:51:24] paj...@php.net

Tell us which command you use and how you call it, along with the parameters 
(external files and the likes can be sent to my email (my handle @ php.net).


[2012-09-27 10:39:33] mail at Gerhard-Bechtold dot com

Thanks for follow-up. Where can I send it to?
Regards
Gerhard


[2012-09-27 06:57:05] paj...@php.net

We need something to reproduce it, as we can't.

Do you have a common exe app that we can use to try to reproduce the problem 
you 
are experiencing?


[2012-09-24 08:28:46] mail at GerhardBechtold dot com

Despite various updates and fixes, I dont think, the 'exec problem' in PHP is 
solved.

In my PHP programs, I have plenty of calls from PHP 5.3.0 to external exe files 
with 'exec(...)' (on local drive, with Apache 2.2.12, installed through xampp 
1.7.x, on Vista and Win 7) on dozens of computers: Everything works well.

But when I migrated to new computer with PHP 5.4.4 (VC9, with Apache 2.4.2, 
installed through xampp 1.8, on Win 7/64), the SAME exec() calls dont work 
anymore. No display, no error messages, no entries in log file. Configuration 
in httpd.conf and php.ini are identical.

Any advice is appreciated. I also posted in xampp forum 
(http://www.apachefriends.org/f/viewtopic.php?f=6&t=51537, with confirmation, 
that I am not the only one with this problem).

Kind regards
Gerhard


[2012-06-04 05:09:12] hshs at hotmail dot com

This bug still exist. Same work around still works.




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

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


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


Bug #44942 [Com]: exec() hangs apache

2012-09-27 Thread mail at Gerhard-Bechtold dot com
Edit report at https://bugs.php.net/bug.php?id=44942&edit=1

 ID: 44942
 Comment by: mail at Gerhard-Bechtold dot com
 Reported by:inqualab1985 at gmail dot com
 Summary:exec() hangs apache
 Status: Duplicate
 Type:   Bug
 Package:Program Execution
 Operating System:   Windows 2000 SP4
 PHP Version:5.2.5
 Block user comment: N
 Private report: N

 New Comment:

Thanks for follow-up. Where can I send it to?
Regards
Gerhard


Previous Comments:

[2012-09-27 06:57:05] paj...@php.net

We need something to reproduce it, as we can't.

Do you have a common exe app that we can use to try to reproduce the problem 
you 
are experiencing?


[2012-09-24 08:28:46] mail at GerhardBechtold dot com

Despite various updates and fixes, I dont think, the 'exec problem' in PHP is 
solved.

In my PHP programs, I have plenty of calls from PHP 5.3.0 to external exe files 
with 'exec(...)' (on local drive, with Apache 2.2.12, installed through xampp 
1.7.x, on Vista and Win 7) on dozens of computers: Everything works well.

But when I migrated to new computer with PHP 5.4.4 (VC9, with Apache 2.4.2, 
installed through xampp 1.8, on Win 7/64), the SAME exec() calls dont work 
anymore. No display, no error messages, no entries in log file. Configuration 
in httpd.conf and php.ini are identical.

Any advice is appreciated. I also posted in xampp forum 
(http://www.apachefriends.org/f/viewtopic.php?f=6&t=51537, with confirmation, 
that I am not the only one with this problem).

Kind regards
Gerhard


[2012-06-04 05:09:12] hshs at hotmail dot com

This bug still exist. Same work around still works.


[2011-10-23 19:26:33] kevin at texasbb dot com

Happening to me on windows server 08 using IIS

session_write_close(); doesnt seem to work for me.
but i can use a page with iframes and eatch iframe can have a php with exec()
and all work.
i tested 10 different php iframes and could see all 10 processes open when page 
was loading.
when adding just 2 exec() calls on same script or even trying to use different 
php files called from 1 will freeze the second process from exec

just throwin this out there to help solve this

so iframes can call any number it seems but
more than 1 in same php script will hang on SECOND process(no need to reset 
server just kill the process and output from first will be there but second 
will 
not and page will finish loading).


[2011-10-10 15:30:00] jameslively at insightbb dot com

I am still seeing this issue on PHP 5.3.8.  I am running the site on Windows 
2k3 sp3 and Apache 2.2.




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

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


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


Bug #44942 [Com]: exec() hangs apache

2010-09-06 Thread richard at dlconsulting dot com
Edit report at http://bugs.php.net/bug.php?id=44942&edit=1

 ID: 44942
 Comment by: richard at dlconsulting dot com
 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
 Block user comment: N

 New Comment:

Had a similar problem which was reproducible on Apache 1.3.26 and PHP
5.2.14 or PHP 5.3.3, (Apache running on Windows XP SP3). Reproducable
when using Firefox 3.6.8, Chrome 5.0.375.127, IE 8.0.6001.18702
Interestingly, when the same PHP based system was running on linux
(Centos 5.5) this problem could not be reproduced.



A parent browser window opens a child popup to perform an import process
of some files into a system. The child popup window is running a PHP
script which as part of its process calls an external binaries such as
rm.exe or unzip.exe binary using the exec function.



As part of the html in the child popup window, we call a javascript
function with window.opener.location.reload();

which reloads the parent window (which is also generated via PHP).



When this bug occurs, the JavaScript above is near the top of the web
page, so that it seems to trigger a reload of the parent PHP script
during the child popup PHP process, and apparently this interferes
somehow with the execution of the child popup PHP process, because when
we tried moving this JavaScript to the bottom of the popup PHP process
webpage . . the problem goes away.



This problem, which seems somehow related to the concurrent execution of
the PHP of the parent browser window, hangs Apache completely. Apache
has to be terminated manually, and then restarted. Therefore this bug
was a showstopper until we happened upon a work-around.



If we remove calls to exec() in the child popup PHP script, the problem
disappears. The duration of the child popup PHP script is not trivial,
it might unzip / read / move maybe 50 files (although on fast hardware
this might take less than a second anyway . . .)


Previous Comments:

[2010-09-06 14:53:26] elwiz at 3e dot pl

Hello.



I am also having the same problem. One of my scripts is being called
multiple times (as a SRC for image tags) and each time it uses the exec
function. On windows XP, with PHP 5.2.5 and Apache 2.2 the PHP stops
responding. Requests for static files can be done but PHP scripts run
endlessly. Session closing and opening helps but it is still just a
workaround.


[2010-07-25 21:00:18] andy dot hilbig at clubsys dot co dot uk

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 ???


[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 send

Bug #44942 [Com]: exec() hangs apache

2010-09-06 Thread elwiz at 3e dot pl
Edit report at http://bugs.php.net/bug.php?id=44942&edit=1

 ID: 44942
 Comment by: elwiz at 3e dot pl
 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
 Block user comment: N

 New Comment:

Hello.



I am also having the same problem. One of my scripts is being called
multiple times (as a SRC for image tags) and each time it uses the exec
function. On windows XP, with PHP 5.2.5 and Apache 2.2 the PHP stops
responding. Requests for static files can be done but PHP scripts run
endlessly. Session closing and opening helps but it is still just a
workaround.


Previous Comments:

[2010-07-25 21:00:18] andy dot hilbig at clubsys dot co dot uk

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 ???


[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.




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

Bug #44942 [Com]: exec() hangs apache

2010-07-25 Thread andy dot hilbig at clubsys dot co dot uk
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 th