简体   繁体   English

使用 php shell_exec() 调用时搅拌机未运行

[英]Blender not running when called using php shell_exec()

Blender (2.80) is installed on AWS in directory /home/ec2-user. Blender (2.80) 安装在 AWS 上的 /home/ec2-user 目录中。

php is run on the same server from /var/www/html/wed php 从 /var/www/html/wed 在同一台服务器上运行

I have access through cli:我可以通过 cli 访问:

wed]$ ls /home/ec2-user

Lists contents of /home/ec2-user.列出 /home/ec2-user 的内容。

And access through php:并通过php访问:

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

Lists contents of /home/ec2-user.列出 /home/ec2-user 的内容。

I can run Blender through cli:我可以通过 cli 运行 Blender:

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

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

But not through php:但不是通过 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>"; 
?>

Nothing.没有什么。

Commands are copied and pasted so there is no typo.命令被复制和粘贴,所以没有错字。

Permissions for home, ec2-user, and blender280 are set to allow read and execute. home、ec2-user 和 blender280 的权限设置为允许读取和执行。

Is this possibly anApache problem?这可能是Apache问题吗?

It turns out that I needed php-fpm.事实证明我需要 php-fpm。 It also turns out that I could not get php-fpm to work on AWS using Amazon Linux.事实证明,我无法使用 Amazon Linux 让 php-fpm 在 AWS 上工作。 Switched everything to AWS using Ubuntu (about a day and a half project) and things are working great.使用 Ubuntu(大约一天半的项目)将所有内容切换到 AWS,并且一切正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM