Here's my command:
sudo /usr/local/bin/jpegoptim --max=50 /home/someuser/public_html/reports/images/r121662.jpg
This command is supposed to compress an image. I tried running this command using backtick operator and shell_exec, neither will work. The file doesn't compress.
But this command runs when I run it directly in the shell logged in as someuser
. I've modified sudoers
to accept the command without requiring a password. The file is compressed when I run it in the shell.
Apache is configured to run with suPHP, and the PHP files belong to someuser
as well. I've further ensured this by writing a test php script just saying system(id);
and running it in the browser. That tells me that the script is indeed being run by someuser
.
Also, safe_mode is off.
EDIT: Ok, I got it to output the error
sudo: sorry, you must have a tty to run sudo
Now, what does it mean?!