文章詳情頁
python - 用Mac自帶的Apache服務器開發CGI,在瀏覽器直接輸出純文本了?求解
瀏覽:102日期:2022-07-18 18:49:21
問題描述
httpd.conf文件頁配置安裝教程http://blog.csdn.net/dabiaoya...一步一步的來的文件權限如下
GhostClock:WWW ghostclock$ ls -al Test.py -rwxr-xr-x 1 ghostclock staff 410 May 9 20:40 Test.pyGhostClock:WWW ghostclock$
在瀏覽器輸入localhost/Test.py后,打印的是純文本
#!/usr/bin/env python# -*- coding: UTF-8 -*-print 'Content-type:text/html'print # 空行,告訴服務器結束頭部print ’<html>’print ’<head>’print ’<meta charset='utf-8'>’print ’<title>Hello Word - CGI 程序!</title>’print ’</head>’print ’<body>’print ’<h2>Hello Word! 第一CGI程序</h2>’print ’</body>’print ’</html>’
不知道我哪里環境沒配置好,求解
問題解答
回答1:添加了AddHandler cgi-script .py了嗎, 添加之后記得重啟apache
排行榜
