【发布时间】:2015-01-28 14:22:51
【问题描述】:
我需要在运行雪豹的 Mac 上运行 apache 作为 localhost 的 php 文件中通过 shell_exec 执行 ImageMagick 的 convert。我已经尝试了从这里的大量问题和解决方案中获得的各种提示、技巧、编辑和权限。但似乎没有什么能解决问题。下面的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.
【问题讨论】:
标签: php macos permissions