Jump to content


This topic is now archived and is closed to further replies.


php exec(), system(), passthru(), shell_exec() and posix_kill hangs

Recommended Posts

I am new to php and have a problem with the following php commads.

exec(), system(), passthru(), shell_exec(). These commands when executed always left a  defunct process.  Then when I reconfigured php with --enable-sigchild option it was better as now it does not leave a defunct process always..... but mosttimes we still get defunct process.

I wrote code to kill defunct process. The code executes correctly. The defunct process also gets killed but later the page is not displayed.  Looks like php hangs.

exec("/bin/kill -9 $ppid";);
system("/bin/kill -9 $ppid /dev/null/ 2>&1 &");
passthru(kill -9 $ppid &);
shell_exec(bin/kill -9 $ppid &);

Also tried
posix_kill($ppid, 1);

where $ppid is parent process id.

Is there any conifuration options that I should use or any php.ini parameters that I should change. Please help me with this query. We are using PHP with apache.

The configure option is as mentioned below.
'./configure' '--with-apxs=/usr/local/apache/bin/apxs' '--with-mm=/usr/local' '--enable-sigchild' '--enable-force-cgi-redirect' '--enable-discard-path' '--enable-fastcgi' '--enable-pcntl' '--enable-posix'

Share this post

Link to post
Share on other sites
Got no replies for my query. Please can someone suggest if I am missing any configuration parameters or any php.ini parameters to solve this problem.

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.