phpapachepermissionsexec

php exec inside exec / nested exec


If I'm already running code in a background by exec and inside it I call for another exec.

Is it possible ? If so, does it need special permissions ?

The error I have (and I suspect nested exec in it):

exec() has been disabled for security reasons

Regular exec enabled and works.


Solution

  • Technically it's possible to have an exec in your exec, but it looks like you're using different configurations. Usually PHP has to different sets (Apache and CLI) of php.ini files (which might be configured to disable the exec function at all.

    I assume your first exec call is coming from apache, which then calls a php script on the command line. The second seems to have a different configuration and therefore disallow the exec-call. So best have a look at /etc/php, if there are different php.inis set.