php-shellcommand
php-shellcommand copied to clipboard
Issues with proc_* functions and PHP '--enable-sigchild' configure command option
Hi,
It looks like PHP compiled with '--enable-sigchild' will have issues with php-shellcommand
when proc_* functions are used (by default). php-shellcommand
will return an error when the command executes successfully.
The reason is discussed in the following PHP bug reports: https://bugs.php.net/bug.php?id=61873 https://bugs.php.net/bug.php?id=71804
There is no issue when using useExec
option on a system with PHP compiled with '--enable-sigchild'.
There is not much that can be done other than detecting the '--enable-sigchild' configure command option and adding the useExec
option. Unfortunately, there doesn't appear to be any way to do this aside from parsing phpinfo().
Is there any other way to handle this issue?
Thanks.
Hmm, I'm not sure. You seem to have done some investigation. What is --enable-sigchild
for? And is this enabled by default in some major packages (Debian, Alpipne, etc.)? If not I would say we can ignore this here. Unless there is a simple workaround.
The option is listed at https://www.php.net/manual/en/configure.about.php as "Enable PHP's own SIGCHLD handler." I don't know much about it. I think it is used to remedy accumulation of zombie processes.
I'm just letting you know that it seems like php-shellcommand
(without useExec) doesn't work right when --enable-sigchild
option was used to when compiling PHP. Also, I'm asking for possible workaround ideas.
Here is my (dirty hack) workaround:
ob_start();
phpinfo(INFO_GENERAL);
if(strpos(ob_get_clean(), '--enable-sigchild') !== false)
$options['useExec'] = true;
There doesn't seem to be a better way to fix this. If anybody has any better ideas I would appreciate it if they can share them.
Ok, thanks for the update. I don't have a better idea either. I'll leave this open for now, maybe we find a way how to properly fix this.