I have an apache web server under OSX and an installed and configured ImageMagick. If I try to execute some ImageMagick command from the terminal, it works fine, but if I try to do that with exec or shell_exec from PHP, it doesn't work.
That is what I do: I set the environment variable:
apache_setenv("PATH", "/etc/ImageMagick-6.8.1/bin:".apache_getenv("PATH"));
and try to execute some command:
exec('convert -version', $imgkOut);
the $imgkOut array is always empty.
I tried to set both paths: 'convert ...' and '/etc/ImageMagick-6.8.1/bin/convert ...' - nothing helps.
In the apache log file I found these errors:
sh: convert: command not found
for the first case, and this:
sh: /etc/ImageMagick-6.8.1/bin/convert: Permission denied
for the second.
What do I do wrong?
The errors you are getting imply that:
If you do
cd /etc/ImageMagick-6.8.1/bin
chmod +x convert
and try again with the second version, where you supply the complete path, it should work.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.