从PHP运行.py脚本,给出错误错误:标头之前脚本输出结束

时间:2020-11-02 23:18:59

标签: python php xampp

我正在使用(Windows 10,XAMPP,PHP / 7.4.8)我想从PHP文件运行简单的.py脚本,我按照(Running Python scripts with Xampp)在(httpd.config)中添加了这些行< / p>

AddHandler cgi-script .cgi .pl .asp .py
ScriptInterpreterSource Registry-Strict

然后我在index.py标记中添加<IfModule dir_module>。然后重新启动[apache / xampp]

我创建文件index.py文件

#!C:/Users/admin/AppData/Local/Programs/Python/Python39/python.exe
    print("Content-Type: text/html\n")
    print ("Hello Python Web Browser!! This is cool!!")

我看了很多书,视频仍然出现此错误,

服务器错误!

服务器遇到内部错误,无法完成您的请求。

错误消息:标头:index.py之前的脚本输出结束

如果您认为这是服务器错误,请与网站管理员联系。

Error message: End of script output before headers:

0 个答案:

没有答案
相关问题