Skip to content

Instantly share code, notes, and snippets.

@afeld
Last active April 13, 2020 17:03
Show Gist options
  • Save afeld/5003570 to your computer and use it in GitHub Desktop.
Save afeld/5003570 to your computer and use it in GitHub Desktop.
GoDadddy->local Wordpress development setup

I've seen waaaay too many people modifying their Wordpress sites live, which is fragile because when (not "if") you break something, your visitors will see it. Here are steps for setting up a copy of your site locally, so you can muck around without worry. These instructions are for Wordpress sites hosted on GoDaddy specifically, but they should be fairly easy to interpret for other providers.

To back up your database

  1. Log into GoDaddy, and go to "My Account".
  2. Under "Web Hosting", click Launch next to your site's name.
  3. Under "Databases", click "MySQL".
  4. Next to your database name, click "Actions"->"Back Up".
  5. Log into FTP, and under /_db_backups/ you'll see a new *.sql file.
  6. Rename this to be mydb-YYMMDD.sql format (e.g. superwordpress-130220.sql).

To set up your Mac for local development

  1. Copy all files from FTP to $HOME/Sites/mysite/ (e.g. /Users/aidan/Sites/superwordpress/).

  2. Install and and open the MAMP application.

  3. In the MAMP control panel, click "Start Servers". You should see the circles next to "Apache Server" and "MySQL Server" slowly turn green.

  4. Go to "Preferences"->"Apache" and set your "Document Root" to be the directory that contains your Wordpress files (e.g. /Users/aidan/Sites/superwordpress/, though it may be a subdirectory... look for wp-config.php).

  5. From the MAMP start page, go the "phpMyAdmin" tab, and under the "Databases" tab, fill in the field under "Create database" with your database name (e.g. superwordpress) and click "Create".

  6. Click your database name in the left sidebar.

  7. Go to the "Import" tab, click "Choose File", select the most recent *.sql file from _db_backups/ (e.g. /Users/aidan/Sites/superwordpress/_db_backups/superwordpress-130220.sql), and click "Go" at the bottom of the page.

  8. Go to the "SQL" tab and paste the following in the text area, then click "Go" at the bottom right.

    UPDATE wp_options SET option_value='http://localhost:8888' WHERE wp_options.option_name IN('home', 'siteurl');
  9. In the wp-config.php file, change the values of DB_USER, DB_PASSWORD and DB_HOST to look like the following:

    /** MySQL database username */
    define('DB_USER', 'root');
    
    /** MySQL database password */
    define('DB_PASSWORD', 'root');
    
    /** MySQL hostname */
    define('DB_HOST', 'localhost');
  10. Visit http://localhost:8888, and you should see your site!

DO NOT UPLOAD wp-config.php WITH THESE CHANGES.

To debug Wordpress

In wp-config.php, change the value of WP_DEBUG to be true. It will now overlay your page with error messages...which you should fix.

Useful Tools

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment