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