What is required:
1. A web server with Apache installed w/ mod_perl
2. A permission scheme that allows full directive control
from the directory's .htaccess file
3. A database (I used MySQL)
4. The ability to install perl modules somewhere
My setup:
I use carpediem-it.co.uk for my ISP: they allow shell access,
MySQL, and have apache configured with mod_ssl. While shell
access might not be essential, I can't really imagine debugging
the issues with getting the perl modules installed without having
shell access. Note that at no point in the installation process
did I need to become root or restart apache or mysql.
The problems:
I encountered the following problems when getting the installation
going.
1. The install script requires root for all sorts of things. You
will need to do a manual installation.
2. Scoop.pm expects to be able to connect to MySQL over a port. In
my case, the MySQL databases do not listen on the ports, by
can only be accessed though a socket file. Some hacking of the
Scoop.pm file fixed this.
3. .htaccess files do not allow directives for subdirectories. This
means that images, which the default installation puts in a subdirectory
of the main directory, are processed by the scoop handler. The only
way around this was to put the scoop directory and the images in
separate directories. In my case, the directory for pages was:
/home/bob/web/, and I wound up putting the scoop .htaccess file
in /home/bob/web/scoop/, the images in /home/bob/web/images/,
and then putting a little .php file at /home/bob/web/index.php
that would just redirect people to the /scoop/ subdirectory
(so that people that hit www.sitename.com would be redirected
to the scoop handler).
Recommendations:
1. Given that it is possible to install without root, it would be nice
if the installer gave this option. It could even run through some
self-tests to make sure that the apache configuration allows the
required level of control from the .htaccess file.
2. Make conncting over the mysql socket an option rather than a hack.
3. Fix the image problem by having scoop check to see if the request
is for an image type, and return the image via the handler. Yes, this
would be slow.
Editing Scoop.pm:
my $dbname = $self->CONFIG->{db_name};
my $username = $self->CONFIG->{db_user};
my $password = $self->CONFIG->{db_pass};
my $dbhost = $self->CONFIG->{db_host};
# Set the DB connection. Should use persistent connections via Apache::DBI
# my $data_source = "DBI:mysql:database=$dbname:host=$dbhost";
# =========================================
# For a shared machine, we often only access
# MySQL though a socket file, rather than a
# port.
# =========================================
my $data_source = "DBI:mysql:database=$dbname:mysql_socket=$dbhost";
my $dbh = DBI->connect($data_source, $username, $password) ||
warn " (Scoop::_set_dbh) Can't connect to database! $@\n";
Sample .htaccess file:
<perl>
use lib qw( /PATH/TO/WRITEABLE/DIRECTORY/perl/lib );
use lib qw( /PATH/TO/WRITEABLE/DIRECTORY/scoop/scoop/lib );
</perl>
SetHandler perl-script
PerlHandler Scoop::ApacheHandler
##################################
# Edit these variables to match your
# local setup. Note that this is now the
# *only* place you need to enter this
# stuff.
##################################
# Pick which Database you're using
# The only scoop DB supported is mySQL
PerlSetVar DBType mySQL
# PerlSetVar DBType Oracle
# PerlSetVar DBType postgres
# PerlSetVar DBType mSQL
# PerlSetVar DBType Sybase
## One MySQL specific Thing:
# Set the version of mysql you're using
# this is here to preserve compatibility with
# 3.22 and 3.23. Should be one of these two values.
PerlSetVar mysql_version 3.23
############################
## Some Oracle Specific stuff:
# Standard ORACLE_HOME Env
# PerlSetVar ORACLE_HOME /oraexe/app/oracle/product/8.1.5
# Schema information for Oracle
# if you're going to be using a different login and no aliasing
# if you're not sure that you need this, ask your DBA
# PerlSetVar Schema scoop
############################
# Database Config:
# The name of your scoop Database
# will become 'TWO_TASK' ENV if Oracle
PerlSetVar db_name SITENAME
# The host where mySQL is running
PerlSetVar db_host /PATH/TO/MYSQL/SOCKET/FILE
# The user to connect as
PerlSetVar db_user SITENAME
# The user's database password
PerlSetVar db_pass abraxas
# Set below to your host name if you're
# using a two-server proxy type system.
# It will let the mod_perl server know what
# name it's supposed to go by. Most will just leave
# this alone.
#PerlSetVar mailname www.mysite.com
PerlSetVar mailname SITENAME.com
# This is the path to the VERSION file in scoop, will be
# used with op=stats eventually
<perl>
my $vfile = '/PATH/TO/WRITEABLE/DIRECTORY/scoop/scoop/VERSION';
my $v = do $vfile;
push(@{ $Location{'__URL_PATH__'}->{PerlSetVar} },
[ scoop_version => $v->{Version} ],
[ scoop_date => $v->{Date} ],
[ scoop_revision => $v->{Revision} ],
[ scoop_author => $v->{Author} ],
[ scoop_state => $v->{State} ]
);
</perl>
# Cookie config-- put the host name for cookie targeting here.
# Note that it *must* have at least 2 dots-- so to send
# cookies to any host in 'foo.org', enter ".foo.org"
# The "path" part of the cookie will be done automagically
# using the "rootdir" var (you DID set that, right? Read INSTALL)
PerlSetVar cookie_host .SITENAME.com
# Mail::Sendmail Config-- enter your SMTP host here
PerlSetVar SMTP localhost
# Enter a "site id" below-- Any string is fine, just
# make sure it's unique for this partuclar site.
PerlSetVar site_id SITENAME.com
# Enter a site key below. This is used as the key for
# some Blowfish encrypted form variables, which are
# used to prevent IP spoofing. It can be as long as you
# like, and needs to be as unguessable as possible.
# DO NOT USE AN OBVIOUS VALUE! A bunch of quasi-random
# characters will do.
# ex: mmDfhbT4837%jQQaamOF0)(#??/Q
PerlSetVar site_key HUfef9ye78&*(%&)ewfhiip897
# You can now add mirrors of your images, distributed
# geographically. Make sure that the "value"
# part of the following has quotes around it. Otherwise,
# it works like a hash. Make the key a descriptive word,
# and the value the *full URL* to the images/ directory.
# Separate servers with a comma, and make sure to escape newlines
# with a backslash. Example:
#PerlSetVar image_mirrors "Australia => http://images.au.mysite.org,\
# UK => http://images.uk.mysite.org"
# This should be the full path the the startup.pl file in your scoop install
PerlRequire /PATH/TO/WRITEABLE/DIRECTORY/scoop/scoop/etc/startup.pl