PHP Persistant MySQL Connections

software development

#1

I am in the process of building another website on dreamhost and am trying to make sure that the site is fairly optimized because as I expand I want to make sure that I don’t cause an problems on the server I’m on for me or other customers.

One of the things I have read is that establishing MySQL connections is very expensive in terms of processor usage, especially when compared to using an already established connection.

After reading this, I found out about persistant MySQL connections on php.net. However, I then found out that doesn’t work with PHP installed as a CGI wrapper. Looking around dreamhost’s website and PHP information it seems like PHP is setup as CGI. Which means that persistent connections wouldn’t work. I was wondering if anyone can confirm this information or not, and maybe give some suggestions if I can’t use persistent connections.


#2

PHP is set up by default as a CGI, you can change it to run as an Apache module on the manage domains interface (when you set up hosting). However, they usually recommend against this. I don’t actually remember why at the moment, I believe it’s security related.

================================
Angela Gann
CrimsonDryad Web Design Services
Web Design, Custom Software Development
http://www.crimsondryad.com


#3

Hi, Angela!

It’s good to see you here again! Just a comment re.

While that used to be true, DH disabled that choice when setting up a domain a while ago. Old (existing) domains that had been set up to run mod_php still have the ability to run that way (at least for now), but the “choice” is no longer available to new domains, and once a change is made from the panel to change the choice of PHP to use for a domain (there are now only choices for PHP4-CGI and PHP5-CGI), you can’t change back to using mod_php.

That said, there is a workaround for running mod_php described on blog.dreamhosters.com that currently still works, allowing you to run PHP 4 as mod_php.

–rlparker


#4

Actually, there is a workaround for running mod_php described on blog.dreamhosters.com that currently still works, allowing you to run PHP 4 as mod_php. I know of no way to rum PHP5 as mod_php on Dreamhost, so that idea won’t work if you need PHP5. :wink:

–rlparker