- 論壇徽章:
- 0
|
atpages.jp 免費(fèi)空間支持 PHP, MySQL, CGI(python,perl,ruby)
使用 CGI 腳本注意點(diǎn):
1.文件內(nèi)容編碼改為 utf-8 2.回車換行為 Unix下的 \n
3.cgi-bin 目錄權(quán)限為 755 4.腳本文件權(quán)限為 755
5.主目錄下創(chuàng)建 .htaccess 文件, 內(nèi)容為 AddType text/html py AddHandler cgi-script .py AddType text/html pl AddHandler cgi-script .pl AddType text/html rb AddHandler cgi-script .rb AddType text/html cgi AddHandler cgi-script .cgi
PYTHON 示例: -------------------------------------------- #!/usr/local/bin/python
print "Content-type: text/html\n\n" print "<html><head><title>CGI support test</title></head><body><p>python CGI 測試</p></body></html>"
RUBY 示例: -------------------------------------------- #!/usr/local/bin/ruby
print "Content-type: text/html\n\n" print "<html><head><title>CGI support test</title></head><body><p>ruby CGI 測試</p></body></html>"
PERL 示例: -------------------------------------------- #!/usr/local/bin/perl
print "Content-type: text/html\n\n" ; print "<html><head><title>CGI support test</title></head><body><p>perl CGI 測試</p></body></html>" ;
使用瀏覽器打開 http://wwwXX.atpages.jp/USERID/cgi-bin/test0.py , 能出現(xiàn)CGI輸出文字即正常
|
|