Wordpress 2.5 RC2 and CoppermineSC
Thursday, March 27th, 2008 at 1:30 pm
Update: The plugin author, Brad, has fixed this issue and has released an updated version.
If you don’t already know Wordpress 2.5 RC2 is out now. I’m now using it but I had a major issue with one plugin: CoppermineSC. This plugin allows me to tie my Coppermine photo gallery into my Wordpress blog. When activated it broke all my other plugins and WP functions. I really can’t run my sites without this plugin so it was imperative that found a solution to this problem. After several days of fretting and research I’ve solved the problem.
When mysql_connect() is called more than once with the same host, user, and password then the connection becomes shared. Wordpress makes the DB connection once and then the plugin makes the connection again. In my case it’s to the same host, user, and password so now Wordpress is trying to connect to my Coppermine database and fails.
The solution is to change one line of the CoppermineSC code (line 1093) as follows:
$this->cpgscdbh = @mysql_connect($dbhost, $dbuser, $dbpassword, TRUE);
This tells PHP to create a separate connection and will allow Wordpress to utilize it’s existing connection to its database and CoppermineSC to utilize the connection to the Coppermine DB without clobbering WP’s connection. Here’s more info from the PHP pages.
I hope this might help others suffering from the same problem and allow you to have your new Wordpress and keep your Coppermine integration (at least until the plugin author modifies his code).
FACT: Chuck Norris can slam a revolving door.

Leave a Reply