1. vi /etc/httpd/conf/httpd.conf
Search
# AddHandler cgi-script
Replace on
AddHandler cgi-script .cgi .py .pl
Search
# AddHandler cgi-script
Replace on
AddHandler cgi-script .cgi .py .pl
Search
<Directory "/var/www/html">
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Add
Options +ExecCGI
Then
service httpd restart
2. cd /var/www/html/
vi helloperl.pl
Add
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "Perl hello";
vi hellopython.py
Add
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# enable debugging
import cgitb
cgitb.enable()
print "Content-Type: text/plain;charset=utf-8"
print
print "Hello World!"
Then
chmod +x helloperl.pl
chmod +x hellopython.pl
Go to http://mysite/helloperl.pl
Go to http://mysite/hellopython.pl
Комментариев нет:
Отправить комментарий