Running the Multi-DB plugin causes php5-fpm to fail

Hi, I'm having some trouble.
I'm trying to set up the multi-db plugin, and I've gotten as far as clicking on the "Click here" on the move-blogs.php script (step 4).

At this point it will think for a bit, and then either return a 504 Timeout, or it seems like it finished the script, but when I refresh the page (step 6) nothing has changed.

Now, when the 504 error is returned, it also causes some problem with php5-fpm (I'm using Nginx), I actually have to restart the service to get it all going again.

Here is some relevant info from my logs:
From Nginx Error Log:

PHP message: PHP Warning:  mysql_free_result() expects parameter 1 to be resource, string given in /var/www/example.com/htdocs/wp-content/scripts/move-blogs.php on line 125" while reading upstream, client: 12.34.56.78, server: example.com, request: "GET /wp-content/scripts/move-blogs.php?table=copy HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "example.com", referrer: "http://example.com/wp-content/scripts/move-blogs.php"
2013/04/18 13:10:10 [error] 44893#0: *1303 FastCGI sent in stderr: "PHP message: PHP Warning:  mysql_free_result() expects parameter 1 to be resource, string given in /var/www/example.com/htdocs/wp-content/scripts/move-blogs.php on line 124
2013/04/18 13:43:37 [error] 44893#0: *1376 FastCGI sent in stderr: "PHP message: WordPress database error  for query SELECT * FROM wp_blogs WHERE domain = 'example.com' AND path = '/musicandinstruments/' made by require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), require('wp-includes/ms-settings.php'), get_blog_details, m_wpdb->query
PHP message: WordPress database error  for query SELECT * FROM wp_blogs WHERE domain = 'example.com' AND path = '/' made by require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), require('wp-includes/ms-settings.php'), get_blog_details, m_wpdb->query" while reading response header from upstream, client: 12.34.56.78, server: example.com, request: "GET /musicandinstruments/wp-content/plugins/qodys-pinner/datatypes/click/api/record.php?pid=9121&r=1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "example.com"

2013/04/18 17:30:07 [error] 44893#0: *1995 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: table in /var/www/example.com/htdocs/wp-content/scripts/move-blogs.php on line 61" while reading response header from upstream, client: 12.34.56.78, server: example.com, request: "GET /wp-content/scripts/move-blogs.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "example.com"

Now, when it actually completes the script, it does affect a few of the databases to where it says "table in new db" So far there are only about 50 out of 100 tables that have been affected.

So does anybody know what sort of settings I might have wrong that is keeping this from working properly??? :slight_smile:

If you need more info, please let me know. Thanks for taking the time to read this. :slight_smile: