[resolved] installing wordpress to subdomain - localhost? (16 posts)

  1. paulgweb
    Posted 8 years ago #

    Hello, I am posting as a last resort - no one i could find had this exact problem. Thanks to anyone who helps!

    I want to install WP on a subdomain: blog.myname.org

    I created the db, user, pwd; and confirmed via phpmyadmin that they exist and work.

    the "wp-config.php" file is correct as far as user details... but:

    the /wp-admin/install.php script says: Error establishing a database connection.

    I suspect that the db's address is NOT localhost since i'm calling it from the subdomain? Here's where i'm lost and no googling has found answers.

    The host is a reseller package on Rackspace, using Plesk 7. Why won't localhost work? I seem to be falling into the 1% of times when localhost does not work as a value in the WP script... help?!

    thx, paul

  2. paulgweb
    Posted 8 years ago #

    If this helps, phpinfo reports:


    There seems to be an ioncube loader module. is that year-old bug still affecting WP ?

  3. paulgweb
    Posted 8 years ago #

    Another thought: is there a problem with naming the database "WordPress" ?

  4. paulgweb
    Posted 8 years ago #

    Hmm, no, there seems to be no problem with a database named "WordPress"... i just renamed to "blog"

    The server is running MySQL 4.1.12

  5. DianeV
    Posted 8 years ago #

    Ioncube is for other stuff; I'd be highly surprised if it's being used by WordPress.

    Just for understanding, the actual location for blog.domain.com would be domain.com/blog. How you set up domain.com/blog to be accessed as blog.domain.com is another matter, however.

    Lastly, on some servers, this:
    define('DB_HOST', 'localhost');
    might need to be this:
    define('DB_HOST', 'site.com');

    Since you can access blog.domain.com; it would appear that the subdomain (blog.) is set up correctly. Since accessing the install.php gives us the usual "Error establishing a database connection", that indicates that either (1) the database is not actually set up yet, or (2) the info in wp-config.php is incorrect.

    Check those, and try install.php again. If that doesn't work, contact your host to ascertain what DB_HOST should be.

  6. DianeV
    Posted 8 years ago #

    One last thing: if your web hosting account uses cPanel, and you set up a database via cPanel which you named "blog", cPanel appends that to your username. So if, for example, your username is "user1", cPanel would change it to this:


  7. paulgweb
    Posted 8 years ago #

    Thanks very much for the help! i think the subdomain that my control panel Plesk7 creates is a "true" subdomain, not a dns trick.
    so, on the server, there is an outside-the-httpdocs directory called "subdomains", within which is a unique "httpdocs" directory. This subdomain cannot be viewed by pointing to domain.com/blog.

  8. paulgweb
    Posted 8 years ago #

    Too bad: changing the config to:

    define('DB_HOST', 'mysite.com');

    didn't work...

  9. Joni
    Posted 8 years ago #

    This may seem silly, but it's something I forget to do all the time and it would throw out that or a similar error.

    Did you remember to add the user to the database?

  10. DianeV
    Posted 8 years ago #

    Good point, jonimueller. I used to do this manually, but in cPanel, there are three steps:

    (1) Create a database
    (2) Create a new user (and password)
    (3) Add the user to the database

    That sets up the new database, and allows that particular user to use it. In such a case, the DB_HOST may be localhost, or may not ... but at least the database is usable.

  11. joetaxpayer
    Posted 8 years ago #

    I see WordPress is loaded to blog.saltwater.org, so you've set up the subdomain itself correctly. Did you enter the mySQL info into the config file correctly? That was the only tricky part of getting this to run for me.

  12. paulgweb
    Posted 8 years ago #

    hi all, glad to see your input... to answer the questions: yes, the db user is correctly set up. phpmyadmin confirms this. the control panel is PLESK 7 (not cPanel) and so makes it very easy to set up db users. I can vouch that the db is usable. I've added tables to it to test.

    So... the mystery remains. I think it's localhost vs the subdomain. but i don't know what WordPress is expecting for the server path. ??

    my host reseller doesn't have weekend tech support, so i'm on my own for now.

  13. mrmist
    Forum Janitor
    Posted 8 years ago #

    Quite often the mysql server is a completely different box, so using either localhost or yourdomain.com won't work. (My web host and mysql server are totally different)

    You'll need to put the actual server address of the mysql server in that config info, which you must have somewhere

  14. paulgweb
    Posted 8 years ago #

    Hi all, my host found the cause! He confirmed that localhost was indeed correct (subdomains are still local to the server)... the issue was that PLESK 7 was truncating the db user password to less than 14 characters, and my pwd was 16 characters. Apparently a bug in Plesk, since it didn't flag that long pwd as prohibited.

    Now the blog is working fine!

    Thanks everyone...

  15. DianeV
    Posted 8 years ago #

    Excellent; glad it's sorted out!

    (Isn't this fun? <grin>)

  16. Joni
    Posted 8 years ago #

    That is definitely good to know for any other Plesk users out there! And it's prolly a good idea to keep your passwords shorter than 6-8 characters.

    Glad it's solved!

Topic Closed

This topic has been closed to new replies.

About this Topic