Two connections to same database from single domain
I have a CMS website built with codeigniter. In that site i have a blogging section which is using WordPress
codeigniter connects to MySQL using its class and WordPress connects using its class
site is hosted in shared hosting with godaddy.
connection to database breaks in between browsing sometimes WordPress connects to database and sometimes the codeigniter, but using phpmyadmin i can always connect.
i contacted the server people and they said its not their problem since i am able to connect using phpmyadmin
is one or both using a persistant connection but each is using different login details?
...
Actually thinking about it
Seems likely that each one is over writting the others classes. Say they construct the class then store the object in a session thats being over ridden? Or only establish a persistant connection on construct.
Unless you are somehow invoking WordPress from within your CI application (or vice versa), it should not matter. If either or both are using persistent connections via mysql_pconnect(), I would recommend changing them to use the regular, non-persistent mysql_connect(), as persistent connections have a tendency to eat up DB processes instead of the expected saving of processes, unless everything about your application and DB environment and configuration is just so.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Bookmarks