For some strange reason this
echo system("echo 'echo hello > /dev/pts/2' | /usr/bin/at 19:36");
Refuses to work from my php script, however the command works fine when I just enter it through command line.
I know php has permission to execute some commands. I can run ‘ls’ from the php script but not the ‘at’ command. I’ve tried playing around with file permissions, but so far to no avail 🙁
edit
Permissions for /usr/bin/at are:
-rwxr-sr-x 1 daemon daemon 42752 Jan 15 2011 at
I think it’s a permissions problem, if I execute the php file from my ssh terminal it works fine, but not from the web.
What you are executing is
meaning
and pipe stdout to
/usr/bin/at 19:36but since you already redirected the echo to/dev/pts/2, this will be empty. What you probably meant to do is:You might also want to use
shell_execto pass the command through a shell or alternativelyproc_openwhich gives you better control over stdin/out/err of the command you are executing. Your example would correspond to (adapted example from php.net docs):