WordPress.org

Ready to get started?Download WordPress

Forums

Localhost wordpress using remote DB loads very slow. (4 posts)

  1. creativegoat
    Member
    Posted 1 year ago #

    Hello guys, i'm having this weird issue with loading times on my local installation of wordpress.

    Ideally i would like to work on my localhost but using my dev server to host the database so i can pretty much populate and use the DB while working locally.

    I achieved this by changing my wp-config file to use the remote DB and using this function to overwrite the home and siteurl:

    /* put this at the very start of get_option() in wp-includes/option.php */
    if ($option == 'siteurl' || $option == 'home') {
    $currenturi = $_SERVER['REQUEST_URI'];
    $mypos = strpos($currenturi, '/'); /* are we looking at the local site right now? */
    if ($mypos !== false)
    return 'http://perfectworld.goat';
    } /* continue on with normal method, if we are not looking at the local site */

    Everything is working great, BUT.

    The loading time of my localhost is like three times more than loading my internet hosted versions of the same site, it looks like connecting to the same database takes more time from my localhost than from my live url, weird uh?

    Could i get some help? It would be really awesome to be able to connect at normal speed :)

  2. W.P. Ginfo
    Member
    Posted 1 year ago #

    It is likely that setting things up like that creates a lot of trafic between localhost and the external server.

  3. in Aachen
    Member
    Posted 1 year ago #

    The connections between the webserver and the database-server in the datacenter of your provider are many times faster than your (DSL-) connection.

  4. creativegoat
    Member
    Posted 1 year ago #

    That makes sense in Aachen, thanks a lot for your answer.

    I guess there is nothing i can do in order to improve this load time right? Well, besides switching internet provider.

Topic Closed

This topic has been closed to new replies.

About this Topic