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

From: Date: Mon, 24 Sep 2012 08:28:46 +0000
Subject: Bug #44942 [Com]: exec() hangs apache
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-173676@lists.php.net to get a copy of this message
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:

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


Previous Comments:
------------------------------------------------------------------------
[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.

------------------------------------------------------------------------
[2011-01-18 09:50:07] pajoye@php.net

See #44994

------------------------------------------------------------------------
[2010-09-07 00:13:10] richard at dlconsulting dot com

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 <script
type="text/javascript">window.opener.location.reload();</script>
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 . . .)

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


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


Thread (43 messages)

« previous php.bugs (#173676) next »