Alex Kalmikov
Alex Kalmikov

Reputation: 2183

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.

Upvotes: 0

Views: 364

Answers (2)

Leandro Papasidero
Leandro Papasidero

Reputation: 3738

Can you please share your code.... It is difficult to determinate if there is any problem without looking the code. If you have access to use exec it should not be a problem to use exec inside another exec. This is your localhost or a shared hosting? Most shared hosting disable exec for security reasons.

Upvotes: 0

Tobias
Tobias

Reputation: 1682

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.

Upvotes: 1

Related Questions