For persistent database connections, I think you should take a look at using mod_perl or FastCGI, along with something like Apache::DBI. Regular scripts will close the database connection when they exit. I don't think there's anyway to avoid that.
Comment on Re^3: storing database handle object in a variable