Q:

php shell_Exec not working while the command works in shell

I have to use imagemagick convert command from php. So I'm using shell_exec but the output of that is null string. I know that the command convert doesn't print anyting on STDOUT but the desired output of convert is also not achieved. also exec doesn't work. these commands run fine from shell or from php command line. What can be the issue?
EDIT :adding the 2>&1, I learn that convert is throwing an error : missing an image filename/a5d98168a524a331c5e06d60096debd63cbdce1f.jpg' @ error/convert.c/ConvertImageCommand/2970.where the full command isconvert /var/www/weblog/web/uploads/poster/a5d98168a524a331c5e06d60096debd63cbdce1f.png /var/www/weblog/web/uploads/poster/a5d98168a524a331c5e06d60096debd63cbdce1f.jpg`. 

A:

The user that Apache is using in linux is called www-data, you have to make sure that that user has permission to work with the files and commands you use. You can either use chmod to change the file permissions or chown to change the file/dir owners to www-data. 

