Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Session values in mysql

by varghees (Novice)
on Aug 03, 2007 at 02:42 UTC ( [id://630431]=perlquestion: print w/replies, xml ) Need Help??

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://630431]
Approved by ysth
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-04-19 14:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found