【问题标题】:Blender not running when called using php shell_exec()使用 php shell_exec() 调用时,Blender 未运行
【发布时间】:2020-09-04 08:33:35
【问题描述】:

Blender (2.80) 安装在 AWS 上的 /home/ec2-user 目录中。

php 在 /var/www/html/wed 的同一台服务器上运行

我可以通过 cli 访问:

wed]$ ls /home/ec2-user

列出 /home/ec2-user 的内容。

并通过php访问:

<?php<br />
$output = shell_exec('ls /home/ec2-user'); 
echo "<pre>$output</pre>"; 
?>

列出 /home/ec2-user 的内容。

我可以通过 cli 运行 Blender:

wed]$ /home/ec2-user/blender280/blender -b -noaudio proj007/font-sample.blend --python proj007/font-samples.py

运行搅拌机脚本 (proj007/font-samples.py) 并将 663 个 png 文件输出到 /var/www/html/wed/fonts。

但不是通过php:

<?php
$output = shell_exec('/home/ec2-user/blender280/blender -b -noaudio proj007/font-sample.blend --python proj007/font-samples.py'); 
echo "<pre>$output</pre>"; 
?>

什么都没有。

命令被复制和粘贴,所以没有错字。

home、ec2-user 和 blender280 的权限设置为允许读取和执行。

这可能是 Apache 的问题吗?

【问题讨论】:

  • 您确定 apache 用户(通常是 www-data)有权将内容写入您假设 blender 输出其文件的目录吗?
  • 用户具有读取和执行权限。我不需要在那个目录中写任何东西。
  • 您在问题中写下:并将 663 个 png 文件输出到/var/www/html/wed/fonts。这似乎确实需要在某处具有写入权限?
  • 文件被写入 /var/www/html/wed/fonts。我知道 apache 对该目录有写权限。

标签: php apache amazon-ec2 blender shell-exec


【解决方案1】:

原来我需要 php-fpm。事实证明,我无法让 php-fpm 使用 Amazon Linux 在 AWS 上工作。使用 Ubuntu 将所有东西都切换到 AWS(大约一天半的项目),一切都很好。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-23
    相关资源
    最近更新 更多