Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with proc_* functions and PHP '--enable-sigchild' configure command option #58

Open
maxguru opened this issue Sep 14, 2021 · 3 comments

Comments

@maxguru
Copy link

maxguru commented Sep 14, 2021

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.

@mikehaertl
Copy link
Owner

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.

@maxguru
Copy link
Author

maxguru commented Sep 15, 2021

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.

@mikehaertl
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants