【发布时间】:2012-09-14 22:26:42
【问题描述】:
我有一个简单的 php 脚本,它将几个变量传递给并使用 shell_exec 命令运行 python 脚本。当我从 shell 运行这个 php 脚本时,它工作得很好。但是,当我从浏览器运行 php 脚本时,它会导致服务器崩溃。我已经用 exec 和 shell_exec php函数试过了。为什么我从 shell 或浏览器运行脚本很重要?
作为记录,我可以从浏览器成功运行其他命令,例如“tar -xcpvf path.tar.gz”
这是浏览器出现问题的 php 脚本:
<?php
$inputs = array(
'location' => "Los Angeles",
'date' => '11/01/2012',
);
$cmd = 'python simple.py '.$inputs['location'].' '.$inputs['date'];
$results = shell_exec($cmd);
echo $results;
?>
任何帮助将不胜感激。谢谢!
【问题讨论】:
-
检查你的错误日志 - 你得到什么样的错误?
标签: php python browser crash command