|Think about Loose Coupling|
Using ModPerl::Registry without rootby dmorgo (Pilgrim)
|on May 22, 2004 at 21:26 UTC||Need Help??|
ModPerl::Registry is the mod_perl2 version of Apache::Registry. This is not intended to be a complete mod_perl tutorial, but is more of a recipe that shows how to get a simple mod_perl2 script up and running on a server that meets the following conditions:
For the pedantic, a more technically correct title for this node might be "Using ModPerl::Registry when you don't have an account that has or are not in a group that has write access to httpd.conf, and can't convince the sysadmin to edit it, and can't change hosts, and..." but I think "Using ModPerl::Registry without root", while less accurate, is a snappier title.
This has been tested with mod_perl 1.99_09. YMMV.
First, check the httpd.conf setup. The file is often in a directory like /usr/local/apache/conf. It should contain something like this:
Then you need three more files:
1. ~/public_html/.htaccess, containing these lines:
2. ~/public_html/TestModPerl.pm, containing this:
(The following example is adapted from the example in Stas Bekman's tutorial "Getting Started With mod_perl".)
3. ~/public_html/modperl-test.pl, containing this:
Now access the URL for your script to see the result:
If things are working as intended, you will see the count go from one to five with each invocation (as you hit refresh) and you will see the total climb incrementally across invocations. So after three invocations it will look like this:
Counter is equal to 1!