New terms from treehouse – Setting Up for Local WordPress Development and Migrating from a Local to a Live Server

1. Install MAMP

2. Start up MAMP and your servers. This should take you to the start page. phpinfo will give you info on the current php install, phpMyAdmin will let manage your databases.

3. Customize your local server set up by going to Preferences and changing the Port number for apache from 8888 to 80, the default port used to access webpages. We can now just use localhost as the url without having to specify the port number. Change the MySQL one to 3306 too.

3b. You can also customize your root folder from the htdocs one in the MAMP app folder to one called Sites in your home directory. Then go to MAMP preferences > Apache > choose new document root. Add Sites to your Favorites Bar in Finder for easy access.

4. Install WordPress locally by downloading it. Create a new folder in your sites directory, then unzip the files and copy them in there.

5. Go to the MAMP control panel > open start page > tools > phpMyAdmin > databases > create new database with the name localwp. Then, go to Users > Add user > give it a name like wpuser, set the host to local for local host, enter a password and give them all global privileges > Go.

6. Go to local host > the directory you put the wp stuff into > choose a language > Let’s Go! > enter the database info you just set up, for table prefix change it to wptest_ > Submit > Run the Install. Then, set up a site title and sign in creds, and uncheck the privacy box so search sites can’t index you > Install WordPress. Then, log in and you’re good to go! You’ll be taken to the admin screen.

Migrating WordPress

1. Have a hosting account and domain name ready.

2. Log into your FTP and drag and drop all the files in your local folder into your live one for your domain.

3. Go to cPanel and search for MySQL > MySQL Database Server and give it the name localwp. Notice how migratew_ will come before it > Next Step. Create a user like wpuser and make up a password > Create User > Give all privileges > Next Step > make note of the final database and user name as you’ll need these later.

4. Go MAMP start page > tools > phpMyAdmin > go to your database in the left hand nav > export > Custom > select all > Save output to file > Go to download the file.

5. Go back to cPanel > search for PHPmyAdmin > go to new database you just created (migratew_localwp) and import the .sql file. > Go.

6. Go to your FTP software and look for your wp-config.php file. Open it, and change the database info from what you have for your local site to what you created for your new one. Also, underneath define DB_COLLATE, define a new constant to tell the WPinstall what the url is for the site with WP_HOME as the title, then the url. Make sure to include http:// and leave off any trailing slashes. Copy it again, and change the title to WP_SITEURL. Save and close it.

Screen Shot 2014-12-18 at 2.00.54 PM

7. Your live site should now be running. You can sign in with domain/wp-admin as normal.

8. Get a search and replace plugin to go through and change all the site references. Search and Replace is a good one. Install and activate it, and you’ll find it under tools. You can take the url from your first site, and pop in your new one to find and fix these.

Screen Shot 2014-12-18 at 2.02.35 PM

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s