Moving WordPress Site with Wordfence Plugin

I recently moved a wordpress site to a different host and after all the files and database were updated kept getting the following error:

2018/01/31 12:10:11 [error] 1857#0: *165 FastCGI sent in stderr: "PHP message: PHP Warning:  Unknown: failed to open stream: No such file or directory in Unknown on line 0
PHP message: PHP Fatal error:  Unknown: Failed opening required '/home/olddomain/public_html/wordfence-waf.php' (include_path='.:/usr/share/pear:/usr/share/php') in Unknown on line 0" while reading response header from upstream, client: 65.47.199.226, server: domain.com, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/var/run/php-fpm/php-fpm.sock:", host: "domain.com"

After reviewing the KB files here:
https://docs.wordfence.com/en/After_moving_a_site_or_deleting_some_files,_I_see:_PHP_Fatal_error:_Unknown:_Failed_opening_required_/var/www/html/wordfence-waf.php
https://docs.wordfence.com/en/Web_Application_Firewall_FAQ#How_can_I_remove_the_firewall_setup_manually.3F

I was able to modify the .user.ini file and the wordfence-waf.php file to set the correct path and all is well.

Change and Update WordPress URLS in Database When Site is Moved to new Host

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’);

mysql> UPDATE wp_options SET option_value = replace(option_value, ‘http://www.oldurl’, ‘http://www.newurl’) WHERE option_name = ‘home’ OR option_name = ‘siteurl’;
Query OK, 0 rows affected (0.00 sec)
Rows matched: 2 Changed: 0 Warnings: 0

mysql> UPDATE wp_posts SET guid = replace(guid, ‘http://www.oldurl’,’http://www.newurl’);
Query OK, 0 rows affected (0.02 sec)
Rows matched: 964 Changed: 0 Warnings: 0

mysql> UPDATE wp_posts SET post_content = replace(post_content, ‘http://www.oldurl’, ‘http://www.newurl’);
Query OK, 0 rows affected (0.05 sec)
Rows matched: 964 Changed: 0 Warnings: 0

mysql> UPDATE wp_postmeta SET meta_value = replace(meta_value,’http://www.oldurl’,’http://www.newurl’);g
Query OK, 0 rows affected (0.01 sec)
Rows matched: 686 Changed: 0 Warnings: 0

Configure Automatic Updates WordPress


nano /wp-config.php


Change this….

//--- disable auto upgrade
define( 'AUTOMATIC_UPDATER_DISABLED', true );

To this…to update core, plugins and themes

//--- disable auto upgrade
define( 'AUTOMATIC_UPDATER_DISABLED', false );
define('WP_AUTO_UPDATE_CORE', true);
add_filter( 'auto_update_plugin', '__return_true' );
add_filter( 'auto_update_theme', '__return_true' );

Upgrade WordPress to 4.1 – The admin backend the connection times out

Upgrade WordPress to 4.1. The admin backend the connection times out and the server gets really slow:error “The server at domain.com is taking too long to respond.”

It looks like this is actually a common issue with this version of wordpress. https://wordpress.org/support/topic/multisite-extremely-slow-after-upgrading-to-41

1) Open database via phpMyAdmin
2) Open table “wp_options” and look for “db_version” entry.
3) If that entry has a number different to “30133” (in my case it was 27916), change it to “30133”.

If you are using MU muli-sites and all the multisites are having issues, try this:

WordPress MU uses one database and each blog gets his own tables with the blog id in the prefix, so once you install a network installation your database should have these tables:

wp_1_options,wp_2_options,wp_3_options, etc. Check multisites for the same database version and change accordingly.

Check the mail options table.


mysql> SELECT option_value FROM  wp_1_options WHERE option_name = 'db_version' LIMIT 1;
+--------------+
| option_value |
+--------------+
| 30133        |
+--------------+
1 row in set (0.00 sec)

Check multisites for the same database version and change accordingly.


mysql> SELECT option_value FROM  wp_2_options WHERE option_name = 'db_version' LIMIT 1;
+--------------+
| option_value |
+--------------+
| 27916        |
+--------------+
1 row in set (0.00 sec)