繁体   English   中英

将 WordPress 从 Live 迁移到本地主机

[英]Moving WordPress from Live to Localhost

我正在尝试将实时网站移动到本地主机以进行测试,但无法加载该网站。 当我转到 localhost:8888/example 时,我的浏览器无限期地加载页面并且只显示一个空白页面。

我从实时迁移到本地所采取的步骤来自本教程

  1. 安装免费版 MAMP
  2. 在 MAMP 上使用 phpMyAdmin 导入我的实时数据库
  3. 使用此工具http://www.example.com 的所有实例更改为http://localhost:8888/example
  4. 在我本地网站的名为“example”的目录中安装 WordPress
  5. 将 wp-content 和 wp-config.php 复制到“example”
  6. 配置 wp-config.php

    define('DB_NAME', 'myDatabase'); define('DB_USER', 'myUserName'); define('DB_PASSWORD', 'myPassword'); define('DB_HOST', 'localhost:8888');

  7. 导航到 localhost:8888/example

然后,什么也没有发生。

这是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 从本地主机迁移到实时迁移(反之亦然)的最简单方法是使用插件

https://wordpress.org/plugins/all-in-one-wp-migration/

您导出所有内容,创建 WP 的本地版本,安装插件,然后使用此插件从实时页面导入先前导出的 wpress 文件,然后当您完成后,确认永久链接两次,就是这样

它将迁移您的代码以及您的数据库

您也可以使用“复制器插件”。 这非常容易和快速。

请参阅以下链接... https://wordpress.org/plugins/duplicator/

我按照janmyszkier说明解决了这个问题。 首先,我将 gd-config.php 添加到正确的目录中。 其次,我按照这些说明纠正了浏览器错误 SSL_ERROR_RX_RECORD_TOO_LONG。

更新:这让我的网站在本地启动并运行,但解决 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'; 更新 wp_tnxo_posts SET post_content = replace(post_content, ' http://westerp7.local ', ' http://localhost:81/westerp7 '); 更新 wp_tnxo_postmeta SET meta_value = replace(meta_value,' http://westerp7.local ',' http://localhost:81/westerp7 ');

然后从这里:

安全,https 上线时,网站不会在 XAMPP 中打开复制为 http

将此代码添加到您的 config-wp.php 文件中:

定义('FORCE_SSL',假); 定义('FORCE_SSL_ADMIN',假);

定义('WP_HOME',' http://localhost/sitename '); 定义('WP_SITEURL',' http://localhost/sitename ');

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM