varghees has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I am using CGI/Perl, Apache and Mysql. Is there any way I can configure in httpd.conf to store session data in mysql instead of files?

Replies are listed 'Best First'.
Re: Session values in mysql
by atemon (Chaplain) on Aug 03, 2007 at 03:21 UTC

    Hi,

    Hope that Apache::Session::MySQL is of your choice. :)

    Cheers !

    --VC



    There are three sides to any argument.....
    your side, my side and the right side.

Re: Session values in mysql
by blue_cowdawg (Monsignor) on Aug 03, 2007 at 03:19 UTC

    This is Perl Monks... not Apache Monks. Perhaps you can find answers here.


    Peter L. Berghold -- Unix Professional
    Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg
Re: Session values in mysql
by scorpio17 (Canon) on Aug 03, 2007 at 14:08 UTC

    Have you read the docs for CGI::Session on CPAN? Be sure to look at CGI::Session::Driver::DBI also (may not be immediately obvious). All you need to do to store session data in mysql is create a session like this:

    # need to customize 'table', 'username' and 'password' my $dbh = DBI->connect("dbi:mysql:table", "username", "password"); my $session = CGI::Session->new("driver:mysql;serializer:storable;id:m +d5", undef, {Handle => $dbh});

    So you don't need to modify the apache config file. You CAN use Apache::DBI to enable persistent database connections, but I would recommend getting the basic idea working first, then use that to improve performance, if necessary.