MacBook-Air-de-casiano-2:apache2 root# pwd /etc/apache2
MacBook-Air-de-casiano-2:apache2 root# tail httpd.conf Include /private/etc/apache2/other/*.conf
MacBook-Air-de-casiano-2:apache2 root# cat other/perl.conf LoadModule perl_module libexec/apache2/mod_perl.so Alias /perl /Library/WebServer/perl <Location /perl> SetHandler perl-script PerlResponseHandler ModPerl::Registry Options ExecCGI PerlSendHeader On Order allow,deny Allow from all </Location>
[/Library/WebServer/CGI-Executables]$ pwd /Library/WebServer/CGI-Executables [/Library/WebServer/CGI-Executables]$ cat hello.cgi #!/usr/bin/perl use strict; use warnings; use CGI qw/:standard/; use Data::Dumper; print header, start_html, h1('it works'), end_html;
# apachectl restart
[/Library/WebServer/CGI-Executables]$ curl -v localhost/cgi-bin/hello.cgi * Adding handle: conn: 0x7fc47c008c00 * Adding handle: send: 0 * Adding handle: recv: 0 * Curl_addHandleToPipeline: length: 1 * - Conn 0 (0x7fc47c008c00) send_pipe: 1, recv_pipe: 0 * About to connect() to localhost port 80 (#0) * Trying ::1... * Connected to localhost (::1) port 80 (#0) > GET /cgi-bin/hello.cgi HTTP/1.1 > User-Agent: curl/7.30.0 > Host: localhost > Accept: */* > < HTTP/1.1 200 OK < Date: Sat, 09 Nov 2013 12:31:00 GMT * Server Apache/2.2.24 (Unix) PHP/5.4.17 DAV/2 mod_ssl/2.2.24 OpenSSL/0.9.8y mod_perl/2.0.7 Perl/v5.16.2 is not blacklisted < Server: Apache/2.2.24 (Unix) PHP/5.4.17 DAV/2 mod_ssl/2.2.24 OpenSSL/0.9.8y mod_perl/2.0.7 Perl/v5.16.2 < Transfer-Encoding: chunked < Content-Type: text/html; charset=ISO-8859-1 < <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US"> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> </head> <body> <h1>it works</h1> </body> * Connection #0 to host localhost left intact </html>
-rwxr-xr-x 1 casiano staff 132 9 nov 12:09 hello.pl [/Library/WebServer/perl]$ vi hello.pl [/Library/WebServer/perl]$ pwd /Library/WebServer/perl [/Library/WebServer/perl]$ cat hello.pl #!/usr/bin/perl use strict; use warnings; use CGI qw/:standard/; use Data::Dumper; print header, start_html, h1('with Perl-module works'), end_html; [/Library/WebServer/perl]$
[/Library/WebServer/perl]$ curl -v 'http://localhost/perl/hello.pl' * Adding handle: conn: 0x7f7f99804000 * Adding handle: send: 0 * Adding handle: recv: 0 * Curl_addHandleToPipeline: length: 1 * - Conn 0 (0x7f7f99804000) send_pipe: 1, recv_pipe: 0 * About to connect() to localhost port 80 (#0) * Trying ::1... * Connected to localhost (::1) port 80 (#0) > GET /perl/hello.pl HTTP/1.1 > User-Agent: curl/7.30.0 > Host: localhost > Accept: */* > < HTTP/1.1 200 OK < Date: Sat, 09 Nov 2013 12:38:07 GMT * Server Apache/2.2.24 (Unix) PHP/5.4.17 DAV/2 mod_ssl/2.2.24 OpenSSL/0.9.8y mod_perl/2.0.7 Perl/v5.16.2 is not blacklisted < Server: Apache/2.2.24 (Unix) PHP/5.4.17 DAV/2 mod_ssl/2.2.24 OpenSSL/0.9.8y mod_perl/2.0.7 Perl/v5.16.2 < Transfer-Encoding: chunked < Content-Type: text/html; charset=ISO-8859-1 < <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US"> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> </head> <body> <h1>with Perl-module works</h1> </body> * Connection #0 to host localhost left intact