首页 > Web开发 > 详细

httpd cgi程序配制+.py .cgi执行

时间:2016-06-10 00:50:59      阅读:351      评论:0      收藏:0      [点我收藏+]

 

 vi /etc/httpd/conf/httpd.conf



ScriptAlias /cgi-bin/ "/var/www/cgi-bin/" <Directory "/var/www/cgi-bin"> AllowOverride None Options +ExecCGI Order allow,deny Allow from all </Directory> ServerName localhost:80 AddHandler cgi-script .cgi .pl .py

 

[root@monitor cgi-bin]# cat hello.py
#!/usr/bin/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>
gcc test.c -otest.cgi

[root@monitor cgi-bin]# cat test.c

#include <stdio.h>

int main(void)

{

printf("Content-Type: text/html;charset=gb2312\n\n");

printf("Hello CGI\n");



return 0;

}

 

httpd cgi程序配制+.py .cgi执行

原文:http://www.cnblogs.com/zengkefu/p/5573001.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!