• Hello,
    I am called to do some web developmet for my company but I’m really new to the job and trying to make sense of the existing documentation. I have experience working with WordPress and building child themes online , but I am now trying to set up a local dev environment.
    I used MAMP to set up a localhost environment on OS X, backed up and loaded my site’s database through PHPMyAdmin, and I am now trying to follow along with the Codex instructions here:
    https://codex.wordpress.org/Running_a_Development_Copy_of_WordPress
    (trying to stick to first option, “Creating a Second Installation With Separate Tables”
    I think I have changed my values correctly in wp.config.php for DB_NAME DB_USER, DB_PASSWORD and B_HOST (this is now “localhost”, right?)

    but what about the following box, after “then the DB changes you’ll have to do are:”, where would I put that code? in the same file?

    And don’t I need to change the values for WP_HOME and WP_SITEURL?

    Thanks for any help, really appreciate
    Elena

Viewing 4 replies - 1 through 4 (of 4 total)
  • And don’t I need to change the values for WP_HOME and WP_SITEURL?

    If you do what most people do and run there site as “localhost”, then yes you have to change them, and also change lots of other database entries which specify images etc. BUT do NOT do this.

    What I strongly advise you to do is to configure your locally served website to use “VirtualHost” settings.
    Details here:
    http://httpd.apache.org/docs/2.2/vhosts/name-based.html
    And put your domain name into your “hosts” file, details here:
    http://en.wikipedia.org/wiki/Hosts_%28file%29

    Then you can turn off the selection of the live website and your local copy by a simple edit of your hosts file.

    This way your website never knows that it has moved.

    Thread Starter sonouna

    (@sonouna)

    Thanks RossMitchell
    I think I do have VHost set up, I followed these instructions instead:
    http://foundationphp.com/tutorials/vhosts_mamp.php
    and I see some of the steps match those in the links you provided.

    Can you please clarify this sentence

    Then you can turn off the selection of the live website and your local copy by a simple edit of your hosts file.

    Where would I turn of selection of the live site? That one is not hosted locally, it’s hosted on Dreamhost.
    Are you suggesting that the local domain should name match the live site domain?
    Are the changes I did on the wp-config.php file still necessary?

    thanks 🙂 – as I said I’m pretty confused about this new section of WordPress development

    Elena

    Where would I turn of selection of the live site? That one is not hosted locally, it’s hosted on Dreamhost.

    What happens is that BEFORE a name is given to the internet DNS system to be mapped to an IP address, the name is first looked up in your HOSTS file. Editing the hosts file and making the line(s) for your local testing website into comments (prefix of “#” or is it “;” ? will mask the local lookup. When you want to test locally again, “uncomment” the lines. My entries are like:

    mysite.com.au 127.0.0.1
    www.mysite.com.au 127.0.0.1

    Are you suggesting that the local domain should name match the live site domain?

    Yes, exactly the same, then you don’t need to change ANYTHING in te database.

    Are the changes I did on the wp-config.php file still necessary?

    Yes, the database name, user name and password etc have to match what is in your local mysql database server.
    Of course if you want to you can create the database and everything to have the same names but I don’t find it worth the trouble. It is also helpful to be able to tell which database is which from the name.

    Thread Starter sonouna

    (@sonouna)

    Thank you so much!
    I’ll give that a try early next week and update here when I’m done.
    Elena

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Getting Started with localhost install’ is closed to new replies.