on the move, website migrations debunked
TRANSCRIPT
On The MoveMigrations Debunked
Jonathan Perlman - @jpurpleman
WPCampus 2017
http://jpurpleman.ca/
About me• Canadian, eh! Montreal, Quebec
• Senior web developer at Dawson College
• Teacher at Dawson College’s CTD ( non-credit )
• WordCamp speaker
• Excel super-geek as per
Chris Lema
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
Dawson College• Nginx
• php-fpm
• MariaDB
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
• WordPress
• Drupal
• Moodle
• WeBWorK
• OpenEdX
• MediaWiki
• Git with Gitolite-admin
What’s covered…
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
• WordPress.com to self-hosted
• General overview
• One-time transfer
• Continuous migration
• DNS
• Check your site
• Resources
WordPress.comto
Self-Hosted
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
WordPress.com
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
Export From WordPress.com
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
Export From WordPress.com
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
Import to WordPress.org
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
Import to WordPress.org
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
Post Import• Theme
o Theme Directory – https://wordpress.org/theme
o Custom development ?
• Plugins
o Plugin Directory – https://wordpress.org/plugins
o JetPack
o Custom development ?
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
General Overview
Host to host
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
What are we moving?
CodeHTML, CSS,
JS, PHP
Media Library
JPG, PNG, DOC, PDF
Content SQL Database
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
Doing the migration• Login to old host and download the WordPress site and
export MySQL database
• Login to new host and create a MySQL database
• Change wp-config.php locally within the WordPress
installation files
• Upload the WordPress site onto the new host and import
MySQL database
• Change Site URL and Site Path within the database
• Change your hosts file and test the site
• Change the DNS and wait
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
Required Tools• Command line ( SSH )
o tar, scp, sed
o vim
o wp-cli
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
• File Transfer Program
o FileZilla
• Database client
o phpMyAdmin
o HeidiSQL
• ( Windows only )
o Sequel Pro
• ( Mac only )
One-Time Host to Host
Transfer
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
Doing the migration• Login to old host and download the WordPress site and export
MySQL database
• Login to new host and create a MySQL database
• Change wp-config.php locally within the WordPress
installation files
• Upload the WordPress site onto the new host and import
MySQL database
• Change Site URL and Site Path within the database
• Change your hosts file
• Check your site on the new host for errors
• Change the DNS and wait
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
CPanel based server
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
CPanel based server
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
Full CPanel backup• homedir
o public_html
• mysql
o site7453prod.sql
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
FTP / SFTP• Download the files from the web accessible area
o htdocs, public_html, www
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
Exporting via phpMyAdmin
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
Exporting via command line• WP-CLI
o wp db export
• Raw MySQL Command
o mysqldump -u root -pPASSWORD \
--complete-insert \
--skip-extended-insert \
--max_allowed_packet=512M \
-B site_edu > site_edu.sql
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
Doing the migration• Login to old host and download the WordPress site and export
MySQL database
• Login to new host and create a MySQL database
• Change wp-config.php locally within the WordPress
installation files
• Upload the WordPress site onto the new host and import
MySQL database
• Change Site URL and Site Path within the database
• Change your hosts file
• Check your site on the new host for errors
• Change the DNS and wait
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
Login to the database
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
Create a new database
1 Create a New
database
2 Give the database
a name
o Lowercase
o No spaces – use
underscores
o No special characters
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
Listing users having access
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
Creating a user
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
Doing the migration• Login to old host and download the WordPress site and export
MySQL database
• Login to new host and create a MySQL database
• Change wp-config.php locally within the WordPress
installation files
• Upload the WordPress site onto the new host and import
MySQL database
• Change Site URL and Site Path within the database
• Change your hosts file
• Check your site on the new host for errors
• Change the DNS and wait
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
Change wp-config.php• Edit wp-config.php with a text editor
• Change lines ~ 23, 26, 29 start with "define"
/** The name of the database for WordPress */
define('DB_NAME', ‘');
/** MySQL database username */
define('DB_USER', ‘');
/** MySQL database password */
define('DB_PASSWORD', '');
/** MySQL hostname */
define('DB_HOST', 'localhost');
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
Doing the migration• Login to old host and download the WordPress site and export
MySQL database
• Login to new host and create a MySQL database
• Change wp-config.php locally within the WordPress
installation files
• Upload the WordPress site onto the new host and import
MySQL database
• Change Site URL and Site Path within the database
• Change your hosts file
• Check your site on the new host for errors
• Change the DNS and wait
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
Importing via phpMyAdmin
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
Importing via command line• WP-CLI
o wp db import
• Raw MySQL Command
o mysql -u root -pPASSWORD \
--max_allowed_packet=512M
site_edu < site_edu.sql
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
Doing the migration• Login to old host and download the WordPress site and export
MySQL database
• Login to new host and create a MySQL database
• Change wp-config.php locally within the WordPress
installation files
• Upload the WordPress site onto the new host and import
MySQL database
• Change Site URL and Site Path within the database
• Change your hosts file
• Check your site on the new host for errors
• Change the DNS and wait
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
Serialized data
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
Change WordPress location
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
https://interconnectit.com/products/
search-and-replace-for-wordpress-databases/
Change WordPress location
Single Site Multi-Site
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
wp search-replace
‘http://example.com’
‘http://example.dev’
wp search-replace
--url=http://example.com
‘http://example.com’
‘http://example.dev’
Examples of Find / Replace
Find Replace
Path /home/siteedu7453/ /var/www/html/site.edu
Protocolhttp://www.site.eduhttp://site.edu
https://www.site.edu
Environment htttps://www.site.edu https://site.dev
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
Doing the migration• Login to old host and download the WordPress site and export
MySQL database
• Login to new host and create a MySQL database
• Change wp-config.php locally within the WordPress
installation files
• Upload the WordPress site onto the new host and import
MySQL database
• Change Site URL and Site Path within the database
• Change your hosts file
• Check your site on the new host for errors
• Change the DNS and wait
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
Override your DNS
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
http://www.howtogeek.com/howto/27350/
beginner-geek-how-to-edit-your-hosts-file/
Windows
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
• Using the Windows Logo use the Start Menu /
Screen and search for Notepad
• Right click Notepad and “Run as Administrator”
c:\windows\system32\drivers\etc\hosts
Mac• Use the app called GasMask from Clockwise
• Download
o http://clockwise.ee/
• Tutorial
o http://www.gilsmethod.com/how-to-edit-hosts-
files-in-mac-os-x-without-the-headaches
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
Doing the migration• Login to old host and download the WordPress site and export
MySQL database
• Login to new host and create a MySQL database
• Change wp-config.php locally within the WordPress
installation files
• Upload the WordPress site onto the new host and import
MySQL database
• Change Site URL and Site Path within the database
• Change your hosts file
• Check your site on the new host for errors
• Change the DNS and wait
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
White screen of death?• Update all plugins, themes, and WP core
• Check php version changes
• Deactivate all plugins and reactivate them one-by-one
• Deactivate the current theme - switch to 2017
• Reset permalinks
• Check .htaccess file – Compare against the codex
• index.html & index.php
• .maintenance
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
White screen of death?• Modify wp-config.php - add:
o define(“WP_DEBUG”, true);
o define( “WP_DEBUG_DISPLAY”, true );
• Check the error log
o Accessible via STFP
o CPanel
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
Doing the migration• Login to old host and download the WordPress site and export
MySQL database
• Login to new host and create a MySQL database
• Change wp-config.php locally within the WordPress
installation files
• Upload the WordPress site onto the new host and import
MySQL database
• Change Site URL and Site Path within the database
• Change your hosts file
• Check your site on the new host for errors
• Change the DNS and wait
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
Setting Name Servers
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
Setting DNS Records
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
Playing the waiting game
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
Transferring Via Plugins
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
Plugin comparison
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
Plugin Single Site vs Multisite Migrates what?
Duplicator
Single SiteCode
Media Library
Content
Backup Buddy
UpDraftPlusSingle Site
Multisite ( with Premium )All-in-One WP
Migration
WP Migrate DB ProSingle SiteMultisite
Media Library
ContentWP Site Sync
Duplicator
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
deliciousbrains.com
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
wpsitesync.com
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
Pros / Cons
Pros Cons
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
• Super user friendly
• Export site to the cloud
• Automates the process
• Finds and replaces
• Not multi-site friendly
• Timeouts on larger sites
• Can’t use CloudFlare
while duplicating
• May require changes to
.htaccess
• Files might need to go in
non-standard directories
Resources
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
Resources• http://www.wpbeginner.com/wp-tutorials/
how-to-move-wordpress-to-a-new-host-or-server-
with-no-downtime/
• https://codex.wordpress.org/Moving_WordPress
• https://wordpress.org/support
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
Thank you! Questions? Survey!
July 15, 2017WPCampus 2017 | https://www.jpurpleman.ca
https://2017.wpcampus.org/session-survey/424