Forums

Database connection error - only when I add new lines to wp-config file (13 posts)

  1. devpaq
    Member
    Posted 6 months ago #

    I have an existing blog that I am now creating a network. I installed the network, but when I try adding the code it provides to the wp-config.php I get an "Error establishing database connection". I get this error even when going to the original blog pages.
    If I removed those lines from the wp-config then it works correctly again, so it would seem it is not an issue with the database settings.

    The lines that I am adding are
    define( 'MULTISITE', true );
    define( 'SUBDOMAIN_INSTALL', false );
    $base = '/';
    define( 'DOMAIN_CURRENT_SITE', 'www.MYSITE.com' );
    define( 'PATH_CURRENT_SITE', '/' );
    define( 'SITE_ID_CURRENT_SITE', 1 );
    define( 'BLOG_ID_CURRENT_SITE', 1 );

  2. Ipstenu
    Half-Elf Support Rogue & Mod
    Posted 6 months ago #

    Where are you putting that code?

    You're whole section looks like this:

    /** MultiSite **/
    define('WP_ALLOW_MULTISITE', true);
    define( 'MULTISITE', true );
    define( 'SUBDOMAIN_INSTALL', true );
    $base = '/';
    define( 'DOMAIN_CURRENT_SITE', 'domain.com' );
    define( 'PATH_CURRENT_SITE', '/' );
    define( 'SITE_ID_CURRENT_SITE', 1 );
    define( 'BLOG_ID_CURRENT_SITE', 1 );
  3. devpaq
    Member
    Posted 6 months ago #

    I am putting it right before the line
    /* That's all, stop editing! Happy blogging. */

    I have the same code as you posted (except subdomain_install is set to false). When I remove these lines from the config file my site seems fine. But when I add it I get the error connecting to database.

  4. Ipstenu
    Half-Elf Support Rogue & Mod
    Posted 6 months ago #

    You're not deleting the define('WP_ALLOW_MULTISITE', true); line, right?

    And do you have full control of your database?

  5. devpaq
    Member
    Posted 6 months ago #

    Correct. I have that line in there as well.

    What kind of control would I need fro the database? Does a network need more control than a regular WP install?

    Thanks for your help.

  6. Ipstenu
    Half-Elf Support Rogue & Mod
    Posted 6 months ago #

    it needs to be able to create tables, which normally it has. Basically you should have 'full access.'

    However... Who's your host?

  7. devpaq
    Member
    Posted 6 months ago #

    My host is rackspace - cloud sites.

    I see the new tables were created automatically so can I assume I have the correct permissions?

  8. Ipstenu
    Half-Elf Support Rogue & Mod
    Posted 6 months ago #

    Yep, permissions are good.

    It's possible your host doesn't permit MultiSite though. Check with them.

  9. devpaq
    Member
    Posted 6 months ago #

    Thanks again for your help.

    I spoke with my hosting company. Their response was:
    "This seems like a configuration issue. It is defintely not a limitation in our environment. I help customers everyday using wordpress multisite."

    Any other suggestions you can think of?

  10. Ipstenu
    Half-Elf Support Rogue & Mod
    Posted 6 months ago #

    *snort* Thanks, Rackspace. If they help customers ever day using MultiSite, they coulda been helpful.

    Okay. Put the MultiSite code further up, like just below your hashes and salts.

  11. devpaq
    Member
    Posted 6 months ago #

    There isn't much else on the config file between the salts and where it is.

    I was doing some process of illumination and here is what I found. The 2 lines of code that are causing the issue are (not surprisingly)

    define( 'MULTISITE', true );
    define( 'SUBDOMAIN_INSTALL', false );

    If any of these 2 lines are there it will cause the database error. All of the other lines I can put in without any issue.

    If I switch the SUBDOMAIN INSTALL to true, I no longer get a database error but instead I get an indefinite loop.

  12. Ipstenu
    Half-Elf Support Rogue & Mod
    Posted 6 months ago #

    That's ...

    Okay, this is going to sound weird, but can you make a wp-content/blogs.dir folder and set it up with the same permissions you did for wp-content/uploads?

  13. devpaq
    Member
    Posted 6 months ago #

    Yes the blogs.dir folder is created and I gave it 777 permission.

    I tried a few different approaches and one of the errors mentioned it can't reach the database at http://www.mydomain.com. But my hosting company has the database setup that it can't use localhost but needs and actual database location. Could that be the issue? (I am sure i am not the first one).

Reply

You must log in to post.

About this Topic