免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1364 | 回复: 0

atpages 空间中使用 CGI 方式 [复制链接]

论坛徽章:
0
发表于 2011-12-22 08:54 |显示全部楼层

atpages.jp 免费空间支持 PHP, MySQL, CGI(python,perl,ruby)



使用 CGI 脚本注意点:

1.文件内容编码改为 utf-8
2.回车换行为 Unix下的 \n

3.cgi-bin 目录权限为 755
4.脚本文件权限为 755

5.主目录下创建 .htaccess 文件, 内容为
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 , 能出现CGI输出文字即正常


您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP