2012-01-10 80 views
1

我必须使用imagemagickconvert命令从PHP。所以我使用shell_exec,但输出是空字符串。我知道命令convert不会在STDOUT上打印任何内容,但是convert的期望输出也没有实现。 exec也不起作用。这些命令可以在shell或php命令行下正常运行。可能是什么问题?php shell_Exec不工作而命令在shell中工作

EDIT:添加2> & 1,I得知转换抛出一个错误:missing an image filename /a5d98168a524a331c5e06d60096debd63cbdce1f.jpg” @错误/ convert.c/ConvertImageCommand/2970。 where the full command is convert /var/www/weblog/web/uploads/poster/a5d98168a524a331c5e06d60096debd63cbdce1f.png/var/www/weblog/web/uploads/poster/a5d98168a524a331c5e06d60096debd63cbdce1f.jpg`。

+0

在命令后面查看'error.log'或添加'2>&1'。 – mario 2012-01-10 18:29:17

+0

@mario:我已更新问题 – prongs 2012-01-10 18:31:29

+0

检查应用程序对目录具有写入权限。 – 2012-01-10 18:35:34

回答

0

Apache在Linux中使用的用户名为www-data,您必须确保该用户有权使用您使用的文件和命令。您可以使用chmod来更改文件权限,或者使用chown将文件/目录所有者更改为www-data。

相关问题