Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm a sys admin as well as web developer at my job. 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.

Hopefully some other *nix guru who may have run into this before will have a simple answer as I've be struggling and doing trial and error for a couple of months on and off now.

share|improve this question
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 '12 at 20:32

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.