ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-dev
php-dev
#44942 [Fbk->Opn]: exec() hangs apache
by Inqualab1985 At Gmail Dot Com other posts by this author
May 14 2008 1:00AM messages near this date
#44942 [Com]: exec() hangs apache | #44942 [Opn->Fbk]: exec() hangs apache
ID:               44942
 User updated by:  inqualab1985 at gmail dot com
 Reported By:      inqualab1985 at gmail dot com
-Status:           Feedback
+Status:           Open
 Bug Type:         Program Execution
 Operating System: Microsoft Window 2000 SP4
 PHP Version:      5.2.5
 New Comment:

Dear Jani

There is no problem with 'sample.exe'. I have tested the same for
different exe or even for dos command. It hangs when we are calling the
page at regular interval of time (through Ajax).

There is a problem in the definition of exec() function.

For any further information , feel free to contact me.


Previous Comments:
------------------------------------------------------------------------

[2008-05-09 14:20:40] jani@[...].net

What exactly does this "sample.exe" do? It's most likely not any PHP
problem at all anyway, you just call some exe that "hangs" itself..

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

[2008-05-08 05:40:53] inqualab1985 at gmail dot com

Description:
------------
Hi! PHP Team

I am facing a problem of apache hang up due to exec() function.

I am using PHP 5.2.5 and Apache 2.2 on MS Window 2000 SP4 & also on MS
Window XP.

The problem is that I have to execute a exe, for which I have use
exec(). Normally it works Fine, but sometime (randomly) it hang up. It
will lock the apache and if we call the same page or any other page of
php having exec(), it hang up at the line where exec() function is used.
If we commented the line having exec(), then the page run & loaded
correctly.

The problem also become critical because there is no error for this.
Also none of the error handling & logging mechanism works.

The only solution to this problem is to restart the Apache.

I am providing you as much as information as possible to catch the
problem correctly.
 

Reproduce code:
---------------
$exeFilePath = realpath("../sample.exe");       

if (eregi("win", PHP_OS))
        $command = "\"\"$exeFilePath\" argument1\"";
else
        $command = "\"$exeFilePath\" argument1";
        
$output = null;
$returnVal = null;
$result = exec($command,$output,$returnVal);
if($returnVal !=0)
   echo "Error";
else
   echo $output[0];

echo "end of the program";

Expected result:
----------------
it will show the output of exe for particular argument. 

Actual result:
--------------
Normally it works correctly as expected but sometime the the execution
of the page hang at line "$result = exec($command,$output,$returnVal);" 
. After this has happen I am not able to run any script that will use
the exec(). In all scripts apache hangs at exec() function, do not
matter  which exe will be called. 


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


-- 
Edit this bug report at http://bugs.php.net/?id=44942&edit=1
Thread:
Inqualab1985 At Gmail Dot Com
Dominic Dot Manley At Det Dot Wa Dot Edu Dot Au
Neododge At Free Dot Fr
Vlabella At Uamail Dot Albany Dot Edu
Jumpbackhack At Gmail Dot Com
jani
Lk At Profline Dot Ch
Lk At Profline Dot Ch
Inqualab1985 At Gmail Dot Com
Markus At Opahle Dot Com
Aleaddict At Yahoo Dot Com
Inqualab1985 At Gmail Dot Com
jani

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved