【发布时间】:2017-10-08 10:34:07
【问题描述】:
shell.php:
<?php
shell_exec("python /opt/lampp/htdocs/web_test/script.py ")
?>
script.py:
fo = open("/opt/lampp/htdocs/web_test/hello.txt", "w")
fo.write( "Python is a great language.\nYeah its great!!\n")
fo.close()
【问题讨论】:
-
shell.php
-
尝试提供 python 二进制文件的完整路径,例如
/usr/bin/python并确保运行它的用户可以读取 script.py (www-data ?) -
还不行
-
PHP 端有什么错误吗?
web_test目录也是可写的吗?is_writable("/opt/lampp/htdocs/web_test")通过?
标签: php python shell file-handling