Running convert under apache user account
Posted: 2014-09-10T00:02:58-07:00
Hello,
First my conf :
FreeBSD 10.0 Stable
ImageMagick-nox11-6.8.9.4
apache24-2.4.10
Imagick 3.1.2
PHP 5.4.32
I try to use ImageMagick to dynamically create thumbnail of PDF file.
After a lot of test, I think there is a problem from within convert.
I just try to convert file with this command :
$cmd=sprintf('/usr/local/bin/convert "%s[0]" jpg:-',$file,$target);
$ret=exec($cmd,$out,$retvar);
With php command line it's ok. (As root or as normal user)
But when I browse the php file. Nothing is done, output var are empty and status returned is 0.
So I try with a sudo, same result like this :
$cmd=sprintf('/usr/local/bin/sudo /usr/local/bin/convert "%s[0]" jpg:-',$file,$target);
$ret=exec($cmd,$out,$retvar);
Is there any kind of protection within convert that prevent running under special context ?
Thanks for help.
First my conf :
FreeBSD 10.0 Stable
ImageMagick-nox11-6.8.9.4
apache24-2.4.10
Imagick 3.1.2
PHP 5.4.32
I try to use ImageMagick to dynamically create thumbnail of PDF file.
After a lot of test, I think there is a problem from within convert.
I just try to convert file with this command :
$cmd=sprintf('/usr/local/bin/convert "%s[0]" jpg:-',$file,$target);
$ret=exec($cmd,$out,$retvar);
With php command line it's ok. (As root or as normal user)
But when I browse the php file. Nothing is done, output var are empty and status returned is 0.
So I try with a sudo, same result like this :
$cmd=sprintf('/usr/local/bin/sudo /usr/local/bin/convert "%s[0]" jpg:-',$file,$target);
$ret=exec($cmd,$out,$retvar);
Is there any kind of protection within convert that prevent running under special context ?
Thanks for help.