我试图从python内部在终端中运行PHP脚本,但似乎无法访问PHP文件
我调用PHP脚本的python代码是:
import subprocess
proc = subprocess.Popen("/Users/cedrique/documents/test.php", shell=True, stdout=subprocess.PIPE)
script_response = proc.stdout.read()
但是,这给了我一个权限被拒绝的错误:
/bin/sh: /Users/cedrique/documents/test.php: Permission denied
我能给它正确的权利吗?或者我得把它放在另一个文件夹里
谢谢你
您需要以脚本名作为参数运行
php
这里也不需要
shell=True
,因为您没有使用任何shell操作相关问题 更多 >
编程相关推荐