我需要在运行apache的php文件中通过convert
执行Image shell_exec
作为运行雪豹的mac上的localhost。我已尝试过从这里获得的各种问题和解决方案中提供的各种提示,技巧,编辑和权限。但似乎没有什么可以做到的。下面的php文件突出显示了问题:
<?php
echo shell_exec('whoami'); //daemon. I chown-ed convert by daemon
apache_setenv('PATH', '/usr/local/bin:/usr/bin:/bin'); // this works: checked with getenv("PATH");
echo shell_exec('cp /Users/fullpath/file.pdf /Users/fullpath/file.pdf 2>&1'); // this works, so shell_exec works
echo shell_exec('/usr/local/bin/convert /Users/fullpath/file.pdf /Users/fullpath/file.png 2>&1'); // this fails, convert: UnableToCreateTemporaryFile and then convert: NoImagesDefined
?>
我认为这是一个权限问题:但是在哪个文件上?
编辑:完整的错误消息是:
convert: UnableToCreateTemporaryFile `/Users/fullpath/file.pdf': Permission denied @ error/pdf.c/ReadPDFImage/390.
convert: NoImagesDefined `/Users/fullpath/file.png' @ error/convert.c/ConvertImageCommand/3021.
答案 0 :(得分:0)
您正在成功执行convert
,但convert
本身正在返回错误convert: UnableToCreateTemporaryFile and then convert: NoImagesDefined
。