Re: cgi and php database interaction
[email protected] (Paweł Prędki) Wed, 02 Dec 2009 00:54:28 +0100
| Newsgroups | perl.beginners.cgi |
|---|---|
| Message-ID | <[email protected]> |
I changed the topic of the e-mail. Sorry for the confusion. Paweł Prędki pisze: > Hello, > I have a website that uses a php engine for news generation and, > basically, most of the other pages. It uses a MySQL database to store > the majority of the page contents (i.e. news). > > However, I've written before that I've started using simple CGI scripts > in Perl to make some activities automatic (i.e. statistics updates, > standings updates - it's a sports-related website :) ). > > At first, I used the Storable module and kept all the data in flat files > but it generally is not the best solution so I moved to DBI. > > Now, the thing is that the PHP scripts also connect to the database and, > presumably, uphold the connection over the duration of the session so as > not to disconnect and reconnect continually when the user browses the > website. > > My question is - is it possible to do the same thing with those CGI > scripts? At the moment, each script 'requires' a module where a function > is defined which returns a database handle upon connecting to the > database. This is not an efficient solution and I would like to change > that. There is no mod_perl running on the server but maybe there is a > way to keep the connection via some Apache mechanisms. I'm not > experienced with the server operation that much so forgive me if what I > wrote is hogwash ;) > Cheers, > Pawl >