如果我导入cgi'而Python CGI脚本将无法执行。

时间:2015-06-09 12:35:54

标签: python apache cgi

#!/usr/bin/python   
import sys, os, cgi
print "Content-type:text/html;charset=utf-8    \r\n\r\n"
print '<html>'
print '<head>'
print '<title>Hello Word - First CGI Program</title>'
print '</head>'
print '<body>'
print '<h2>Hello Word! This is my first CGI program %s</h2>'
print '</body>'
print '</html>'

执行此操作以显示提示错误500,该提示在标题:connect.py&#39;之前显示脚本输出结束,这显然意味着它在导入失败后立即停止执行脚本。

如果我只导入sys和os,没有cgi,相同的代码会执行并显示Hello World。

我检查了CGI脚本的路径,它确实包含了/usr/lib/python2.7

此外,在检查Apache错误日志时,我看到以下错误消息:

[Tue Jun 09 17:49:39.552088 2015] [cgi:error] [pid 18552] [client 106.51.234.247:17541] AH01215: python: relocation error: python: symbol SSL_load_error_strings, version OPENSSL_1.0.0 not defined in file libssl.so.1.0.0 with link time reference
[Tue Jun 09 17:49:39.552292 2015] [cgi:error] [pid 18552] [client 106.51.234.247:17541] End of script output before headers: connect.py

0 个答案:

没有答案
相关问题