Mod perl

来自开放百科 - 灰狐
(版本间的差异)
跳转到: 导航, 搜索
第13行: 第13行:
 
   </Location>
 
   </Location>
 
  </IfModule>
 
  </IfModule>
  touch hello.pl
+
  touch test.pl
  #!/usr/bin/perl
+
  print "Content-type: text/plain\r\n\r\n";
  print "hello \n";
+
  print "Server's environment\n";
  http://localhost/perl/hello.pl
+
foreach ( keys %ENV ) {
 +
    print "$_\t$ENV{$_}\n";
 +
}
 +
chmod a+rx test.pl
 +
  http://localhost/perl/test.pl
 
http://perl.apache.org/
 
http://perl.apache.org/

2007年2月19日 (一) 23:04的版本

mod_perl是个Apache模块,它巧妙的将perl程序语言封装在Apache web服务器内。在mod_perl下,CGI脚本比平常运行快50倍。另外,可将数据库与web服务器集成在一起,用Perl编写Apache模块,在 Apache的配置文件里面插入Perl代码,甚至以server-side include方式使用Perl。在mod_perl下,Apache不仅仅是一个web服务器,而变成了一个功能完善的程序平台。

# apt-get install libapache-mod-perl 
# If the perl module is installed, this will be enabled.
<IfModule mod_perl.c>
  <IfModule mod_alias.c>
   Alias /perl/ /var/www/perl/
  </IfModule>
  <Location /perl>
    SetHandler perl-script
    PerlHandler Apache::Registry
    Options +ExecCGI
  </Location>
</IfModule>
touch test.pl
print "Content-type: text/plain\r\n\r\n";
print "Server's environment\n";
foreach ( keys %ENV ) {
    print "$_\t$ENV{$_}\n";
}
chmod a+rx test.pl
http://localhost/perl/test.pl

http://perl.apache.org/

分享您的观点
个人工具
名字空间

变换
操作
导航
工具箱