You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by sb...@hyperreal.org on 1999/01/23 19:06:59 UTC
cvs commit: modperl-site/guide all.html config.html control.html debug.html help.html index.html obvious.html performance.html porting.html scenario.html snippets.html start.html status.html warnings.html
sbekman 99/01/23 10:06:59
Modified: guide all.html config.html control.html debug.html
help.html index.html obvious.html performance.html
porting.html scenario.html snippets.html start.html
status.html warnings.html
Log:
* new obvious.pod: Where do the warnings/errors go?
* new index.html: added a search box
* new snippets.pod: added error_log.pl script to fetch the latest logs
from the server without telneting there
* new snippets.pod: How to avoid printing the header more than once.
* new snippets.pod: More on relative paths
* upd start.pod: removed all 'latest version is', so the guide will
not misguide people (Ken Williams)
* upd config.html: removed redundant ;; (Ken Williams)
* upd config.html: fixed the question/answer 'Is there a way to
provide a different startup.pl file for each individual virtual'
(Ken Williams)
* upd help.html: a few links fixed (Peter Skov (UNIT))
* upd porting.pod: CORE::exit vs Apache::exit section update (Doug)
* upd scenario.pod: note about importance make clean execution,
because of possible binary incompability (1.3.3 vs 1.3.4) (Doug)
* upd porting.pod: switches -w, -T in the shebang line (Doug)
* upd debug.pod: tracing the PerlRequire's and PerlModule's as they
are loaded (Doug)
* add config.pod: Sometimes script from one virtual host calls the
script with the same path from the second virtual host (Doug)
* add performance.pod: how can I find if my modperl scripts have memory leaks (and where). (Doug)
* help.html: added a section for DBI help (Jeffrey W. Baker)
Revision Changes Path
1.6 +410 -53 modperl-site/guide/all.html
Index: all.html
===================================================================
RCS file: /export/home/cvs/modperl-site/guide/all.html,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- all.html 1999/01/06 07:45:22 1.5
+++ all.html 1999/01/23 18:06:52 1.6
@@ -15,7 +15,7 @@
<CENTER><P><B>Deploying apache/mod_perl accelerator to give a rocket speed
to your perl cgi-bin scripts.</B></P></CENTER>
-<CENTER><P><B>Version 1.05 Jan, 6 1999</B></P></CENTER>
+<CENTER><P><B>Version 1.06 Jan, 23 1999</B></P></CENTER>
<P>
<HR WIDTH="100%"></P>
@@ -33,7 +33,7 @@
<LI><A HREF="control.html">Server Controlling and Monitoring</A></LI>
-<LI><A HREF="porting.html">CGI => mod_perl Porting. mod_perl Coding guidelines.</A></LI>
+<LI><A HREF="porting.html">CGI to mod_perl Porting. mod_perl Coding guidelines.</A></LI>
<LI><A HREF="obvious.html">What is obvious for others but not for you</A>.</LI>
@@ -53,10 +53,34 @@
<LI><A HREF="CHANGES">CHANGES</A></LI>
-<LI><A HREF="http://www.apache.org/search.html">Search apache.org along with this guide</A></LI>
+<LI><A HREF="#search">Search perl.apache.org along with this guide</A></LI>
</UL>
+<HR>
+<CENTER>
+<TABLE BORDER=5 CELLSPACING=8 CELLPADDING=8 >
+<TR BGCOLOR="gray" ALIGN=CENTER VALIGN=TOP>
+<TD ALIGN=CENTER VALIGN=TOP>
+<FONT COLOR=WHITE SIZE=+1>
+<A NAME="SEARCH">Search perl.apache.org along with this guide</A>
+<FORM ACTION="http://search.apache.org/" METHOD="POST">
+<INPUT TYPE="text" NAME="keyword" SIZE=40>
+<input type="hidden" name="what" value="perl">
+<BR>
+Maximum number of records to return:
+<select name="results">
+<option value=20>20
+<option value=40>40
+<option value=60>60
+</select>
+<INPUT TYPE="submit" VALUE="Search">
+</FORM>
+</FONT>
+</TD></TR>
+</TABLE>
+</CENTER>
+
<CENTER><TABLE CELLSPACING=2 CELLPADDING=2 WIDTH="100%" >
<TR ALIGN=CENTER VALIGN=TOP>
<TD ALIGN=CENTER VALIGN=CENTER COLSPAN="3">
@@ -332,7 +356,7 @@
<LI><A HREF="#Testing_by_checking_the_error_lo">Testing by checking the error_log file</A>
<LI><A HREF="#Testing_by_calling_the_perl_sta">Testing by calling the /perl-status </A>
- <LI><A HREF="#Testing_by_telneting_to_the_port">Testing by telneting to the port server's listening to</A>
+ <LI><A HREF="#Testing_by_telneting_to_the_port">Testing by telneting to the port, server's listening to</A>
<LI><A HREF="#Run_a_cgi_that_shows_you_your_se">Run a cgi that shows you your server's environment</A>
<LI><A HREF="#with_lwp_request">with lwp-request</A>
</UL>
@@ -368,7 +392,7 @@
HREF="http://www.perl.com.">http://www.perl.com.</A> Try the direct
download link <A
HREF="http://www.perl.com/pace/pub/perldocs/latest.html.">http://www.perl.com/pace/pub/perldocs/latest.html.</A>
-As of this writing the latest maintain (production) release is perl5.00503.
+
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
@@ -376,8 +400,7 @@
<P>
Get the latest apache webserver from <A
HREF="http://www.apache.org.">http://www.apache.org.</A> Try the direct
-download link [http://www.apache.org/dist/]. As of this writing the latest
-production release is apache-1.3.3.
+download link [http://www.apache.org/dist/].
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
@@ -385,8 +408,7 @@
<P>
Get the latest mod_perl from <A
HREF="http://perl.apache.org.">http://perl.apache.org.</A> Try the direct
-download link [http://perl.apache.org/dist/]. As of this writing the latest
-production release is mod_perl-1.16_02
+download link [http://perl.apache.org/dist/].
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
@@ -474,7 +496,7 @@
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H1><A NAME="How_can_I_tell_whether_mod_perl_">How can I tell whether mod_perl is really installed</A></H1></CENTER>
<P>
-There a few ways. In older versions of apache you could see that by running <CODE>httpd -v</CODE>, it's no longer work!
+There a few ways. In older versions of apache ( < 1.3.2 ?) you could check that by running <CODE>httpd -v</CODE>, it no longer works!
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
@@ -502,7 +524,7 @@
</PRE>
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
-<CENTER><H2><A NAME="Testing_by_telneting_to_the_port">Testing by telneting to the port server's listening to</A></H2></CENTER>
+<CENTER><H2><A NAME="Testing_by_telneting_to_the_port">Testing by telneting to the port, server's listening to</A></H2></CENTER>
<P>
Assume that you set <CODE>Port 8080</CODE> in the httpd.conf for your mod_perl server. You have to telnet to your
server port 8080, then you should type <CODE>HEAD / HTTP/1.0</CODE> then press the <ENTER> key TWICE!
@@ -652,7 +674,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#author">Stas Bekman</A>.
- <BR>Last Modified at 01/03/99
+ <BR>Last Modified at 01/23/99
</FONT>
</B>
</TD>
@@ -705,7 +727,7 @@
<LI><A HREF="#httpd_perl_server_mod_perl_">httpd_perl server (mod_perl):</A>
</UL>
- <LI><A HREF="#Is_it_possible_to_install_mod_pe">Is it possible to install mod_perl without root access?</A>
+ <LI><A HREF="#Is_it_possible_to_install_and_us">Is it possible to install and use apache/mod_perl without having a root access?</A>
</UL>
<!-- INDEX END -->
@@ -902,6 +924,11 @@
% make clean
</PRE>
<P>
+It's important to <STRONG>make clean</STRONG> since some of the versions aren't binary compatible (e.g apache 1.3.3 vs
+1.3.4) so any ``third-party'' C modules need to be re-compiled against the
+1.3.4 header files.
+
+<P>
Here I didn't find a way to compile with gcc (but perl was compiled with cc
so we have to compile with the same compiler!!!
@@ -934,9 +961,12 @@
/usr/apps/usr/src/httpd_perl/apache_1.3.2/src/httpd
<P>
-rename the 'httpd' to 'http_perl'
+If make test fails, look into t/logs and see what's in there.
<P>
+rename the 'httpd' to 'httpd_perl'
+
+<P>
<PRE> % mv /usr/apps/sbin/httpd_perl/httpd /usr/apps/sbin/httpd_perl/httpd_perl
</PRE>
<P>
@@ -951,14 +981,14 @@
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
-<CENTER><H1><A NAME="Is_it_possible_to_install_mod_pe">Is it possible to install mod_perl without root access?</A></H1></CENTER>
+<CENTER><H1><A NAME="Is_it_possible_to_install_and_us">Is it possible to install and use apache/mod_perl without having a root access?</A></H1></CENTER>
<P>
Yes, no problem with that. Follow the instructions above and when you
encounter APACI_ARGS use your home directory or alike as a prefix (e.g
<CODE>/home/stas/www</CODE>) and everything will be installed there. There is a chance that some perl
libs will be not installed on your server by root and you will have to
install these locally too. See the <A
-HREF="http://www.esafe.com/stas/TULARC/webmaster/myfaq.html#7">http://www.esafe.com/stas/TULARC/webmaster/myfaq.html#7</A>
+HREF="http://www.singlesheaven.com/stas/TULARC/webmaster/myfaq.html#7">http://www.singlesheaven.com/stas/TULARC/webmaster/myfaq.html#7</A>
for more information on local perl installations.
<P>
@@ -996,7 +1026,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#author">Stas Bekman</A>.
- <BR>Last Modified at 12/27/98
+ <BR>Last Modified at 01/23/99
</FONT>
</B>
</TD>
@@ -1065,6 +1095,8 @@
<LI><A HREF="#My_cgi_perl_code_is_being_return">My cgi/perl code is being returned as a plain text instead of being executed by the webserver?</A>
<LI><A HREF="#Script_working_under_cgi_bin_wh">Script working under cgi-bin, when called as mod_perl I see A 'Save-As' prompt</A>
<LI><A HREF="#Is_there_a_way_to_provide_a_diff">Is there a way to provide a different startup.pl file for each individual virtual host</A>
+ <LI><A HREF="#Is_there_a_way_to_modify_INC_on">Is there a way to modify @INC on a per-virtual-host basis. </A>
+ <LI><A HREF="#Sometimes_script_from_one_virtua">Sometimes script from one virtual host calls the script with the same path from the second virtual host</A>
</UL>
</UL>
@@ -1248,9 +1280,19 @@
use CGI ();
CGI->compile(':all');
-See also L<Apache::Status|status/Configuration>
+Note that starting from CGI::VERSION > 2.46, the new method for
+CGI->compile is:
+</PRE>
+<P>
+<PRE> use CGI qw(-compile :all);
</PRE>
<P>
+But the old method stays for backword compatibility.
+
+<P>
+See also <A HREF="././status.html#Configuration">Apache::Status</A>
+
+<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H2><A NAME="PerlFreshRestart">PerlFreshRestart</A></H2></CENTER>
<P>
@@ -1341,13 +1383,13 @@
and the lowest number of arguments will be shifted off the
<CODE>@List</CODE> or use array reference to handle any number greater than
the minimum for that directive push @Redirect, ``/foo'',
-``http://www.foo.com/'';;
+``http://www.foo.com/'';
<P>
-<PRE> push @Redirect, "/imdb", "<A HREF="http://www.imdb.com/"">http://www.imdb.com/"</A>;;;
+<PRE> push @Redirect, "/imdb", "<A HREF="http://www.imdb.com/"">http://www.imdb.com/"</A>;;
</PRE>
<P>
-<PRE> push @Redirect, [qw(temp "/here" "<A HREF="http://www.there.com"">http://www.there.com"</A>;;)];
+<PRE> push @Redirect, [qw(temp "/here" "<A HREF="http://www.there.com"">http://www.there.com"</A>;)];
</PRE>
<P>
Other section counterparts include %VirtualHost, <CODE>%Directory</CODE>
@@ -1413,14 +1455,30 @@
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H2><A NAME="Script_working_under_cgi_bin_wh">Script working under cgi-bin, when called as mod_perl I see A 'Save-As' prompt</A></H2></CENTER>
<P>
-Did you put <CODE>PerlSendHeader On</CODE> in the config part of the <CODE><Location foo</CODE></Location>>?
+Did you put <CODE>PerlSendHeader On</CODE> in the config part of the <Location foo></Location>?
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H2><A NAME="Is_there_a_way_to_provide_a_diff">Is there a way to provide a different startup.pl file for each individual virtual host</A></H2></CENTER>
<P>
+No. Any virtual host will be able to see the routines from a startup.pl
+loaded for any other virtual host.
+
+<P>
+<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
+<CENTER><H2><A NAME="Is_there_a_way_to_modify_INC_on">Is there a way to modify @INC on a per-virtual-host basis.</A></H2></CENTER>
+<P>
You can use 'PerlSetEnv PERL5LIB ...' or a PerlFixupHandler w/ the lib
pragma.
+
+<P>
+<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
+<CENTER><H2><A NAME="Sometimes_script_from_one_virtua">Sometimes script from one virtual host calls the script with the same path from the second virtual host</A></H2></CENTER>
+<P>
+It has been a bug before, last fixed in 1.15_01, i.e. if you're running
+1.15, that could be the problem. The other option to try is set this
+variable in a startup file (PerlRequire):
+$Apache::Registry::NameWithVirtualHost = 1;
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<P><A HREF="index.html">[Back to the main page]</A></P>
@@ -1435,7 +1493,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#author">Stas Bekman</A>.
- <BR>Last Modified at 01/03/99
+ <BR>Last Modified at 01/23/99
</FONT>
</B>
</TD>
@@ -2274,7 +2332,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#author">Stas Bekman</A>.
- <BR>Last Modified at 12/27/98
+ <BR>Last Modified at 01/16/99
</FONT>
</B>
</TD>
@@ -2301,7 +2359,7 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
- <TITLE>mod_perl guide: CGI => mod_perl Porting. mod_perl Coding guidelines.</TITLE>
+ <TITLE>mod_perl guide: CGI to mod_perl Porting. mod_perl Coding guidelines.</TITLE>
<META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
<META NAME="Author" CONTENT="Bekman Stas">
<META NAME="Description" CONTENT="mod_perl,perl,apache">
@@ -2312,7 +2370,7 @@
<H1 ALIGN=CENTER>
<A HREF="http://perl.apache.org"><IMG SRC="images/mod_perl.gif" ALT="Mod Perl Icon" BORDER=0 HEIGHT=30 WIDTH=90 ALIGN=LEFT></A>
<A HREF="http://perl.apache.org"><IMG SRC="images/mod_perl.gif" ALT="Mod Perl Icon" BORDER=0 HEIGHT=30 WIDTH=90 ALIGN=RIGHT></A>
-CGI => mod_perl Porting. mod_perl Coding guidelines.</H1>
+CGI to mod_perl Porting. mod_perl Coding guidelines.</H1>
<HR WIDTH="100%">
<!-- INDEX BEGIN -->
<P><A NAME="toc"></A><B><FONT SIZE=-1>Table of Contents:</FONT></B></P>
@@ -2339,6 +2397,7 @@
<LI><A HREF="#BEGIN_blocks">BEGIN blocks </A>
<LI><A HREF="#END_blocks">END blocks </A>
<LI><A HREF="#Switches_w_T">Switches -w, -T</A>
+ <LI><A HREF="#Switches_w_T">Switches -w, -T</A>
</UL>
<LI><A HREF="#strict_pragma">strict pragma</A>
@@ -2638,8 +2697,7 @@
Perl's <CODE>exit()</CODE> built-in function cannot be used in mod_perl
scripts. Unless you want the server child to exit (which makes the whole
idea of using mod_perl irrelevant). The Apache::exit() function should be
-used instead. Apache::exit() automatically overrides the built-in
-<CODE>exit()</CODE> for Apache::Registry scripts.
+used instead.
<P>
You might start you scripts with overriding the exit sub (if you use
@@ -2664,16 +2722,38 @@
}
</PRE>
<P>
-Now every time the select will be called the correct exit will be picked,
-no matter if you run the script as cgi or from shell.
+Now every time the select code will be called and the correct exit will be
+picked, no matter if you run the script as cgi or from shell.
<P>
-<STRONG>Note</STRONG> that if you run the script under Apache::Registry, <STRONG>The Apache
-function `exit' overrides the Perl core built-in function</STRONG>. While you see the <CODE>exit()</CODE> listed in <CODE>@EXPORT_OK</CODE>
+<STRONG>Note</STRONG> that if you run the script under <CODE>Apache::Registry</CODE>, <STRONG>The
+Apache function `exit' overrides the Perl core built-in
+function</STRONG>. While you see the <CODE>exit()</CODE> listed in <CODE>@EXPORT_OK</CODE>
of Apache package, Apache::Registry makes something you don't see and
-imports this function for you.
+imports this function for you. (which means that if your script is running
+under Apache::Registry handler, you don't have to worry about
+<CODE>exit(),</CODE> Apache::PerlRun as well)
<P>
+<STRONG>Note</STRONG> that if you still use CORE::exit() in your scripts running under modperl,
+the child will exit, but neither proper exit nor logging will happen on the
+way. CORE::exit() cuts off server's legs... If you need to properly
+shutdown the child , use $r->child_terminate (which sets the internal
+MaxRequestsPerChild so the child will exit).
+
+<P>
+You can accomplish that in 2 ways - in the Apache::Registry script:
+
+<P>
+<PRE> Apache->request->child_terminate;
+</PRE>
+<P>
+in httpd.conf:
+
+<P>
+<PRE> PerlFixupHandler "sub { shift->child_terminate }"
+</PRE>
+<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H3><A NAME="Running_from_shell">Running from shell</A></H3></CENTER>
<P>
@@ -2799,18 +2879,16 @@
<P>
Normally when you run perl from the command line or have the shell invoke
it with `#!', you may choose to pass perl switch arguments such as -w or
--T. Since the command line is only parsed once, when the server starts,
-these switches are unavailable to mod_perl scripts. However, most command
-line arguments have a equivalent special variable. For example, the $^W
-variable corresponds to the -w switch. Consult perlvar for more details.
-With mod_perl it is also possible to turn on warnings globally via the
-PerlWarn directive:
+-T. Most command line arguments have a equivalent special variable. For
+example, the $^W variable corresponds to the -w switch. Consult perlvar for
+more details. With mod_perl it is also possible to turn on warnings
+globally via the PerlWarn directive:
<P>
<PRE> PerlWarn On
</PRE>
<P>
-You can turn it off with <CODE>local $^W = 0;</CODE> in your scripts on the local basis (or inside the block).
+You can turn it off with <CODE>local $^W = 0;</CODE> in your scripts on the local basis (or inside the block). If you write <CODE>$^W = 0;</CODE> you disable the warn mode everywhere, the same with <CODE>$^W = 1;</CODE>.
<P>
The switch which enables taint checks does not have a special variable, so
@@ -2828,7 +2906,16 @@
startup flags such as -d and -D. See perlrun.
<P>
+If you have the shebang line (#!/bin/perl -wT) in your script, <STRONG>-w</STRONG>
+will be honored (which means that you have turned the warn mode on for the
+scope of this script, <STRONG>-T</STRONG> will produce a warning if
+<CODE>PerlTaintCheck</CODE> isn't <CODE>On</CODE>.
+
+<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
+<CENTER><H3><A NAME="Switches_w_T">Switches -w, -T</A></H3></CENTER>
+<P>
+<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H2><A NAME="strict_pragma">strict pragma</A></H2></CENTER>
<P>
It's absolutely mandatory to start all your scripts with:
@@ -3411,7 +3498,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#author">Stas Bekman</A>.
- <BR>Last Modified at 12/27/98
+ <BR>Last Modified at 01/23/99
</FONT>
</B>
</TD>
@@ -3469,6 +3556,7 @@
<LI><A HREF="#Debugging_your_code_in_Single_Se">Debugging your code in Single Server Mode</A>
<LI><A HREF="#_M_and_other_time_file_tests_u">-M and other time() file tests under mod_perl</A>
<LI><A HREF="#Handling_the_User_pressed_Stop_">Handling the 'User pressed Stop button' case</A>
+ <LI><A HREF="#Where_do_the_warnings_errors_go_">Where do the warnings/errors go?</A>
</UL>
<!-- INDEX END -->
@@ -4008,7 +4096,56 @@
<P>
<PRE> $r->register_cleanup(sub {$CACHE{LOCK} = 0;});
</PRE>
+<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
+<CENTER><H1><A NAME="Where_do_the_warnings_errors_go_">Where do the warnings/errors go?</A></H1></CENTER>
+<P>
+Your cgi doesn't work and you want to see what is the problem. The best
+idea is to checkout what the server error report. Where I can find this
+report?
+
+<P>
+Generally all the errors are being logged into an error_log file. The exact
+file location and name are defined in the http.conf file. Watch the
+<CODE>ErrorLog</CODE> parameter. My httpd.conf says:
+
+<P>
+<PRE> ErrorLog var/logs/error_log
+</PRE>
+<P>
+Hey, where is the beginning of the path? There is another apache's
+parameter called <CODE>ServerRoot</CODE>. Everytime apache sees a value of the parameter with no absolute path (e.g <CODE>/tmp/my.txt</CODE>) but with relative path (e.g <CODE>my.txt</CODE>) it prepends the value of the <CODE>ServerRoot</CODE> to this value. I have:
+
+<P>
+<PRE> ServerRoot /usr/local/apache
+</PRE>
+<P>
+So I will look for error_log file at
+<CODE>/usr/local/apache/var/logs/error_log</CODE>. Ofcourse you can use a absolute path to define the file's location at the
+filesystem.
+
+<P>
+<META>: is this 100% correct?
+
+<P>
+But there are cases when errors don't go to the error_log file. For example
+some errors are being printed to the console (tty) you have executed the
+httpd from (unless you redirected the httpd's stderr flow). This happens
+when the server didn't open the error_log file for writing yet. So if the
+error happens when server executes PerlRequire or PerlModule directive you
+might see the errors goes to the tty.
+
+<P>
+You are probably wander where all the errors go when you are running the
+server in the single mode (httpd -X). They go to the console. That's
+because when running in the single mode there is no parent httpd process
+who performs all the logging. It includes all the status messages that
+generally show up in the error_log file.
+
+<P>
+</META>
+
+<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<P><A HREF="index.html">[Back to the main page]</A></P>
<CENTER><TABLE CELLSPACING=2 CELLPADDING=2 WIDTH="100%" >
@@ -4022,7 +4159,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#author">Stas Bekman</A>.
- <BR>Last Modified at 12/27/98
+ <BR>Last Modified at 01/23/99
</FONT>
</B>
</TD>
@@ -4413,7 +4550,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#author">Stas Bekman</A>.
- <BR>Last Modified at 01/06/99
+ <BR>Last Modified at 01/16/99
</FONT>
</B>
</TD>
@@ -4467,6 +4604,7 @@
<LI><A HREF="#Preload_Registry_Scripts">Preload Registry Scripts</A>
<LI><A HREF="#Avoid_Importing_Functions">Avoid Importing Functions</A>
<LI><A HREF="#Reducing_the_Memory_Usage">Reducing the Memory Usage</A>
+ <LI><A HREF="#how_can_I_find_if_my_modperl_scr">how can I find if my modperl scripts have memory leaks (and where)</A>
<LI><A HREF="#Limiting_the_size_of_the_process">Limiting the size of the processes</A>
<LI><A HREF="#Limiting_the_resources_used_by_h">Limiting the resources used by httpd children</A>
<LI><A HREF="#Limiting_the_request_rate_speed_">Limiting the request rate speed (robots blocking)</A>
@@ -4815,7 +4953,9 @@
}
</PRE>
<P>
-See also: perldoc Apache::RegistryLoader
+Note that we don't use here the second argument to the
+<CODE>handler().</CODE> You might need to provide a <CODE>trans()</CODE>
+method, since it's very dependant on your server's configuration. See <CODE>perldoc Apache::RegistryLoader</CODE> for the complete information.
<P>
You have to check whether it makes any good for you though, I did some
@@ -4868,6 +5008,46 @@
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
+<CENTER><H1><A NAME="how_can_I_find_if_my_modperl_scr">how can I find if my modperl scripts have memory leaks (and where)</A></H1></CENTER>
+<P>
+Apache::Leak (derived from Devel::Leak) should help you with this task.
+Example:
+
+<P>
+<PRE> use Apache::Leak;
+
+ my $global = "FooAAA";
+
+ leak_test {
+ $$global = 1;
+ ++$global;
+ };
+</PRE>
+<P>
+The argument to <CODE>leak_test()</CODE> is an anonymous sub, so you can
+just throw it around any code you suspect might be leaking. beware, it will
+run the code twice, because the first time in, new SVs are created, but
+does not mean you are leaking, the second pass will give better evidence.
+you do not need to be inside mod_perl to use it, from the command line, the
+above script outputs:
+
+<P>
+<PRE> ENTER: 1482 SVs
+ new c28b8 : new c2918 :
+ LEAVE: 1484 SVs
+ ENTER: 1484 SVs
+ new db690 : new db6a8 :
+ LEAVE: 1486 SVs
+ !!! 2 SVs leaked !!!
+</PRE>
+<P>
+Build a debuggable perl to see dumps of the SVs. the simple way to have
+both a normal perl and debuggable perl, is to follow hints in the SUPPORT
+doc for buildling libperld.a, when that is built copy the `perl' from that
+directory to your perl bin directory, but name it `dperl'.
+
+<P>
+<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H1><A NAME="Limiting_the_size_of_the_process">Limiting the size of the processes</A></H1></CENTER>
<P>
Apache::SizeLimit allows you to kill off Apache httpd processes if they
@@ -5927,7 +6107,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#author">Stas Bekman</A>.
- <BR>Last Modified at 12/27/98
+ <BR>Last Modified at 01/23/99
</FONT>
</B>
</TD>
@@ -6074,7 +6254,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#author">Stas Bekman</A>.
- <BR>Last Modified at 12/27/98
+ <BR>Last Modified at 01/16/99
</FONT>
</B>
</TD>
@@ -6156,6 +6336,12 @@
<P>
PerlSetVar MOD_PERL_TRACE all
+<P>
+For example if you want to see a trace of the PerlRequire's and
+PerlModule's as they are loaded, use:
+
+<P>
+PerlSetVar MOD_PERL_TRACE d
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<P><A HREF="index.html">[Back to the main page]</A></P>
@@ -6170,7 +6356,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#author">Stas Bekman</A>.
- <BR>Last Modified at 12/27/98
+ <BR>Last Modified at 01/23/99
</FONT>
</B>
</TD>
@@ -6216,6 +6402,9 @@
<LI><A HREF="#Redirecting_Errors_to_Client_ins">Redirecting Errors to Client instead of error_log</A>
<LI><A HREF="#Sending_MIME_headers">Sending MIME headers</A>
+ <LI><A HREF="#How_to_avoid_printing_the_header">How to avoid printing the header more than once.</A>
+ <LI><A HREF="#More_on_relative_paths">More on relative paths</A>
+ <LI><A HREF="#Watching_the_error_log_file_with">Watching the error_log file without telneting to the server.</A>
</UL>
<!-- INDEX END -->
@@ -6245,7 +6434,152 @@
<P>
Also there is $ENV{PERL_SEND_HEADER} to see if PerlSendHeader is On or Off.
+<P>
+<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
+<CENTER><H1><A NAME="How_to_avoid_printing_the_header">How to avoid printing the header more than once.</A></H1></CENTER>
+<P>
+I'm sure you have been in the situations, where you wish you knew whether
+the MIME header has been already printed. Since if it was printing it again
+will cause an ugly ``Content-type: ...'' string show up at the web page. So
+how do we solve it? With help of closure.
+
+<P>
+Just copy the code below as it is, including the block's curly parentheses.
+And everywhere in your code use the <CODE>print_header()</CODE> sub to
+print the header. <CODE>$need_header</CODE> is the same beast as static variable in C, so it remembers its value from
+call to call.
+
+<P>
+<PRE> {
+ my $need_header = 1;
+ sub print_header {
+ print header(@_),$need_header = 0 if $need_header;
+ }
+ }
+</PRE>
+<P>
+<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
+<CENTER><H1><A NAME="More_on_relative_paths">More on relative paths</A></H1></CENTER>
+<P>
+Many use a relative require call, or write to the file in the current or
+relative to the current directory. But this will fail if you wouldn't
+<CODE>chdir()</CODE> into the directory first. So you have to either do
+this in the code or to use a nice <CODE>FindBin.pm</CODE> package.
+
+<P>
+<PRE> use FindBin qw($Bin);
+ use lib $Bin;
+ # or
+ open IN, "$Bin/foo.txt";
+</PRE>
+<P>
+Now <CODE>$Bin</CODE> includes the path of the directory the script resides on, so you can move
+the script from one directory to the other and call it from anywhere else,
+the pathes will be always correct.
+
+<P>
+It's different from using the ``./foo'', for you have to chdir to the
+directory the script located at first. (Think about crontabs!!!)
+
+<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
+<CENTER><H1><A NAME="Watching_the_error_log_file_with">Watching the error_log file without telneting to the server.</A></H1></CENTER>
+<P>
+I wrote this script long time ago, when I have had to debug my cgi scripts
+but I didn't have the access to the error_log file. I have asked the admin
+to install this script and happily used it since then.
+
+<P>
+If your scripts are running on these 'Get-free-site' servers, and your
+cannot debug your script because you can't telnet to the server or can't
+see the error_log, you can ask your sysadmin to install this script.
+
+<P>
+Ok, here is the code:
+
+<P>
+<PRE> #!/usr/bin/perl -Tw
+
+ use strict;
+ $|=1;
+
+ my $default = 10;
+ my $error_log = "/usr/local/apache/var/logs/error_log.1";
+ use CGI;
+
+ # untaint $ENV{PATH}
+ $ENV{'PATH'} = '/bin:/usr/bin';
+ delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
+
+ my $q = new CGI;
+
+ my $counts = (defined $q->param('count') and $q->param('count'))
+ ? $q->param('count') : $default;
+
+ print $q->header,
+ $q->start_html(-bgcolor => "white",
+ -title => "Error logs"),
+ $q->start_form,
+ $q->center(
+ $q->b('How many lines to fetch? '),
+ $q->textfield('count',10,3,3),
+ $q->submit('', 'Fetch'),
+ $q->reset,
+ ),
+ $q->end_form,
+ $q->hr;
+
+
+ print($q->b("$error_log doesn't exist!!!")),exit unless -e $error_log;
+
+ open LOG, "tail -$counts $error_log|" or die "Can't open tail on $error_log :$!\n";
+ my @logs = <LOG>;
+ print $q->b('Note: Latest logs on the top'),$q->br;
+
+ print "<UL>\n";
+
+ # format and colorize each line nicely
+ foreach (reverse @logs) {
+ s{
+ \[(.*?)\]\s* # date
+ \[(.*?)\]\s* # type of error
+ \[(.*?)\]\s* # client
+ (.*) # the message
+ }
+ {
+ "[$1] <BR> [".
+ colorize($2,$2).
+ "] <BR> [$3] <PRE>".
+ colorize($2,$4).
+ "</PRE>"
+ }ex;
+ print "<BR><LI>$_<BR>";
+ }
+
+ print "</UL>\n";
+
+ close LOG;
+
+ #############
+ sub colorize{
+ my ($type,$context) = @_;
+
+ my %colors =
+ (
+ error => 'red',
+ crit => 'black',
+ notice => 'green',
+ warn => 'brown',
+ );
+
+ return exists $colors{$type}
+ ? qq{<B><FONT COLOR="$colors{$type}">$context</FONT></B>}
+ : $context;
+ }
+
+
+</PRE>
+<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<P><A HREF="index.html">[Back to the main page]</A></P>
<CENTER><TABLE CELLSPACING=2 CELLPADDING=2 WIDTH="100%" >
@@ -6259,7 +6593,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#author">Stas Bekman</A>.
- <BR>Last Modified at 12/27/98
+ <BR>Last Modified at 01/23/99
</FONT>
</B>
</TD>
@@ -6294,9 +6628,7 @@
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#E0FFFF" LINK="#0000EE" VLINK="#551A8B" ALINK="#FF0000">
-<H1 ALIGN=CENTER><A HREF="http://perl.apache.org"><IMG SRC="images/mod_perl.gif" ALT="Mod Perl Icon" BORDER=0 HEIGHT=30 WIDTH=90 ALIGN=LEFT></A><A HREF="http://perl.apache.org"><IMG SRC="images/mod_perl.gif" ALT="Mod Perl Icon" BORDER=0 HEIGHT=30 WIDTH=90
-
- ALIGN=RIGHT></A>
+<H1 ALIGN=CENTER><A HREF="http://perl.apache.org"><IMG SRC="images/mod_perl.gif" ALT="Mod Perl Icon" BORDER=0 HEIGHT=30 WIDTH=90 ALIGN=LEFT></A><A HREF="http://perl.apache.org"><IMG SRC="images/mod_perl.gif" ALT="Mod Perl Icon" BORDER=0 HEIGHT=30 WIDTH=90 ALIGN=RIGHT></A>
Help. Futher Learning</H1>
<P>
@@ -6316,6 +6648,8 @@
<LI><A HREF="#4">Get helped with perl/CGI</A></LI>
<LI><A HREF="#5">Get helped with apache </A></LI>
+
+<LI><A HREF="#6">Get helped with DBI </A></LI>
</UL>
<P>
@@ -6360,9 +6694,9 @@
<H3><A NAME="2"></A>Get helped with mod_perl</H3>
<UL>
-<LI><A HREF="perl.apache.org">perl.apache.org </A>- mod_perl home </LI>
+<LI><A HREF="HTTP://perl.apache.org">perl.apache.org </A>- mod_perl home </LI>
-<LI><A HREF="www.modperl.com">www.modperl.com</A> - This is the home site
+<LI><A HREF="HTTP://www.modperl.com">www.modperl.com</A> - This is the home site
of The Apache Modules Book, a book about creating Web server modules using
the Apache API, written by Lincoln Stein and Doug MacEachern.</LI>
@@ -6450,7 +6784,30 @@
<LI><A HREF="http://www.apache.org/docs/misc/FAQ.html">The Apache FAQ</A></LI>
<LI><A HREF="http://www.apache.org/docs/">Apache Server Documentation</A></LI>
+
+<LI><A HREF="http://www.apache.org/docs/handler.html">Apache Handlers</A></LI>
+
</UL>
+
+<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B>
+<HR WIDTH="100%"></P>
+
+<H3><A NAME="6"></A>Get helped with DBI </H3>
+
+<UL>
+
+<LI><A HREF="http://eskimo.tamu.edu/~jbaker/dbi-examples.html">Perl DBI examples</A>
+by Jeffrey William Baker.</LI>
+
+<LI><a href="http://www.hermetica.com/technologia/DBI/">DBI at Hermetica</a>
+
+<LI><a href="http://www.fugue.com/dbi/">DBI mailing list information</a>
+
+<LI><a href="http://outside.organic.com/mail-archives/dbi-users/">DBI mailing list archives</a>
+
+<LI><a href="http://perl.apache.org/src/mod_perl.html#PERSISTENT_DATABASE_CONNECTIONS">Persistent connections with mod_perl</a>
+
+</UL>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B>
<HR WIDTH="100%"></P>
1.7 +36 -6 modperl-site/guide/config.html
Index: config.html
===================================================================
RCS file: /export/home/cvs/modperl-site/guide/config.html,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- config.html 1999/01/06 07:45:23 1.6
+++ config.html 1999/01/23 18:06:53 1.7
@@ -43,6 +43,8 @@
<LI><A HREF="#My_cgi_perl_code_is_being_return">My cgi/perl code is being returned as a plain text instead of being executed by the webserver?</A>
<LI><A HREF="#Script_working_under_cgi_bin_wh">Script working under cgi-bin, when called as mod_perl I see A 'Save-As' prompt</A>
<LI><A HREF="#Is_there_a_way_to_provide_a_diff">Is there a way to provide a different startup.pl file for each individual virtual host</A>
+ <LI><A HREF="#Is_there_a_way_to_modify_INC_on">Is there a way to modify @INC on a per-virtual-host basis. </A>
+ <LI><A HREF="#Sometimes_script_from_one_virtua">Sometimes script from one virtual host calls the script with the same path from the second virtual host</A>
</UL>
</UL>
@@ -228,9 +230,21 @@
use CGI ();
CGI->compile(':all');
-See also L<Apache::Status|status/Configuration>
+Note that starting from CGI::VERSION > 2.46, the new method for
+CGI->compile is:
</PRE>
<P>
+<PRE> use CGI qw(-compile :all);
+</PRE>
+<P>
+But the old method stays for backword compatibility.
+
+<P>
+See also <A HREF="././status.html#Configuration">Apache::Status</A>
+
+
+
+<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H2><A NAME="PerlFreshRestart">PerlFreshRestart</A></H2></CENTER>
<P>
@@ -327,13 +341,13 @@
and the lowest number of arguments will be shifted off the
<CODE>@List</CODE> or use array reference to handle any number greater than
the minimum for that directive push @Redirect, ``/foo'',
-``http://www.foo.com/'';;
+``http://www.foo.com/'';
<P>
-<PRE> push @Redirect, "/imdb", "<A HREF="http://www.imdb.com/"">http://www.imdb.com/"</A>;;;
+<PRE> push @Redirect, "/imdb", "<A HREF="http://www.imdb.com/"">http://www.imdb.com/"</A>;;
</PRE>
<P>
-<PRE> push @Redirect, [qw(temp "/here" "<A HREF="http://www.there.com"">http://www.there.com"</A>;;)];
+<PRE> push @Redirect, [qw(temp "/here" "<A HREF="http://www.there.com"">http://www.there.com"</A>;)];
</PRE>
<P>
Other section counterparts include %VirtualHost, <CODE>%Directory</CODE>
@@ -399,14 +413,30 @@
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H2><A NAME="Script_working_under_cgi_bin_wh">Script working under cgi-bin, when called as mod_perl I see A 'Save-As' prompt</A></H2></CENTER>
<P>
-Did you put <CODE>PerlSendHeader On</CODE> in the config part of the <CODE><Location foo</CODE></Location>>?
+Did you put <CODE>PerlSendHeader On</CODE> in the config part of the <Location foo></Location>?
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H2><A NAME="Is_there_a_way_to_provide_a_diff">Is there a way to provide a different startup.pl file for each individual virtual host</A></H2></CENTER>
<P>
+No. Any virtual host will be able to see the routines from a startup.pl
+loaded for any other virtual host.
+
+<P>
+<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
+<CENTER><H2><A NAME="Is_there_a_way_to_modify_INC_on">Is there a way to modify @INC on a per-virtual-host basis.</A></H2></CENTER>
+<P>
You can use 'PerlSetEnv PERL5LIB ...' or a PerlFixupHandler w/ the lib
pragma.
+
+<P>
+<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
+<CENTER><H2><A NAME="Sometimes_script_from_one_virtua">Sometimes script from one virtual host calls the script with the same path from the second virtual host</A></H2></CENTER>
+<P>
+It has been a bug before, last fixed in 1.15_01, i.e. if you're running
+1.15, that could be the problem. The other option to try is set this
+variable in a startup file (PerlRequire):
+$Apache::Registry::NameWithVirtualHost = 1;
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<P><A HREF="index.html">[Back to the main page]</A></P>
@@ -421,7 +451,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#author">Stas Bekman</A>.
- <BR>Last Modified at 01/03/99
+ <BR>Last Modified at 01/23/99
</FONT>
</B>
</TD>
1.8 +1 -1 modperl-site/guide/control.html
Index: control.html
===================================================================
RCS file: /export/home/cvs/modperl-site/guide/control.html,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- control.html 1999/01/06 07:45:23 1.7
+++ control.html 1999/01/23 18:06:53 1.8
@@ -813,7 +813,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#author">Stas Bekman</A>.
- <BR>Last Modified at 12/27/98
+ <BR>Last Modified at 01/16/99
</FONT>
</B>
</TD>
1.6 +7 -1 modperl-site/guide/debug.html
Index: debug.html
===================================================================
RCS file: /export/home/cvs/modperl-site/guide/debug.html,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- debug.html 1999/01/06 07:45:23 1.5
+++ debug.html 1999/01/23 18:06:53 1.6
@@ -58,6 +58,12 @@
<P>
PerlSetVar MOD_PERL_TRACE all
+<P>
+For example if you want to see a trace of the PerlRequire's and
+PerlModule's as they are loaded, use:
+
+<P>
+PerlSetVar MOD_PERL_TRACE d
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<P><A HREF="index.html">[Back to the main page]</A></P>
@@ -72,7 +78,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#author">Stas Bekman</A>.
- <BR>Last Modified at 12/27/98
+ <BR>Last Modified at 01/23/99
</FONT>
</B>
</TD>
1.7 +38 -6 modperl-site/guide/help.html
Index: help.html
===================================================================
RCS file: /export/home/cvs/modperl-site/guide/help.html,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- help.html 1999/01/06 07:45:23 1.6
+++ help.html 1999/01/23 18:06:54 1.7
@@ -10,10 +10,7 @@
<BODY TEXT="#000000" BGCOLOR="#E0FFFF" LINK="#0000EE" VLINK="#551A8B" ALINK="#FF0000">
-<H1 ALIGN=CENTER><A HREF="http://perl.apache.org"><IMG SRC="images/mod_perl.gif" ALT="Mod Perl Icon" BORDER=0 HEIGHT=30 WIDTH=90 ALIGN=LEFT></A><A HREF="http://perl.apache.org"><IMG SRC="images/mod_perl.gif" ALT="Mod Perl Icon" BORDER=0 HEIGHT=30 WIDTH=90
-
-
- ALIGN=RIGHT></A>
+<H1 ALIGN=CENTER><A HREF="http://perl.apache.org"><IMG SRC="images/mod_perl.gif" ALT="Mod Perl Icon" BORDER=0 HEIGHT=30 WIDTH=90 ALIGN=LEFT></A><A HREF="http://perl.apache.org"><IMG SRC="images/mod_perl.gif" ALT="Mod Perl Icon" BORDER=0 HEIGHT=30 WIDTH=90 ALIGN=RIGHT></A>
Help. Futher Learning</H1>
@@ -41,6 +38,9 @@
<LI><A HREF="#5">Get helped with apache </A></LI>
+
+
+<LI><A HREF="#6">Get helped with DBI </A></LI>
</UL>
@@ -96,10 +96,10 @@
<UL>
-<LI><A HREF="perl.apache.org">perl.apache.org </A>- mod_perl home </LI>
+<LI><A HREF="HTTP://perl.apache.org">perl.apache.org </A>- mod_perl home </LI>
-<LI><A HREF="www.modperl.com">www.modperl.com</A> - This is the home site
+<LI><A HREF="HTTP://www.modperl.com">www.modperl.com</A> - This is the home site
of The Apache Modules Book, a book about creating Web server modules using
the Apache API, written by Lincoln Stein and Doug MacEachern.</LI>
@@ -215,7 +215,39 @@
<LI><A HREF="http://www.apache.org/docs/">Apache Server Documentation</A></LI>
+
+
+<LI><A HREF="http://www.apache.org/docs/handler.html">Apache Handlers</A></LI>
+
+
</UL>
+
+
+<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B>
+<HR WIDTH="100%"></P>
+
+
+<H3><A NAME="6"></A>Get helped with DBI </H3>
+
+
+<UL>
+
+
+<LI><A HREF="http://eskimo.tamu.edu/~jbaker/dbi-examples.html">Perl DBI examples</A>
+by Jeffrey William Baker.</LI>
+
+<LI><a href="http://www.hermetica.com/technologia/DBI/">DBI at Hermetica</a>
+
+
+<LI><a href="http://www.fugue.com/dbi/">DBI mailing list information</a>
+
+
+<LI><a href="http://outside.organic.com/mail-archives/dbi-users/">DBI mailing list archives</a>
+
+<LI><a href="http://perl.apache.org/src/mod_perl.html#PERSISTENT_DATABASE_CONNECTIONS">Persistent connections with mod_perl</a>
+
+
+</UL>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B>
1.8 +28 -3 modperl-site/guide/index.html
Index: index.html
===================================================================
RCS file: /export/home/cvs/modperl-site/guide/index.html,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- index.html 1999/01/06 07:45:24 1.7
+++ index.html 1999/01/23 18:06:54 1.8
@@ -15,7 +15,7 @@
to your perl cgi-bin scripts.</B></P></CENTER>
-<CENTER><P><B>Version 1.05 Jan, 6 1999</B></P></CENTER>
+<CENTER><P><B>Version 1.06 Jan, 23 1999</B></P></CENTER>
<P>
@@ -41,7 +41,7 @@
<LI><A HREF="control.html">Server Controlling and Monitoring</A></LI>
-<LI><A HREF="porting.html">CGI => mod_perl Porting. mod_perl Coding guidelines.</A></LI>
+<LI><A HREF="porting.html">CGI to mod_perl Porting. mod_perl Coding guidelines.</A></LI>
<LI><A HREF="obvious.html">What is obvious for others but not for you</A>.</LI>
@@ -71,10 +71,35 @@
<LI><A HREF="CHANGES">CHANGES</A></LI>
-<LI><A HREF="http://www.apache.org/search.html">Search apache.org along with this guide</A></LI>
+<LI><A HREF="#search">Search perl.apache.org along with this guide</A></LI>
</UL>
+
+
+<HR>
+<CENTER>
+<TABLE BORDER=5 CELLSPACING=8 CELLPADDING=8 >
+<TR BGCOLOR="gray" ALIGN=CENTER VALIGN=TOP>
+<TD ALIGN=CENTER VALIGN=TOP>
+<FONT COLOR=WHITE SIZE=+1>
+<A NAME="SEARCH">Search perl.apache.org along with this guide</A>
+<FORM ACTION="http://search.apache.org/" METHOD="POST">
+<INPUT TYPE="text" NAME="keyword" SIZE=40>
+<input type="hidden" name="what" value="perl">
+<BR>
+Maximum number of records to return:
+<select name="results">
+<option value=20>20
+<option value=40>40
+<option value=60>60
+</select>
+<INPUT TYPE="submit" VALUE="Search">
+</FORM>
+</FONT>
+</TD></TR>
+</TABLE>
+</CENTER>
<CENTER><TABLE CELLSPACING=2 CELLPADDING=2 WIDTH="100%" >
1.7 +51 -1 modperl-site/guide/obvious.html
Index: obvious.html
===================================================================
RCS file: /export/home/cvs/modperl-site/guide/obvious.html,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- obvious.html 1999/01/06 07:45:24 1.6
+++ obvious.html 1999/01/23 18:06:54 1.7
@@ -32,6 +32,7 @@
<LI><A HREF="#Debugging_your_code_in_Single_Se">Debugging your code in Single Server Mode</A>
<LI><A HREF="#_M_and_other_time_file_tests_u">-M and other time() file tests under mod_perl</A>
<LI><A HREF="#Handling_the_User_pressed_Stop_">Handling the 'User pressed Stop button' case</A>
+ <LI><A HREF="#Where_do_the_warnings_errors_go_">Where do the warnings/errors go?</A>
</UL>
<!-- INDEX END -->
@@ -571,6 +572,55 @@
<P>
<PRE> $r->register_cleanup(sub {$CACHE{LOCK} = 0;});
</PRE>
+<P>
+<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
+<CENTER><H1><A NAME="Where_do_the_warnings_errors_go_">Where do the warnings/errors go?</A></H1></CENTER>
+<P>
+Your cgi doesn't work and you want to see what is the problem. The best
+idea is to checkout what the server error report. Where I can find this
+report?
+
+<P>
+Generally all the errors are being logged into an error_log file. The exact
+file location and name are defined in the http.conf file. Watch the
+<CODE>ErrorLog</CODE> parameter. My httpd.conf says:
+
+<P>
+<PRE> ErrorLog var/logs/error_log
+</PRE>
+<P>
+Hey, where is the beginning of the path? There is another apache's
+parameter called <CODE>ServerRoot</CODE>. Everytime apache sees a value of the parameter with no absolute path (e.g <CODE>/tmp/my.txt</CODE>) but with relative path (e.g <CODE>my.txt</CODE>) it prepends the value of the <CODE>ServerRoot</CODE> to this value. I have:
+
+<P>
+<PRE> ServerRoot /usr/local/apache
+</PRE>
+<P>
+So I will look for error_log file at
+<CODE>/usr/local/apache/var/logs/error_log</CODE>. Ofcourse you can use a absolute path to define the file's location at the
+filesystem.
+
+<P>
+<META>: is this 100% correct?
+
+<P>
+But there are cases when errors don't go to the error_log file. For example
+some errors are being printed to the console (tty) you have executed the
+httpd from (unless you redirected the httpd's stderr flow). This happens
+when the server didn't open the error_log file for writing yet. So if the
+error happens when server executes PerlRequire or PerlModule directive you
+might see the errors goes to the tty.
+
+<P>
+You are probably wander where all the errors go when you are running the
+server in the single mode (httpd -X). They go to the console. That's
+because when running in the single mode there is no parent httpd process
+who performs all the logging. It includes all the status messages that
+generally show up in the error_log file.
+
+<P>
+</META>
+
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<P><A HREF="index.html">[Back to the main page]</A></P>
@@ -585,7 +635,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#author">Stas Bekman</A>.
- <BR>Last Modified at 12/27/98
+ <BR>Last Modified at 01/23/99
</FONT>
</B>
</TD>
1.8 +45 -2 modperl-site/guide/performance.html
Index: performance.html
===================================================================
RCS file: /export/home/cvs/modperl-site/guide/performance.html,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- performance.html 1999/01/06 07:45:24 1.7
+++ performance.html 1999/01/23 18:06:54 1.8
@@ -28,6 +28,7 @@
<LI><A HREF="#Preload_Registry_Scripts">Preload Registry Scripts</A>
<LI><A HREF="#Avoid_Importing_Functions">Avoid Importing Functions</A>
<LI><A HREF="#Reducing_the_Memory_Usage">Reducing the Memory Usage</A>
+ <LI><A HREF="#how_can_I_find_if_my_modperl_scr">how can I find if my modperl scripts have memory leaks (and where)</A>
<LI><A HREF="#Limiting_the_size_of_the_process">Limiting the size of the processes</A>
<LI><A HREF="#Limiting_the_resources_used_by_h">Limiting the resources used by httpd children</A>
<LI><A HREF="#Limiting_the_request_rate_speed_">Limiting the request rate speed (robots blocking)</A>
@@ -381,7 +382,9 @@
}
</PRE>
<P>
-See also: perldoc Apache::RegistryLoader
+Note that we don't use here the second argument to the
+<CODE>handler().</CODE> You might need to provide a <CODE>trans()</CODE>
+method, since it's very dependant on your server's configuration. See <CODE>perldoc Apache::RegistryLoader</CODE> for the complete information.
<P>
You have to check whether it makes any good for you though, I did some
@@ -440,6 +443,46 @@
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
+<CENTER><H1><A NAME="how_can_I_find_if_my_modperl_scr">how can I find if my modperl scripts have memory leaks (and where)</A></H1></CENTER>
+<P>
+Apache::Leak (derived from Devel::Leak) should help you with this task.
+Example:
+
+<P>
+<PRE> use Apache::Leak;
+
+ my $global = "FooAAA";
+
+ leak_test {
+ $$global = 1;
+ ++$global;
+ };
+</PRE>
+<P>
+The argument to <CODE>leak_test()</CODE> is an anonymous sub, so you can
+just throw it around any code you suspect might be leaking. beware, it will
+run the code twice, because the first time in, new SVs are created, but
+does not mean you are leaking, the second pass will give better evidence.
+you do not need to be inside mod_perl to use it, from the command line, the
+above script outputs:
+
+<P>
+<PRE> ENTER: 1482 SVs
+ new c28b8 : new c2918 :
+ LEAVE: 1484 SVs
+ ENTER: 1484 SVs
+ new db690 : new db6a8 :
+ LEAVE: 1486 SVs
+ !!! 2 SVs leaked !!!
+</PRE>
+<P>
+Build a debuggable perl to see dumps of the SVs. the simple way to have
+both a normal perl and debuggable perl, is to follow hints in the SUPPORT
+doc for buildling libperld.a, when that is built copy the `perl' from that
+directory to your perl bin directory, but name it `dperl'.
+
+<P>
+<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H1><A NAME="Limiting_the_size_of_the_process">Limiting the size of the processes</A></H1></CENTER>
<P>
Apache::SizeLimit allows you to kill off Apache httpd processes if they
@@ -1505,7 +1548,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#author">Stas Bekman</A>.
- <BR>Last Modified at 12/27/98
+ <BR>Last Modified at 01/23/99
</FONT>
</B>
</TD>
1.9 +46 -17 modperl-site/guide/porting.html
Index: porting.html
===================================================================
RCS file: /export/home/cvs/modperl-site/guide/porting.html,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- porting.html 1999/01/06 07:45:24 1.8
+++ porting.html 1999/01/23 18:06:54 1.9
@@ -1,7 +1,7 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
- <TITLE>mod_perl guide: CGI => mod_perl Porting. mod_perl Coding guidelines.</TITLE>
+ <TITLE>mod_perl guide: CGI to mod_perl Porting. mod_perl Coding guidelines.</TITLE>
<META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
<META NAME="Author" CONTENT="Bekman Stas">
<META NAME="Description" CONTENT="mod_perl,perl,apache">
@@ -12,7 +12,7 @@
<H1 ALIGN=CENTER>
<A HREF="http://perl.apache.org"><IMG SRC="images/mod_perl.gif" ALT="Mod Perl Icon" BORDER=0 HEIGHT=30 WIDTH=90 ALIGN=LEFT></A>
<A HREF="http://perl.apache.org"><IMG SRC="images/mod_perl.gif" ALT="Mod Perl Icon" BORDER=0 HEIGHT=30 WIDTH=90 ALIGN=RIGHT></A>
-CGI => mod_perl Porting. mod_perl Coding guidelines.</H1>
+CGI to mod_perl Porting. mod_perl Coding guidelines.</H1>
<HR WIDTH="100%">
<!-- INDEX BEGIN -->
<P><A NAME="toc"></A><B><FONT SIZE=-1>Table of Contents:</FONT></B></P>
@@ -39,6 +39,7 @@
<LI><A HREF="#BEGIN_blocks">BEGIN blocks </A>
<LI><A HREF="#END_blocks">END blocks </A>
<LI><A HREF="#Switches_w_T">Switches -w, -T</A>
+ <LI><A HREF="#Switches_w_T">Switches -w, -T</A>
</UL>
<LI><A HREF="#strict_pragma">strict pragma</A>
@@ -339,8 +340,7 @@
Perl's <CODE>exit()</CODE> built-in function cannot be used in mod_perl
scripts. Unless you want the server child to exit (which makes the whole
idea of using mod_perl irrelevant). The Apache::exit() function should be
-used instead. Apache::exit() automatically overrides the built-in
-<CODE>exit()</CODE> for Apache::Registry scripts.
+used instead.
<P>
You might start you scripts with overriding the exit sub (if you use
@@ -365,16 +365,38 @@
}
</PRE>
<P>
-Now every time the select will be called the correct exit will be picked,
-no matter if you run the script as cgi or from shell.
+Now every time the select code will be called and the correct exit will be
+picked, no matter if you run the script as cgi or from shell.
<P>
-<STRONG>Note</STRONG> that if you run the script under Apache::Registry, <STRONG>The Apache
-function `exit' overrides the Perl core built-in function</STRONG>. While you see the <CODE>exit()</CODE> listed in <CODE>@EXPORT_OK</CODE>
+<STRONG>Note</STRONG> that if you run the script under <CODE>Apache::Registry</CODE>, <STRONG>The
+Apache function `exit' overrides the Perl core built-in
+function</STRONG>. While you see the <CODE>exit()</CODE> listed in <CODE>@EXPORT_OK</CODE>
of Apache package, Apache::Registry makes something you don't see and
-imports this function for you.
+imports this function for you. (which means that if your script is running
+under Apache::Registry handler, you don't have to worry about
+<CODE>exit(),</CODE> Apache::PerlRun as well)
+
+<P>
+<STRONG>Note</STRONG> that if you still use CORE::exit() in your scripts running under modperl,
+the child will exit, but neither proper exit nor logging will happen on the
+way. CORE::exit() cuts off server's legs... If you need to properly
+shutdown the child , use $r->child_terminate (which sets the internal
+MaxRequestsPerChild so the child will exit).
+
+<P>
+You can accomplish that in 2 ways - in the Apache::Registry script:
+
+<P>
+<PRE> Apache->request->child_terminate;
+</PRE>
+<P>
+in httpd.conf:
<P>
+<PRE> PerlFixupHandler "sub { shift->child_terminate }"
+</PRE>
+<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H3><A NAME="Running_from_shell">Running from shell</A></H3></CENTER>
<P>
@@ -502,18 +524,16 @@
<P>
Normally when you run perl from the command line or have the shell invoke
it with `#!', you may choose to pass perl switch arguments such as -w or
--T. Since the command line is only parsed once, when the server starts,
-these switches are unavailable to mod_perl scripts. However, most command
-line arguments have a equivalent special variable. For example, the $^W
-variable corresponds to the -w switch. Consult perlvar for more details.
-With mod_perl it is also possible to turn on warnings globally via the
-PerlWarn directive:
+-T. Most command line arguments have a equivalent special variable. For
+example, the $^W variable corresponds to the -w switch. Consult perlvar for
+more details. With mod_perl it is also possible to turn on warnings
+globally via the PerlWarn directive:
<P>
<PRE> PerlWarn On
</PRE>
<P>
-You can turn it off with <CODE>local $^W = 0;</CODE> in your scripts on the local basis (or inside the block).
+You can turn it off with <CODE>local $^W = 0;</CODE> in your scripts on the local basis (or inside the block). If you write <CODE>$^W = 0;</CODE> you disable the warn mode everywhere, the same with <CODE>$^W = 1;</CODE>.
<P>
The switch which enables taint checks does not have a special variable, so
@@ -531,6 +551,15 @@
startup flags such as -d and -D. See perlrun.
<P>
+If you have the shebang line (#!/bin/perl -wT) in your script, <STRONG>-w</STRONG>
+will be honored (which means that you have turned the warn mode on for the
+scope of this script, <STRONG>-T</STRONG> will produce a warning if
+<CODE>PerlTaintCheck</CODE> isn't <CODE>On</CODE>.
+
+<P>
+<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
+<CENTER><H3><A NAME="Switches_w_T">Switches -w, -T</A></H3></CENTER>
+<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H2><A NAME="strict_pragma">strict pragma</A></H2></CENTER>
<P>
@@ -1118,7 +1147,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#author">Stas Bekman</A>.
- <BR>Last Modified at 12/27/98
+ <BR>Last Modified at 01/23/99
</FONT>
</B>
</TD>
1.7 +13 -5 modperl-site/guide/scenario.html
Index: scenario.html
===================================================================
RCS file: /export/home/cvs/modperl-site/guide/scenario.html,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- scenario.html 1999/01/06 07:45:24 1.6
+++ scenario.html 1999/01/23 18:06:55 1.7
@@ -27,7 +27,7 @@
<LI><A HREF="#httpd_perl_server_mod_perl_">httpd_perl server (mod_perl):</A>
</UL>
- <LI><A HREF="#Is_it_possible_to_install_mod_pe">Is it possible to install mod_perl without root access?</A>
+ <LI><A HREF="#Is_it_possible_to_install_and_us">Is it possible to install and use apache/mod_perl without having a root access?</A>
</UL>
<!-- INDEX END -->
@@ -224,6 +224,11 @@
% make clean
</PRE>
<P>
+It's important to <STRONG>make clean</STRONG> since some of the versions aren't binary compatible (e.g apache 1.3.3 vs
+1.3.4) so any ``third-party'' C modules need to be re-compiled against the
+1.3.4 header files.
+
+<P>
Here I didn't find a way to compile with gcc (but perl was compiled with cc
so we have to compile with the same compiler!!!
@@ -255,8 +260,11 @@
/usr/apps/sbin/httpd_perl/httpd the original version sits at
/usr/apps/usr/src/httpd_perl/apache_1.3.2/src/httpd
+<P>
+If make test fails, look into t/logs and see what's in there.
+
<P>
-rename the 'httpd' to 'http_perl'
+rename the 'httpd' to 'httpd_perl'
<P>
<PRE> % mv /usr/apps/sbin/httpd_perl/httpd /usr/apps/sbin/httpd_perl/httpd_perl
@@ -273,14 +281,14 @@
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
-<CENTER><H1><A NAME="Is_it_possible_to_install_mod_pe">Is it possible to install mod_perl without root access?</A></H1></CENTER>
+<CENTER><H1><A NAME="Is_it_possible_to_install_and_us">Is it possible to install and use apache/mod_perl without having a root access?</A></H1></CENTER>
<P>
Yes, no problem with that. Follow the instructions above and when you
encounter APACI_ARGS use your home directory or alike as a prefix (e.g
<CODE>/home/stas/www</CODE>) and everything will be installed there. There is a chance that some perl
libs will be not installed on your server by root and you will have to
install these locally too. See the <A
-HREF="http://www.esafe.com/stas/TULARC/webmaster/myfaq.html#7">http://www.esafe.com/stas/TULARC/webmaster/myfaq.html#7</A>
+HREF="http://www.singlesheaven.com/stas/TULARC/webmaster/myfaq.html#7">http://www.singlesheaven.com/stas/TULARC/webmaster/myfaq.html#7</A>
for more information on local perl installations.
<P>
@@ -318,7 +326,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#author">Stas Bekman</A>.
- <BR>Last Modified at 12/27/98
+ <BR>Last Modified at 01/23/99
</FONT>
</B>
</TD>
1.6 +149 -1 modperl-site/guide/snippets.html
Index: snippets.html
===================================================================
RCS file: /export/home/cvs/modperl-site/guide/snippets.html,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- snippets.html 1999/01/06 07:45:24 1.5
+++ snippets.html 1999/01/23 18:06:55 1.6
@@ -20,6 +20,9 @@
<LI><A HREF="#Redirecting_Errors_to_Client_ins">Redirecting Errors to Client instead of error_log</A>
<LI><A HREF="#Sending_MIME_headers">Sending MIME headers</A>
+ <LI><A HREF="#How_to_avoid_printing_the_header">How to avoid printing the header more than once.</A>
+ <LI><A HREF="#More_on_relative_paths">More on relative paths</A>
+ <LI><A HREF="#Watching_the_error_log_file_with">Watching the error_log file without telneting to the server.</A>
</UL>
<!-- INDEX END -->
@@ -49,6 +52,151 @@
<P>
Also there is $ENV{PERL_SEND_HEADER} to see if PerlSendHeader is On or Off.
+<P>
+<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
+<CENTER><H1><A NAME="How_to_avoid_printing_the_header">How to avoid printing the header more than once.</A></H1></CENTER>
+<P>
+I'm sure you have been in the situations, where you wish you knew whether
+the MIME header has been already printed. Since if it was printing it again
+will cause an ugly ``Content-type: ...'' string show up at the web page. So
+how do we solve it? With help of closure.
+
+<P>
+Just copy the code below as it is, including the block's curly parentheses.
+And everywhere in your code use the <CODE>print_header()</CODE> sub to
+print the header. <CODE>$need_header</CODE> is the same beast as static variable in C, so it remembers its value from
+call to call.
+
+<P>
+<PRE> {
+ my $need_header = 1;
+ sub print_header {
+ print header(@_),$need_header = 0 if $need_header;
+ }
+ }
+</PRE>
+<P>
+<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
+<CENTER><H1><A NAME="More_on_relative_paths">More on relative paths</A></H1></CENTER>
+<P>
+Many use a relative require call, or write to the file in the current or
+relative to the current directory. But this will fail if you wouldn't
+<CODE>chdir()</CODE> into the directory first. So you have to either do
+this in the code or to use a nice <CODE>FindBin.pm</CODE> package.
+
+<P>
+<PRE> use FindBin qw($Bin);
+ use lib $Bin;
+ # or
+ open IN, "$Bin/foo.txt";
+</PRE>
+<P>
+Now <CODE>$Bin</CODE> includes the path of the directory the script resides on, so you can move
+the script from one directory to the other and call it from anywhere else,
+the pathes will be always correct.
+
+<P>
+It's different from using the ``./foo'', for you have to chdir to the
+directory the script located at first. (Think about crontabs!!!)
+
+<P>
+<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
+<CENTER><H1><A NAME="Watching_the_error_log_file_with">Watching the error_log file without telneting to the server.</A></H1></CENTER>
+<P>
+I wrote this script long time ago, when I have had to debug my cgi scripts
+but I didn't have the access to the error_log file. I have asked the admin
+to install this script and happily used it since then.
+
+<P>
+If your scripts are running on these 'Get-free-site' servers, and your
+cannot debug your script because you can't telnet to the server or can't
+see the error_log, you can ask your sysadmin to install this script.
+
+<P>
+Ok, here is the code:
+
+<P>
+<PRE> #!/usr/bin/perl -Tw
+
+ use strict;
+ $|=1;
+
+ my $default = 10;
+ my $error_log = "/usr/local/apache/var/logs/error_log.1";
+ use CGI;
+
+ # untaint $ENV{PATH}
+ $ENV{'PATH'} = '/bin:/usr/bin';
+ delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
+
+ my $q = new CGI;
+
+ my $counts = (defined $q->param('count') and $q->param('count'))
+ ? $q->param('count') : $default;
+
+ print $q->header,
+ $q->start_html(-bgcolor => "white",
+ -title => "Error logs"),
+ $q->start_form,
+ $q->center(
+ $q->b('How many lines to fetch? '),
+ $q->textfield('count',10,3,3),
+ $q->submit('', 'Fetch'),
+ $q->reset,
+ ),
+ $q->end_form,
+ $q->hr;
+
+
+ print($q->b("$error_log doesn't exist!!!")),exit unless -e $error_log;
+
+ open LOG, "tail -$counts $error_log|" or die "Can't open tail on $error_log :$!\n";
+ my @logs = <LOG>;
+ print $q->b('Note: Latest logs on the top'),$q->br;
+
+ print "<UL>\n";
+
+ # format and colorize each line nicely
+ foreach (reverse @logs) {
+ s{
+ \[(.*?)\]\s* # date
+ \[(.*?)\]\s* # type of error
+ \[(.*?)\]\s* # client
+ (.*) # the message
+ }
+ {
+ "[$1] <BR> [".
+ colorize($2,$2).
+ "] <BR> [$3] <PRE>".
+ colorize($2,$4).
+ "</PRE>"
+ }ex;
+ print "<BR><LI>$_<BR>";
+ }
+
+ print "</UL>\n";
+
+ close LOG;
+
+ #############
+ sub colorize{
+ my ($type,$context) = @_;
+
+ my %colors =
+ (
+ error => 'red',
+ crit => 'black',
+ notice => 'green',
+ warn => 'brown',
+ );
+
+ return exists $colors{$type}
+ ? qq{<B><FONT COLOR="$colors{$type}">$context</FONT></B>}
+ : $context;
+ }
+
+
+</PRE>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<P><A HREF="index.html">[Back to the main page]</A></P>
@@ -63,7 +211,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#author">Stas Bekman</A>.
- <BR>Last Modified at 12/27/98
+ <BR>Last Modified at 01/23/99
</FONT>
</B>
</TD>
1.7 +7 -9 modperl-site/guide/start.html
Index: start.html
===================================================================
RCS file: /export/home/cvs/modperl-site/guide/start.html,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- start.html 1999/01/06 07:45:25 1.6
+++ start.html 1999/01/23 18:06:55 1.7
@@ -40,7 +40,7 @@
<LI><A HREF="#Testing_by_checking_the_error_lo">Testing by checking the error_log file</A>
<LI><A HREF="#Testing_by_calling_the_perl_sta">Testing by calling the /perl-status </A>
- <LI><A HREF="#Testing_by_telneting_to_the_port">Testing by telneting to the port server's listening to</A>
+ <LI><A HREF="#Testing_by_telneting_to_the_port">Testing by telneting to the port, server's listening to</A>
<LI><A HREF="#Run_a_cgi_that_shows_you_your_se">Run a cgi that shows you your server's environment</A>
<LI><A HREF="#with_lwp_request">with lwp-request</A>
</UL>
@@ -78,7 +78,7 @@
HREF="http://www.perl.com.">http://www.perl.com.</A> Try the direct
download link <A
HREF="http://www.perl.com/pace/pub/perldocs/latest.html.">http://www.perl.com/pace/pub/perldocs/latest.html.</A>
-As of this writing the latest maintain (production) release is perl5.00503.
+
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
@@ -86,8 +86,7 @@
<P>
Get the latest apache webserver from <A
HREF="http://www.apache.org.">http://www.apache.org.</A> Try the direct
-download link [http://www.apache.org/dist/]. As of this writing the latest
-production release is apache-1.3.3.
+download link [http://www.apache.org/dist/].
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
@@ -95,8 +94,7 @@
<P>
Get the latest mod_perl from <A
HREF="http://perl.apache.org.">http://perl.apache.org.</A> Try the direct
-download link [http://perl.apache.org/dist/]. As of this writing the latest
-production release is mod_perl-1.16_02
+download link [http://perl.apache.org/dist/].
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
@@ -186,7 +184,7 @@
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H1><A NAME="How_can_I_tell_whether_mod_perl_">How can I tell whether mod_perl is really installed</A></H1></CENTER>
<P>
-There a few ways. In older versions of apache you could see that by running <CODE>httpd -v</CODE>, it's no longer work!
+There a few ways. In older versions of apache ( < 1.3.2 ?) you could check that by running <CODE>httpd -v</CODE>, it no longer works!
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
@@ -214,7 +212,7 @@
</PRE>
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
-<CENTER><H2><A NAME="Testing_by_telneting_to_the_port">Testing by telneting to the port server's listening to</A></H2></CENTER>
+<CENTER><H2><A NAME="Testing_by_telneting_to_the_port">Testing by telneting to the port, server's listening to</A></H2></CENTER>
<P>
Assume that you set <CODE>Port 8080</CODE> in the httpd.conf for your mod_perl server. You have to telnet to your
server port 8080, then you should type <CODE>HEAD / HTTP/1.0</CODE> then press the <ENTER> key TWICE!
@@ -367,7 +365,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#author">Stas Bekman</A>.
- <BR>Last Modified at 01/03/99
+ <BR>Last Modified at 01/23/99
</FONT>
</B>
</TD>
1.7 +1 -1 modperl-site/guide/status.html
Index: status.html
===================================================================
RCS file: /export/home/cvs/modperl-site/guide/status.html,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- status.html 1999/01/06 07:45:25 1.6
+++ status.html 1999/01/23 18:06:55 1.7
@@ -122,7 +122,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#author">Stas Bekman</A>.
- <BR>Last Modified at 12/27/98
+ <BR>Last Modified at 01/16/99
</FONT>
</B>
</TD>
1.7 +1 -1 modperl-site/guide/warnings.html
Index: warnings.html
===================================================================
RCS file: /export/home/cvs/modperl-site/guide/warnings.html,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- warnings.html 1999/01/06 07:45:25 1.6
+++ warnings.html 1999/01/23 18:06:55 1.7
@@ -373,7 +373,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#author">Stas Bekman</A>.
- <BR>Last Modified at 01/06/99
+ <BR>Last Modified at 01/16/99
</FONT>
</B>
</TD>