将 WordPress 从 Live 迁移到本地主机
Moving WordPress from Live to Localhost
出于测试目的,我正在尝试将一个实时网站移动到本地主机,但我无法加载该网站。当我转到 localhost:8888/example 时,我的浏览器会无限期地加载页面并只显示空白页面。
我从live迁移到local的步骤来自这个tutorial
- 安装免费版 MAMP
- 在 MAMP 上使用 phpMyAdmin 导入我的实时数据库
- 更改 http://www.example.com to http://localhost:8888/example using this tool
的所有实例
- 在我本地网站的名为 'example'
的目录中安装 WordPress
- 将 wp-content 和 wp-config.php 复制到 'example'
用
配置wp-config.php
define('DB_NAME', 'myDatabase');
define('DB_USER', 'myUserName');
define('DB_PASSWORD', 'myPassword');
define('DB_HOST', 'localhost:8888');
导航至 localhost:8888/示例
然后,什么也没有发生。
这是apache_error.log
的结果
[Wed Jul 25 08:08:14 2018] [notice] Digest: generating secret for digest authentication ...
[Wed Jul 25 08:08:14 2018] [notice] Digest: done
[Wed Jul 25 08:08:14 2018] [notice] FastCGI: process manager initialized (pid 14761)
[Wed Jul 25 08:08:14 2018] [notice] Apache/2.2.34 (Unix) mod_wsgi/3.5 Python/2.7.13 PHP/7.2.1 mod_ssl/2.2.34 OpenSSL/1.0.2j DAV/2 mod_fastcgi/2.4.6 mod_perl/2.0.9 Perl/v5.24.0 configured -- resuming normal operations
[Wed Jul 25 08:13:48 2018] [notice] caught SIGTERM, shutting down
[Wed Jul 25 08:13:56 2018] [notice] Digest: generating secret for digest authentication ...
[Wed Jul 25 08:13:56 2018] [notice] Digest: done
[Wed Jul 25 08:13:56 2018] [notice] FastCGI: process manager initialized (pid 15305)
[Wed Jul 25 08:13:56 2018] [notice] Apache/2.2.34 (Unix) mod_wsgi/3.5 Python/2.7.13 PHP/7.2.1 mod_ssl/2.2.34 OpenSSL/1.0.2j DAV/2 mod_fastcgi/2.4.6 mod_perl/2.0.9 Perl/v5.24.0 configured -- resuming normal operations
...以及 php_error.log
的结果
[25-Jul-2018 15:10:59 Europe/London] PHP Notice: icit_srdb::recursive_unserialize_replace(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "Requests_Utility_CaseInsensitiveDictionary" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in /Applications/MAMP/htdocs/far/srdb.class.php on line 755
[25-Jul-2018 15:10:59 Europe/London] PHP Notice: icit_srdb::recursive_unserialize_replace(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "Requests_Utility_CaseInsensitiveDictionary" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in /Applications/MAMP/htdocs/far/srdb.class.php on line 755
[25-Jul-2018 15:10:59 Europe/London] PHP Notice: icit_srdb::recursive_unserialize_replace(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "Requests_Utility_CaseInsensitiveDictionary" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in /Applications/MAMP/htdocs/far/srdb.class.php on line 755
[25-Jul-2018 15:10:59 Europe/London] PHP Notice: icit_srdb::recursive_unserialize_replace(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "Requests_Utility_CaseInsensitiveDictionary" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in /Applications/MAMP/htdocs/far/srdb.class.php on line 755
[25-Jul-2018 15:10:59 Europe/London] PHP Notice: icit_srdb::recursive_unserialize_replace(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "Requests_Utility_CaseInsensitiveDictionary" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in /Applications/MAMP/htdocs/far/srdb.class.php on line 755
[25-Jul-2018 14:12:35 UTC] PHP Warning: require_once(/Applications/MAMP/htdocs/example/gd-config.php): failed to open stream: No such file or directory in /Applications/MAMP/htdocs/example/wp-config.php on line 84
[25-Jul-2018 14:12:35 UTC] PHP Fatal error: require_once(): Failed opening required '/Applications/MAMP/htdocs/example/gd-config.php' (include_path='.:/Applications/MAMP/bin/php/php7.2.1/lib/php') in /Applications/MAMP/htdocs/example/wp-config.php on line 84
将 WP 从本地主机迁移到 live 的最简单方法是使用插件
https://wordpress.org/plugins/all-in-one-wp-migration/
导出所有内容,创建本地版本的 WP,安装插件,然后使用此插件从实时页面导入先前导出的 wpress 文件,完成后,确认永久链接两次,就可以了
它将迁移您的代码以及您的数据库
您也可以使用 "Duplicator Plugin"。非常简单快捷。
请看下面link...
https://wordpress.org/plugins/duplicator/
我按照 janmyszkier instructions. First, I added gd-config.php to the correct directory. Second, I corrected the browser error SSL_ERROR_RX_RECORD_TOO_LONG by following these instructions.
解决了问题
更新:这让我的站点在本地启动并 运行 但 SSL 错误的解决方案仅限于没有 JavaScript 功能,因为它创建了一个不安全的 SHA-1 证书。
我修复了SSL_ERROR_RX_RECORD_TOO_LONG。
更新wp_tnxo_options SET option_value = replace(option_value, 'http://westerp7.local', 'http://localhost:81/westerp7') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_tnxo_posts SET post_content = replace(post_content, 'http://westerp7.local', 'http://localhost:81/westerp7');
UPDATE wp_tnxo_postmeta SET meta_value = replace(meta_value,'http://westerp7.local','http://localhost:81/westerp7');
然后从这里:
将此代码添加到您的配置-wp.php 文件中:
定义('FORCE_SSL',假);
定义('FORCE_SSL_ADMIN',假);
define('WP_HOME','http://localhost/sitename');
定义('WP_SITEURL','http://localhost/sitename');
出于测试目的,我正在尝试将一个实时网站移动到本地主机,但我无法加载该网站。当我转到 localhost:8888/example 时,我的浏览器会无限期地加载页面并只显示空白页面。
我从live迁移到local的步骤来自这个tutorial
- 安装免费版 MAMP
- 在 MAMP 上使用 phpMyAdmin 导入我的实时数据库
- 更改 http://www.example.com to http://localhost:8888/example using this tool 的所有实例
- 在我本地网站的名为 'example' 的目录中安装 WordPress
- 将 wp-content 和 wp-config.php 复制到 'example'
用
配置wp-config.phpdefine('DB_NAME', 'myDatabase'); define('DB_USER', 'myUserName'); define('DB_PASSWORD', 'myPassword'); define('DB_HOST', 'localhost:8888');
导航至 localhost:8888/示例
然后,什么也没有发生。
这是apache_error.log
的结果[Wed Jul 25 08:08:14 2018] [notice] Digest: generating secret for digest authentication ...
[Wed Jul 25 08:08:14 2018] [notice] Digest: done
[Wed Jul 25 08:08:14 2018] [notice] FastCGI: process manager initialized (pid 14761)
[Wed Jul 25 08:08:14 2018] [notice] Apache/2.2.34 (Unix) mod_wsgi/3.5 Python/2.7.13 PHP/7.2.1 mod_ssl/2.2.34 OpenSSL/1.0.2j DAV/2 mod_fastcgi/2.4.6 mod_perl/2.0.9 Perl/v5.24.0 configured -- resuming normal operations
[Wed Jul 25 08:13:48 2018] [notice] caught SIGTERM, shutting down
[Wed Jul 25 08:13:56 2018] [notice] Digest: generating secret for digest authentication ...
[Wed Jul 25 08:13:56 2018] [notice] Digest: done
[Wed Jul 25 08:13:56 2018] [notice] FastCGI: process manager initialized (pid 15305)
[Wed Jul 25 08:13:56 2018] [notice] Apache/2.2.34 (Unix) mod_wsgi/3.5 Python/2.7.13 PHP/7.2.1 mod_ssl/2.2.34 OpenSSL/1.0.2j DAV/2 mod_fastcgi/2.4.6 mod_perl/2.0.9 Perl/v5.24.0 configured -- resuming normal operations
...以及 php_error.log
的结果[25-Jul-2018 15:10:59 Europe/London] PHP Notice: icit_srdb::recursive_unserialize_replace(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "Requests_Utility_CaseInsensitiveDictionary" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in /Applications/MAMP/htdocs/far/srdb.class.php on line 755
[25-Jul-2018 15:10:59 Europe/London] PHP Notice: icit_srdb::recursive_unserialize_replace(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "Requests_Utility_CaseInsensitiveDictionary" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in /Applications/MAMP/htdocs/far/srdb.class.php on line 755
[25-Jul-2018 15:10:59 Europe/London] PHP Notice: icit_srdb::recursive_unserialize_replace(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "Requests_Utility_CaseInsensitiveDictionary" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in /Applications/MAMP/htdocs/far/srdb.class.php on line 755
[25-Jul-2018 15:10:59 Europe/London] PHP Notice: icit_srdb::recursive_unserialize_replace(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "Requests_Utility_CaseInsensitiveDictionary" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in /Applications/MAMP/htdocs/far/srdb.class.php on line 755
[25-Jul-2018 15:10:59 Europe/London] PHP Notice: icit_srdb::recursive_unserialize_replace(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "Requests_Utility_CaseInsensitiveDictionary" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in /Applications/MAMP/htdocs/far/srdb.class.php on line 755
[25-Jul-2018 14:12:35 UTC] PHP Warning: require_once(/Applications/MAMP/htdocs/example/gd-config.php): failed to open stream: No such file or directory in /Applications/MAMP/htdocs/example/wp-config.php on line 84
[25-Jul-2018 14:12:35 UTC] PHP Fatal error: require_once(): Failed opening required '/Applications/MAMP/htdocs/example/gd-config.php' (include_path='.:/Applications/MAMP/bin/php/php7.2.1/lib/php') in /Applications/MAMP/htdocs/example/wp-config.php on line 84
将 WP 从本地主机迁移到 live 的最简单方法是使用插件
https://wordpress.org/plugins/all-in-one-wp-migration/
导出所有内容,创建本地版本的 WP,安装插件,然后使用此插件从实时页面导入先前导出的 wpress 文件,完成后,确认永久链接两次,就可以了
它将迁移您的代码以及您的数据库
您也可以使用 "Duplicator Plugin"。非常简单快捷。
请看下面link... https://wordpress.org/plugins/duplicator/
我按照 janmyszkier instructions. First, I added gd-config.php to the correct directory. Second, I corrected the browser error SSL_ERROR_RX_RECORD_TOO_LONG by following these instructions.
解决了问题更新:这让我的站点在本地启动并 运行 但 SSL 错误的解决方案仅限于没有 JavaScript 功能,因为它创建了一个不安全的 SHA-1 证书。
我修复了SSL_ERROR_RX_RECORD_TOO_LONG。
更新wp_tnxo_options SET option_value = replace(option_value, 'http://westerp7.local', 'http://localhost:81/westerp7') WHERE option_name = 'home' OR option_name = 'siteurl'; UPDATE wp_tnxo_posts SET post_content = replace(post_content, 'http://westerp7.local', 'http://localhost:81/westerp7'); UPDATE wp_tnxo_postmeta SET meta_value = replace(meta_value,'http://westerp7.local','http://localhost:81/westerp7');
然后从这里:
将此代码添加到您的配置-wp.php 文件中:
定义('FORCE_SSL',假); 定义('FORCE_SSL_ADMIN',假);
define('WP_HOME','http://localhost/sitename'); 定义('WP_SITEURL','http://localhost/sitename');