Python 运行 ;mac osx上xampp localhost的cgi文件

Python 运行 ;mac osx上xampp localhost的cgi文件,python,apache,xampp,cgi,Python,Apache,Xampp,Cgi,我完全不懂python脚本。我按照教程做一些iOS的东西。这还包括pythoncgiscript集成 我已成功创建cgi文件,但无法运行它 文件路径为:/Applications/XAMPP/xamppfiles/cgi-bin/payment-test.cgi 在浏览器中,我以:http://localhost/cgi-bin/payment-test.cgi 我得到以下错误: Server error! The server encountered an internal error a

我完全不懂python脚本。我按照教程做一些iOS的东西。这还包括
pythoncgiscript
集成

我已成功创建cgi文件,但无法运行它

文件路径为:
/Applications/XAMPP/xamppfiles/cgi-bin/payment-test.cgi

在浏览器中,我以:
http://localhost/cgi-bin/payment-test.cgi

我得到以下错误:

 Server error!

The server encountered an internal error and was unable to complete your request.

Error message: 
Premature end of script headers: payment-test.cgi

If you think this is a server error, please contact the webmaster.

Error 500

localhost
Sat Oct 11 12:24:29 2014
Apache/2.2.14 (Unix) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l PHP/5.3.1 mod_perl/2.0.4 Perl/v5.10.1
我通过以下链接修改了httpd.conf


我哪里做错了?如何解决此问题?

最好将代码示例发布在此处,而不是链接到外部站点。但是这个脚本看起来很基本。你能运行任何cgi吗?例如
#/usr/bin/env python
print'内容类型:text/html\r\n\r\nHello,world!'?不要忘记设置文件的执行权限。“脚本头过早结束”表示cgi配置不正确,或者正在运行的脚本不是cgi脚本。