1

I have a script which is called from php using the shell_exec command on a server running Ubuntu. The script runs properly when called from the command line via ssh, but not when called from php.

I'm having a really hard time figuring out where it is going wrong and I was wondering if there was a way to run the script from the ssh command line but with the same user account and permissions that php shell_exec will call it with.

Thank you.

1 Answer 1

3

Assuming the php user is www-data:

sudo -u www-data /path/to/script

The environment may be different but that probably does not matter.

1
  • Thank you! You just saved me hours of trying to find out what was going (a permissions issue)
    – Bar Smith
    Mar 20, 2018 at 21:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .