【问题标题】:php shell_Exec not working while the command works in shellphp shell_Exec 不工作,而命令在 shell 中工作
【发布时间】:2012-01-10 18:23:35
【问题描述】:

我必须使用 php 中的 imagemagick convert 命令。所以我使用shell_exec,但它的输出是空字符串。我知道命令 convert 不会在 STDOUT 上打印任何内容,但也没有达到所需的 convert 输出。 exec 也不起作用。这些命令从 shell 或 php 命令行运行良好。可能是什么问题?

编辑:添加 2>&1,我了解到 convert 会引发错误:missing an image filename/a5d98168a524a331c5e06d60096debd63cbdce1f.jpg'@error/convert.c/ConvertImageCommand /2970.where the full command isconvert /var/www/weblog/web/uploads/poster/a5d98168a524a331c5e06d60096debd63cbdce1f.png /var/www/weblog/web/uploads/poster/a5d98168a524a331c5e06d60096debd63c.jpg

【问题讨论】:

  • 查看error.log或在命令后添加2>&1
  • @mario:我已经更新了问题
  • 检查应用对目录有写权限。

标签: php imagemagick shell-exec


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-05-27
    • 1970-01-01
    • 1970-01-01
    • 2018-06-28
    • 1970-01-01
    • 1970-01-01
    • 2014-05-23
    • 2010-11-09
    相关资源
    最近更新 更多