Recommend use duplicator to migrate:

Duplicator – WordPress Migration Plugin

Step1, remove some plugins that contains redirection function, this may cause error 404 after the migration. Such as Cache plugins, Theme my login, register related plugins etc. Because these plugins may change the setting in .Htaccess file, therefore cause the error.

Step2, follow the instruction in the link which including backup database, backup site files, restore database, restore files, use Search Replace DB to edit database. The last step is  crucial, In order for images and posts linking to other parts of your site to work, you’ll need to update your domain name in your database.

if you have trouble with import database from phpMyAdmin, then think about ftp the database file to the server, import from mysql command:

mysql -u username -p database_name < file.sql

 

 

Issues
Can not update WordPress

If you are self hosting wordpress on a linux machine, you may encounter below issue when you upgrade/migrate WordPress:

The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.: wp-admin/includes/update-core.php

Installation Failed

This may due to two reasons, SELinux or file permission, issue below commands to fix it.

sudo chcon --type httpd_sys_rw_content_t /var/www/html/frankfuclick/ -R


sudo chown -R apache:apache /var/www/html/your_web

Or you can change selinux to permissive for a while during the upgrade, and change back to enforcing afterwards:

First check the current status:

setstatus

Change to permissive during upgrade:

setenforce Permissive

Change back to enforcing afterwards:

setenforce enforcing
Collation Charset issue
#1273 – Unknown collation: ‘utf8mb4_unicode_ci’

solution:

  1. Open database file with text editor, replace utf8mb4_unicode_ci with utf8_unicode_ci for collation.

2. remove previous Database, create an empty database with utf8_unicode_ci, then try to import the database file.

3, test the page, wp-admin, plugins, media. If any plugin encounters error, better to remove it and reinstall, because the database and plugin may not coordinate with each other after the migration.

 

Can not change or create new page/post

Possible issue: php version too old, upgrade to 7.2/ 7.3 will fix this issue.

 

Limit on the upload file size

Find which part is affecting the size limit, create a phpinfo.php file under website folder:

<?php

// Show all information, defaults to INFO_ALL
phpinfo();

?>

If the value between local value and master value are different, there are multiple file may be affecting this.

Firstly  check Loaded Configuration File part, edit that file usually under /etc folder, ( /etc/php/7.2/apache2/php.ini) , which affect the master value. Open that file, find below fields:

post_max_size=

upload_max_filesize=

change both of them into your desired limit.

Secondly if your local value is different from the master value. There are may be other files, such as the user.ini, php.ini in the www folder, or your website subfolder, chech them all and fix the two fields above.

 

 

Manual migration

 

In this method, you will copy your wordpress folder, MySQL folder to the relevant target server.

Install phpmyadmin or run below mysql query to change the old url to new url:

  • Database name: WPDB
  • WordPress database prefix: wp
  • old url: http://www.oldurl
  • new url: http://www.newurl
mysql> USE WPDB
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl';

UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl');

UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl');

UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl');