I have a php program that prompts the user for a number of parameters which then using those parameters must execute a batch shell script. I've got this functioning using:

$cmd =  "echo \"podcast -c $TCname\" | at $_stimehr:$_stimemn $_sdate";

exec("$cmd", $_RetVal);

This gets queued and even runs. But I believe I have a permissions issue that I can't seem to conquer.

My apache2 runs as user www-data and I've made sure that the shell script is executable by everyone and also my working directory tree currently set to 777 (temporarily until I figure this out). And it still starts then fails without any error messages and I've got logging on to the wazoo! No errors. It appears to stop when trying to change directories.

  • What exactly is failing? (I gather it's not the code you've shown, so I'm a bit puzzled as to how we could help you.)
    – Mat
    Feb 28, 2012 at 20:32

1 Answer 1


Whenever I have this type of problem, I give www-data a shell in /etc/passwd. You can change it back to nologin once your finished testing.

Then I su - www-data, and manually attempt to execute the script. If your having problems related to permissions, this should help you narrow the scope. Running shell scripts form php, can occasionally yield unexpected results.

You must log in to answer this question.

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