WordPress.org

Ready to get started?Download WordPress

Forums

Page outside of WordPress won't connect to the database (3 posts)

  1. David Powell
    Member
    Posted 2 years ago #

    I have a page that must reside outside of my WordPress installation (long story). Using a few examples I got the connection to the files set:

    define('WP_USE_THEMES', false);
    define( 'CABSPATH', dirname(__FILE__)); //CABSPATH used to go down one folder
    require(dirname(CABSPATH).'/wp-load.php');

    When I go to the page I get the "Error establishing a database connection" error. The main install of wordpress is fine.

    The other page/folder in on the same server just outside of the wordpress installation folders. I've found examples of people who have done this but not anyone who had this problem.

    Any ideas?

  2. fireproofsocks
    Member
    Posted 2 years ago #

    What happens if you instead include the wp-config.php file? (i.e. the one with all the database connection details). You can include the file then print out those variables just to ensure that they are correct.

  3. David Powell
    Member
    Posted 2 years ago #

    I can see the wp-config file and those variables are correct. The wordpress driven site connects fine.

Topic Closed

This topic has been closed to new replies.

About this Topic