WordPress.org

Forums

[resolved] [closed] Multisite (sub-directories): Sub-Sites get created but don't work (46 posts)

  1. Dan & Jennifer
    Member
    Posted 4 years ago #

    Hi guys!

    I've scoured the forums here looking for the specific issue I'm facing and have not found it... so here goes.

    Just upgraded our main 3.5 year-old WordPress website to 3.0.1 (which went great). Then tried to enable MultiSite on it - which went great but it's not quite "working".

    The "enable MultiSite" process worked fine, then I actually created a couple of sub-sites. No errors, all good, I see the sites under WP Admin -> Sites. but I'm not sure the sub-sites are actually getting "fully created"...

    Because when I go to "Super Admin -> Sites" in the listing of sites the links to "visit" and "backend" for any of the sub-sites aren't correct - they literally all just go to the main MultiSite admin dashboard. i don't even have to click on them, I see that's where the link goes by hovering over it.

    The main website is working just fine - http://www.dan-and-jennifer.com/
    But the sub-site I'm testing with isn't working - http://www.dan-and-jennifer.com/zztest/ - it just says "error establishing database connection". but i think the problem's deeper than that, since I don't even see a working link to "visit" or "backend" for this subsite under "Super Admin -> Sites" (see above)

    Also this may or may not help, but I noticed there are NO files whatsoever being created in wp-content/blogs.dir - in contrast, in our other wordpress multisite installs I see a directory immediately created in there with what I think is the ID of the sub-site created.

    Just to qualify, I'm only having this problem on our main website, a WordPress install that's been upgraded many times since before WP 2.3. I've installed several other brand new Worpress 3.0.1 installs just for testing, enabled MultiSite and created sub-sites that all worked great, no problems whatsoever... so I've seen this work flawlessly.. it's only having problems on this one more established site.

    I also upgraded one of our other "main" established WordPress sites (albeit a newer one - this one started around WP 2.5) to 3.0.1, enabled MultiSite, and created a perfectly working SubSite for it, no problems... working great. same process - changed "SUBDOMAIN_INSTALL" to false after enabling MultiSite.
    here it is: http://www.TodayIsThatDay.com - and here's the Sub-site: http://www.TodayIsThatDay.com/inspirational-quotes/

    I've seen others mention similar symptoms in a few other MultiSite support threads, but the solution each time was the person saying "nevermind, I just deleted the wordpress install, re-installed, and it's fine now". But for us that's not an option, we're talking about our main website so we have to enable Multisite for this installation, can't start fresh.

    Has anyone seen something like this? Ideas?

    Thanks!!
    Dan

    --------- More Config details for site having issues ---------------

    test website URL (main blog in MultiSite install) - http://www.dan-and-jennifer.com/
    Test sub-site URL (site set up under main MultiSite blog) - http://www.dan-and-jennifer.com/zztest/

    * Since this was a "over 30 days" wordpress install, the MultiSite enable function chose "subDomain" for me. no problem, after it finished I updated wp-config.php and changed "define( 'SUBDOMAIN_INSTALL', true );todefine( 'SUBDOMAIN_INSTALL', false );`

    WordPress: 3.0.1
    MultiSite config: all are subDirectory based, no subDomains

    Here's the relevant section of wp-content:

    define( 'MULTISITE', true );
    define( 'SUBDOMAIN_INSTALL', false );
    $base = '/';
    define( 'DOMAIN_CURRENT_SITE', 'www.dan-and-jennifer.com' );
    define( 'PATH_CURRENT_SITE', '/' );
    define( 'SITE_ID_CURRENT_SITE', 1 );
    define( 'BLOG_ID_CURRENT_SITE', 1 );

    and .htaccess:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index.php$ - [L]

    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [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).*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*.php)$ $2 [L]
    RewriteRule . index.php [L]
    </IfModule>
    # END WordPress

    ** This will probably make no difference to anything, but the URLs above (on the domain dan-and-jennifer.com) and all the config info are a fully functionaly duplicate of our actual production website (AskDanAndJennifer.com), since this debugging was causing us production downtime. :-) "luckily" so to speak, the duplicate site is having the exact same issues the production site is having...

    --------- Config details ------------------------------

  2. Also this may or may not help, but I noticed there are NO files whatsoever being created in wp-content/blogs.dir - in contrast, in our other wordpress multisite installs I see a directory immediately created in there with what I think is the ID of the sub-site created.

    But the blogs themselves don't live in there - those folders are purely for media uploads, that's it.

    the blogs are all *virtual* through the magic of htaccess (in the case of subfolder blogs). The htaccess is slightly different for subfolder setups.

    (ipstenu, where are you? I know you have a copy handy...)

  3. Dan & Jennifer
    Member
    Posted 4 years ago #

    Hi Andrea, thanks for replying.

    The htaccess is slightly different for subfolder setups.

    Yeah, noticed that... but all my sites are directory-based and that section of the htaccess file in the broken site is exactly the same as in the working sites - for example the TodayIsThatDay site which is also WP301 upgraded and multisited and has a fully functional sub-site.

    (Re: blogs.dir directories being created for sub-sites but not in the site that's having issues)

    blogs themselves don't live in there - those folders are purely for media uploads, that's it.

    yes, i was just thinking this may be a clue of some sort, because I noticed all the other multisite installs - and they're all subdirectory based - they all automatically create a directory under blogs.dir as soon as I add a sub-site. except on the site I'm having issues with... there's nothing in blogs.dir. and the file permissions are all fine.

    I hope it's just something silly and obvious that I may be missing... :-)

    Thanks!
    Dan

  4. bejarana
    Member
    Posted 4 years ago #

    Your website is having the exact same problem as my website. Please eMail or call me if you get a solution. If you send me your contact info then I will do the same.

    <deleted - please do not post personal contact info>

  5. For the db error, and the link in the backend, it's most likely a plugin interfering. You'll have to turn them off, create a new site, then see if it works.

    The db error on a new site means it didn't get created in the db itself.

  6. I was on the train :) That .htaccess looks good for a subfolder install.

    yes, i was just thinking this may be a clue of some sort, because I noticed all the other multisite installs - and they're all subdirectory based - they all automatically create a directory under blogs.dir as soon as I add a sub-site. except on the site I'm having issues with... there's nothing in blogs.dir. and the file permissions are all fine.

    I have had that problem (and still do on one site) because I seriously jiggered with the install (blog #1 doesn't exist, renamed database tables, blog #3 is my MAIN site, etc etc - DO NOT do what I did!).

    Try the plugins. If that doesn't help, I'd consider exporting everything from your current site, making a fresh install of 3.0.1, and importing the posts from your current site. Overkill, perhaps, but it may help.

  7. Dan & Jennifer
    Member
    Posted 4 years ago #

    For the db error, and the link in the backend, it's most likely a plugin interfering. You'll have to turn them off, create a new site, then see if it works.

    The db error on a new site means it didn't get created in the db itself.

    @Andrea hmm, i wondered about that. but all the plugins were off when I created the test sub-site. just to test again i just disabled all of them, deleted this sub-site and created a new sub-site. with all plugins off.

    Result: Same situation exactly... created the sub-site fine, but "backend" just goes to the main admin and "visit" does too. if i manually enter the URL that "should" belong to the sub-site I see the same error on that page: "Database error: Error establishing a database connection". here it is: http://www.dan-and-jennifer.com/yytest

    Any idea what else - other than plugins - could keep the sub-sites from actually being created? :-)

    @ipstenu this site I'm debugging now (dan-and-jennifer.com) IS a fresh WP 301 install - and a PHPMyAdmin table-based import of the actual content of our production site (AskDanAndJennifer.com). I was having these same problems on our production site and the debugging was causing us downtime so did the fresh install and imported the actual posts/comments/categories/users into this one. and it's doing the exact same thing the production site was...

    Thoughts?

    Thanks!
    Dan

  8. How odd... I get a 404 on http://www.dan-and-jennifer.com/zztest/ and the db error on http://www.dan-and-jennifer.com/yytest

    Is there anything in your server logs?

    Also, you didn't create folders on the server for yytest, right?

  9. Any idea what else - other than plugins - could keep the sub-sites from actually being created? :-)

    Go look in the database itself - got any tables in there being created with the new blog info?

    stab in the dark: does the db user have ALL permissions on the db?

  10. Dan & Jennifer
    Member
    Posted 4 years ago #

    @Andrea

    stab in the dark: does the db user have ALL permissions on the db?

    Yes... i doublechecked wp-config against phpmyadmin for that database. also i just created a draft post in the main dan-and-jennifer.com site with no problems, so it's writing to the database fine.

    Go look in the database itself - got any tables in there being created with the new blog info?

    Yep... the "Multisite" tables are there, and specifically wp_blogs has 2 entries: an entry for the main site and one for the sub-site. just like in my perfectly working http://www.TodayIsThatDay.com/inspirational-quotes/ database...

  11. Dan & Jennifer
    Member
    Posted 4 years ago #

    @ipstenu

    How odd... I get a 404 on http://www.dan-and-jennifer.com/zztest/ and the db error on http://www.dan-and-jennifer.com/yytest

    LOL sorry, in the test with Andrea above I disabled all plugins, deleted the sub-site zztest and created a new one yytest.

    OK now I just re-created zztest so both test cases exist... it's no longer 404, back to db error for both sub-sites:
    http://www.dan-and-jennifer.com/yytest
    http://www.dan-and-jennifer.com/zztest/

    Is there anything in your server logs?

    nope, only complaints about the disabled plugins since they're ALL off so only half the homepage works... but the main site does function fine.

    Also, you didn't create folders on the server for yytest, right?

    hmm, no... since the folders are all virtual i'm not creating any folders at all. although i do expect to see a new folder auto created in blogs.dir for each new "sub-site" as is happening on the other directory-based multisite installs we have running... but for this one it's not...

    is that what you were asking - i.e. making sure I'm not creating a real folder that's somehow conflicting with the URL of the sub-site?

    that's why i went with these odd sub-site names just to be sure - yytest and zztest...

    Thanks!
    Dan

  12. Dan & Jennifer
    Member
    Posted 4 years ago #

    *** Guys, found something new...

    For all the new sub-sites on dan-and-jennifer.com...
    In Super Admin -> Sites -> "Edit" (sub-site) - the "Site info" section is populated fine, but the REALLY LONG "Site Options" section is totally empty for all the broken sub-sites.

    again comparing with our working TodayIsThatDay... that one shows a fully populated "Site Options" under each of the sub-sites...

    but in the problematic install, that section is empty for the sub-sites...

    so any idea what that part is not getting populated when the sub-sites are being created?

    Thanks!
    Dan

  13. is that what you were asking - i.e. making sure I'm not creating a real folder that's somehow conflicting with the URL of the sub-site?

    That was what I was asking :) Sometimes it's the silly things that nail us.

    but the REALLY LONG "Site Options" section is totally empty for all the broken sub-sites.

    Okay! At the top of that section it should say 'Site Options (wp_2_options)' or such. Does it?

  14. Dan & Jennifer
    Member
    Posted 4 years ago #

    @ipstenu cool.

    That was what I was asking :) Sometimes it's the silly things that nail us.

    LOL! indeed. :-)

    Okay! At the top of that section it should say 'Site Options (wp_2_options)' or such. Does it?

    OK... here it is. answer is yes; here's what I see:

    for /yytest/, it says "Site Options (wp_4_options)"
    and for /zztest its ays "Site Options (wp_5_options)"

    numbers make sense, I've created and deleted a few sub-sites in trying to figure out what's happening....

    Another thing I notice which is weird, for say /yytest/. in the "Site Users" and "Add New User" sections of Site Edit the "role" drop-down is empty.

    Compared to the working site / multisite (sub-site) on http://www.TodayIsThatDay.com - where the roles drop-down in the "Site Users" and "Add New User" sections actually is a full drop-down of valid wordpress roles.

    I am still thinking the creation of sub-sites is somehow only going half way, just don't know where it's getting wedged...

    Thanks!
    Dan

  15. Dan & Jennifer
    Member
    Posted 4 years ago #

    P.S. @ipstenu and @Andrea_r, I really appreciate your help!!

    LOL been banging my head on this same wall for nearly a week and after trying "everything" i could think of finally reached out for help. :-)

    Dan

  16. Go into the database and see if the tables for wp_4_options and wp_5_options exist.

    We're on to something. I think Andrea hit the nail on the head when she said 'stab in the dark: does the db user have ALL permissions on the db?'

    See, just because you can add entries to the table does NOT mean the ID can create new tables! SQL is tricksy. You need to make sure the ID has all privileges

    From my site, the sql ID I use has these:
    SELECT
    CREATE
    INSERT
    ALTER
    UPDATE
    DROP
    DELETE
    LOCK TABLES
    INDEX
    REFERENCES
    CREATE TEMPORARY TABLES
    CREATE ROUTINE

  17. just because you can add entries to the table does NOT mean the ID can create new tables!

    Ding ding! You win! :)

  18. Dan & Jennifer
    Member
    Posted 4 years ago #

    @ipstenu @Andrea OK - we're absolutely on to something here.

    The wp_SubSiteID_xxx tables are NOT there, so no wp_4_posts, wp_4_options, no wp_5_posts, wp_5_options, etc...
    and in our install with working sub-sites, we DO have all those tables created for the sub-sites.

    However... the mysql account DOES have "all privileges" to the database. in fact I just now created a brand new mysql login and assigned all privs to this database, and that's what login wordpress is using to power the test site now... and it's working. And i tried to create another sub-site. same problem... those other tables are just not being created...

    Any idea what else could be causing that??

    thanks!
    Dan

  19. If this is a fresh install (with your stuff imported), might wanna ask the webhost what's up.

    (Andrea clues in.... oh THAT dan & jennifer... :D )

    Edit:
    on the sites you had working, are these physically on the exact same server as this one? with the same specs for php, mysql, os?

    and becasue my scroll finger hurts and I can't scroll back and check - you DID disable all the plugins including any in the mu-plugins folder?

    I think I recall you saying up above you made a fresh install and imported your db in. I'd want to test a fresh install *without* your old db content to see if new blogs are created. This narrows down if it's the server itself or something in the db.

  20. Dan & Jennifer
    Member
    Posted 4 years ago #

    (Andrea clues in.... oh THAT dan & jennifer... :D )

    LOL :-)

    If this is a fresh install (with your stuff imported), might wanna ask the webhost what's up.

    Our web host is amazing at keeping our server solid and running, but we maintain all the wordpress stuff ourselves.

    on the sites you had working, are these physically on the exact same server as this one? with the same specs for php, mysql, os?

    yep, all our sites are on the same VPS which has plenty of resources to spare, just different wordpress installs.

    you DID disable all the plugins including any in the mu-plugins folder?

    hmm, don't have an mu-plugins folder on any of our wordpress 301 multiste installs.... so no plugins in there then.

    I think I recall you saying up above you made a fresh install and imported your db in. I'd want to test a fresh install *without* your old db content to see if new blogs are created. This narrows down if it's the server itself or something in the db.

    Just to circle back, here's what's WORKED GREAT so far:

    • just for practice, did a brand new fresh install of WP 301 and converted it to multisite. flawless. then did an import of 4 of our wordpress sites into it just to test: 1 as main blog and 3 as additional sites. again flawless.
    • upgraded a less-mission-critical website (www.TodayIsThatDay) from WP291 to WP301. flawless. then enabled multisite on it.

    here's where it got rocky (read: muy mal):

    1.) upgraded our main site http://www.AskDanAndJennifer.com from WP291 to WP301. that worked flawlessly.
    2.) a week later (after the practice with the other sites) enabled multisite on http://www.AskDanAndJennifer.com - here it got rocky...

    • enabling multisite went fine far as i could see, like the others.
    • BUT any sub-site i create didn't work, the links from "Super Admin -> Sites" to "Visit" and "Backend" are empty, just goes back to main wp admin. figured i did something wrong so deleted sub-site, and re-added it and another test one. same thing. disabled multisite, re-enabled it. tried a few other things, no luck.
    • reverted AD&J back to "NOT multisite", did a mysql export of all the data, installed a brand new fresh WP301 on another domain (dan-and-jennifer.com) and got it running, then imported just the data tables (posts, comments, users) from the production database. import worked great, site works fine (when plugins are enabled anyway, lol).
    • now enabled multisite on the new "copy" site at http://www.dan-and-jennifer.com ... had same problems as on http://www.askdanandjennifer.com - but then it's the same database, even if the "wordpress install" is totally fresh shiny and clean.
    • noticed that creating a new sub-site does NOT create a directory with the ID of the new sub-site in blogs.dir - and even though all our installs are directory based, they all create a directory named with the ID of the sub-site in blogs.dir. except askdanandjennifer.com and the test site dan-and-jennifer.com
    • and after further debugging and learning and help here, discovered that creating a new sub-site is NOT creating the wp_SITEID_posts/options/etc. tables in the multisite database even though the database account has full permissions fine... what what could be causing this?? a setting somewhere in some obscure option in the database?

    So that's where we are... our server (VPS) is totally capable of running a multisite well, and it's doing so with http://www.TodayIsThatDay.com and another test site... just not with our most important website and the copy of that we're using for testing - argh! :-)

    Thanks!!
    Dan

  21. installed a brand new fresh WP301 on another domain (dan-and-jennifer.com) and got it running,

    Before you imported in the db from the d&j site, did you check and see if new sites could be created AND work?

    noticed that creating a new sub-site does NOT create a directory with the ID of the new sub-site in blogs.dir - and even though all our installs are directory based, they all create a directory named with the ID of the sub-site in blogs.dir. except askdanandjennifer.com and the test site dan-and-jennifer.com

    this is UNRELATED to the problem. :) those directories are only created after media is uploaded to the sub sites. The blogs/site do not live here.

    So, you can temporarily forget that bit as relating to the issue.

    - we know it's not the server os
    - we know WP works fine on that server with the network
    - we know it's something specific in the d&j database.

    So, if you can take that install on your test domain, do not use your backup data, but just as if it were a fresh install, and create a site. See if it works. If so, we're on to something.

  22. Dan & Jennifer
    Member
    Posted 4 years ago #

    @Andrea it's gotta be the data, just not sure how and why??

    the 1st thing I did before touching our existing sites was, just for practice, a brand new fresh install of WP 301 and converted it to multisite. flawless. created sub-sites with no issue. it's still up and running great. then did an import of 4 of our wordpress sites into it: 1 as main blog and 3 as additional sites. again flawless.

    that install is on a separate domain - again using "subdirectories" - that's how all of ours area - and still working great. no issues... behaves like it's supposed to...

    Dan

  23. Dan & Jennifer
    Member
    Posted 4 years ago #

    OK just did a new experiment... reverted dan-and-jennifer.com to non-multisite in wp-config.php, and actually dropped all the multisite tables with phpmyadmin: wp_blog, wp_blogs, wp_site, wp_site_meta, wp_registration_log, wp_signups.

    then re-enabled multisite in wp-config.php, logged in and from "Network" created the new network, took the data and updated wp-config.php. same as always. so new "network", logged in again, created a test sub-site.

    and same problem. :-( the sub-site doesn't have its wp_xxx_posts/options/etc. argh.

    So what we learned here is the mysql user CAN create tables just fine since it re-created the multisite tables that i dropped

    but we still don't know why the individual sub-site tables aren't being created. :-(

    Thoughts??? what could cause that?

  24. Dan & Jennifer
    Member
    Posted 4 years ago #

    @Andrea - found the bug!!!!!!!!!!!!!! (not the solution per-se, but the bug causing the headache).

    breakdown: remember when I said http://www.AskDanAndJennifer.com has been around since before 2.3... since back when latin1 was the default charset (or rather wordpress didn't set a default and it was MySQL default, don't recall). regardless, our content is actually all latin1, so we still have to run with this in the config file:
    /** Database Charset to use in creating database tables. */
    /* define('DB_CHARSET', 'utf8'); */
    define('DB_CHARSET', 'latin1');

    Well, get this. I created a brand new installation AGAIN, which worked fine. turned on Multisite, which worked fine. but when I updated wp-config.php to add all the Multisite params, I also remembered I have to change Charset to latin1 or won't be able to import all our AD&J posts in the next step. so I did that. guess what - created a sub-site and it DIDN'T WORK - same problem!!!

    and it hit me.. wait, the charset! so I deleted the broken sub-site, then went back in and changed charset to UTF8 in wp-config.php and created a new sub-site.

    Summary: it has to do with charset and creating tables for the sub-sites. if charset isn't set to utf8, then sub-site tables are not created.

    this wasn't impacting my brand newly created sites because they were already utf8...

    So this presents 2 issues...
    1.) this looks like some sort of table creating bug in WP301 I think, so will impact anyone still running with Latin 1 charset (that means most anyone who's been upgrading every time since the pre-2.3 days)

    2.) how can we get all our data (posts) converted from latin1 to utf8 once and for all so i can just do a full import/export and move to a clean install.
    (from lots of searching, I know there are A LOT of posts on this, many of them conflicting and contradicting one another... i have yet to see a definitive one. spent last week tinkering with all those options and ended up with broken data in the test site in the end).

    Thanks!
    Dan

  25. DOH! the charset!!! Darn, I remember that one too! Well, NOW.... :D lol...

    1) Yeah, the latin1 shows up becasue WP back in the day just used the default set on the box.. which on most shared hosts with cpanel, was automatically set to latin1.
    (for more background for the eventual searchers)

    2) Lemme go ask someone smarter than me in this issue and get him to put his input. I know I've dealt with it before, and my memory sucks sometimes. :D But, he's my buddy so it works out.

  26. Ron Rennick
    MultiSite Guru
    Posted 4 years ago #

    What are the defined values for DB_COLLATE & DB_CHARSET in your wp-config.php?

  27. Dan & Jennifer
    Member
    Posted 4 years ago #

    Hi Ron.

    assuming you mean DB_COLLATE / DB_CHARSET only for the broken sites with the latin1 charset, where multisite doesn't actually work:
    define('DB_CHARSET', 'latin1');
    /* define('DB_COLLATE', ''); */
    DB_COLLATE was actually not even in that old pre-WP2.3 config file, so it's in there just for posterity, commented out.

    in the perfectly working brand spanking new installs (can create mini sites and they all work great) i have it like it comes default these days:
    define('DB_CHARSET', 'utf8');
    define('DB_COLLATE', '');

    Thanks!
    Dan

  28. Ron Rennick
    MultiSite Guru
    Posted 4 years ago #

    Try

    define('DB_COLLATE','latin1_general_ci');

  29. Dan & Jennifer
    Member
    Posted 4 years ago #

    @Ron HA!!!! That fixed it! i've just successfully created sub-sites under the latin1 charset installs and they work perfectly. Thanks!

    @Andrea, @ipstenu, thanks so much for your help.

    So to summarize this for someone else having this problem, the moral here is that if your WordPress encoding is latin1 (i.e. if you've had the site since the defaults before WP2.3) - then for Multisite to function and create tables for new sub-sites, it requires DB_COLLATE set accordingly, per Ron's post above:
    define('DB_COLLATE','latin1_general_ci');
    ------------

    @Ron, do you know of an actually reliable way to convert our current data (posts,comments,categories, users) from latin1 to utf8? from lots of searching, I know there are A LOT of posts on this, many of them conflicting and contradicting one another... i have yet to see a definitive one. i suspect just standard wordpress export/import would DO it, but it won't work as it messes up all the category/tag slugs and loses all the user info. Recommendations?

    Thanks!
    Dan

  30. Woot, awesome.

    I remember (I think) that Ron and I did a couple installs with this issue and even have one of our own where we confirmed it's doing the same thing and needs the same fix.

    (You know how you're Dan & Jennnifer? We're Ron & Andrea. ;) )

    We're on different shifts so I'll confab with him in a few hours.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags