Enable CGI by Apache

Step 1:  Add +ExecCGI in <Directory ..> Options.

such as

<Directory "D:/testapp/aphp/">

   Options Indexes FollowSymLinks +ExecCGI

 ....

</Directory>

 

Step 2: Modify the ScriptAlias

such as :

#ScriptAlias /cgi-bin/ "C:/devapp/Apache2/cgi-bin/"
ScriptAlias /cgi-bin/ "D:/testapp/cgi/"

 

 

step 3: Write a test cgi program for testing

such as :(Hello.pl)

#!F:/perl/bin/perl.exe
print "Content-type: text/plain; charset=gb2312/n/n";
print "你好,这是cgi程序 /n";

 

step 4: Restart Apache and do a test

http://localhost/cgi-bin/Hello.pl

 

 

你可能感兴趣的:(apache,c,cgi,testing)