Invalid argument - wp-content/db.php on line 263 oops

I am having trouble getting the combination of Multi Database, Multi Domain and Domain Mapping working successfully on a new installation.

I am using the latest version of Wordpress (3.1.2) using subfolders for multisite and the the latest version of a number of MUDEV plugins with a RocketTheme theme Panacea (network enabled) using the Gantry Framework (enabled on a per site basis only)

The other (non MUDEV) extensions are Tiny MCE Advanved, XCloner, Gravity Forms and the Rok plugins used by the Panacea theme

So far I have done the following:

1. Created 16 databases plus the global database using CPanel. The global database is nicely populated with all the plugins installed since.
2. Installed and Multi Domain and Domain Mapping. Overwritten sunrise.php using dm-sunrise.php and added the line define( 'SUNRISE', 'on'); to wp-config.php
3. Entered the dedicated IP address for the main site http://www.main.com in Network Admin Settings
4. Added a domain to Multi Domain (Public) and added a *.thatotherdomain.com A record pointing to the dedicated IP address of the main site
5. Tried unsuccessfully to add a new site using http://www.thatotherdomain.com - I got sent to http://www.thatotherdomain.com/wp-admin/network/ and a 404 page on save.
6. Successfully added a new site http://www.thatotherdomain.com/test
7. Went to the list of sites and got the error Warning: Invalid argument supplied for foreach() in /home/main/public_html/wp-content/db.php on line 263
oops against the http://www.thatotherdomain.com/test ste

Supporter plugin is installed and activated but not configured.
Supporters only is set to No
The domain used for the administration area should be the [that entered by user]

In wp-content/db-config.php the folowing are in the global tables section

//---Global Tables--------------------------------------------------------//
//------------------------------------------------------------------------//
//	Do not include default global tables
//	Leave off base prefix (eg: wp_)
//
//	Usage: add_global_table(TABLE_NAME)
//	EX: add_global_table('something');

add_global_table('director_cms_global');
add_global_table('ust');
add_global_table('supporters');
add_global_table('supporter_signup_stats');
add_global_table('supporter_daily_stats');
add_global_table('supporter_ads');

What I am trying unsuccessfully to do is:

Use the main site - let's call it http://www.rainbow.com with dedicated IP address.

I have several other domains - let's call them http://www.red.com; http://www.blue.com: http://www.green.com etc hosted on a completely different reseller account.

I want people to be able to visit http://www.red.com; http://www.blue.com; http://www.green.com etc and see on those domains content which is being controlled/run entirely from http://www.rainbow.com and which will let me create blogs on both http://www.rainbow.com and http://www.red.com; http://www.blue.com; http://www.green.com etc for paying users.

I would also like blog users to be able to have their blog link through to a domain of their own - for example http://www.tomatoes.com or http://www.tomatoes.com/blog and still be accessible through my site http://www.red.com

I have root access to the dedicated server hosting the main domain and full WHM/CPanel control over the others. I own all the domain names in question so should be able to configure them correctly if someone can explain why the error ocurred and give me an idiot-proof guide to configuring things that way.

  • Specialist

    In wp-content/mu-plugins/domain-mapping.php I have uncommented line 30

    // UnComment out the line below to allow multiple domain mappings per blog
    define('DOMAINMAPPING_ALLOWMULTI', 'yes');

    I am not using the default wp_ prefix but move-blogs.php seemed to work ok with the non-default prefix

    The main site is in the root of the domain, not a sub-folder.

    These are the settings in wp-config.php

    define('WP_DEBUG', false);
    define('WP_ALLOW_MULTISITE', true);
    define( 'MULTISITE', true );
    define( 'SUBDOMAIN_INSTALL', false );
    $base = '/';
    define( 'DOMAIN_CURRENT_SITE', 'www.main.com' );
    define( 'PATH_CURRENT_SITE', '/' );
    define( 'SITE_ID_CURRENT_SITE', 1 );
    define( 'BLOG_ID_CURRENT_SITE', 1 );
    define( 'SUNRISE', 'on');
    /* That's all, stop editing! Happy blogging. */

    The contents of .htaccess are:

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
    RewriteRule ^(.*/)?sitemap.xml wp-content/sitemap.php [L]
    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
    RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
    RewriteRule . index.php [L]

    The site I added to the MultiDomain list has only a cgi-bin folder and an index.html file, no .htacess or other content.

  • DavidM

    Hi Specialist,

    Thanks for providing all this detail. It will definitely help to find out what's going on. That said, from what you've mentioned here, the following especially caught my eye.

    The site I added to the MultiDomain list has only a cgi-bin folder and an index.html file, no .htacess or other content.

    This particular site should be pointing to your main site, correct? If so, it shouldn't have a folder at all. Could you clarify what you mean by this?

  • Specialist

    In that case I have misunderstood the plugins requirements.

    All the sites are currently hosted on my reseller account, so http://www.red.com, http://www.blue.com. http://www.green.com have their own CPanel.

    Do I have to delete the hosting accounts and go instead to where I manage the domains themselves? The place where I can change the nameservers if I want to move the sites to other hosting?

    I can also park domains on the main domain which is running the multisite setup, or create the other domains as add-on domains. Which works best?

  • DavidM

    Hi Specialist,

    If you'd like to use those domains as multi-domain options from your rainbow.com site, then yes, you wouldn't need them to be setup with their own CPanel. And yes, you could simply remove the hosting accounts and manage them where you'd manage the domains.

    If your primary domain is rainbow.com, I imagine you could simply park these (assuming your primary domain is rainbow.com) and that should point them as they need to be. From there you could add them as multi-domains in your settings on site and manage them from there.

    If your primary domain isn't rainbow.com, you could simply setup those other domains as addon domains, specifying the directory where your rainbow.com site is installed.

  • Specialist

    Here's how I got on.

    I took one of the domains I want to use and changed the nameservers so instead of pointing to the account where I had set up CPanel hosting for it, it was using the same ns1 and ns2 nameservers as the main domain.

    That allowed me to successfully park it on the main domain, I was also able to add a * wildcard in using CPanels Advanced DMX Zone Manager.

    Not only does the domain, let's call it yellow.com, redirect to the main domain, but I also get redirected there when I try to add a site to it or a sub-folder in Network Admin.

    Also, when I try to add a new site as a subfolder to the main site instead, I still get that same original error message that is pointing to the foreach() argument on /public_html/wp-content/db.php on line 263

    That suggests to me that perhaps I probably need to look at Multi-DB because by checking the Root dedicated server account I see the ownership of the main domain is the reseller account I set the main server up on. The only other possible owner is Root.

    It may be that the dedicated IP alone is not enough for the dedicated server setup.

    I'm going to try the same thing with another Multistite that isn't using Multi-DB, is hosted on the same server, and also has a dedicated IP address.

  • Specialist

    Looks like the Invalid argument - wp-content/db.php on line 263 oops is down to Multi-DB versus the dedicated server setup or my faulty setup of Multi-DB.

    I was able to create a site on the 2nd test site main domain where MultiDB was not installed without the error, as long as it was on the main domain.

    However, I still get thrown back to the main domain when trying to set up a new site on either the root of the added domain in MultiSite or a subfolder. The site does not get added to the main domain sites list.

    It may be that even though CPanel allows me to add an A * wildcard Record, there is still a delay in the DNS switching.

    That means there may still be an ownership issue if there is no change after 48 hours - which is the max I've ever known nameserver changes to take to propogate, so am guessing that could be true for any other DNS issues.

  • Specialist

    I managed to get MultiDatabase working by manually creating the 16 databases plus Global in CPanel and Global populated just fine.

    Then I came up against another issue that was resolved in another thread on Multi-Domains

    When I say resolved, it answered my question that I although I could use the main site, for example http://www.rainbow.com to create http://www.red.com and http://www.blue.com, I was not able to then have http://www.red.com/customer1 or customer1.red.com so had to look elsewhere for answers.

    I tried the Wordpress User Synchronisation but the one way synchronisation did not allow me to manage the chain beyond one master and many slaves.

    The Domain Mapping plugin worked fine.

    I've just installed Networks for Wordpress and it worked out of the box when it came to creating the first domain on the network.

    Next stage is to see whether I can create the individual sites under http://www.blue.com etc from http://www.rainbow.com and/or http://www.blue.com etc plus checking out which plugins play nicely with that set-up.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.