0
我试图执行与shell_exec()
从PHP shell命令:PHP了shell_exec不接受“>”参数
$output = shell_exec('python test.py > test.txt');
当我在命令行中运行python test.py > test.txt
它的工作原理。当我试图通过PHP做同样的,没有创建test.txt
文件和命令似乎没有运行。
shell_exec()
当我不使用>
,例如工作正常
$output = shell_exec('python test.py');
echo $output;
我正在使用PHP 5.3.6(不在安全模式下)。任何帮助赞赏。
http://php.net/manual/en/function.escapeshellcmd.php – jValdron
请问你的Apache/PHP的用户权限写入到当前目录和/或'test.txt'?看看你的'error.log'。 – mario
你有适当的权限/ SELinux值在目录和文件? – vdbuilder