【问题标题】:Moving WordPress from Live to Localhost将 WordPress 从 Live 迁移到 Localhost
【发布时间】:2019-01-02 07:53:32
【问题描述】:

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

我从现场迁移到本地所采取的步骤来自这个tutorial

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

【问题讨论】:

  • 您可能需要将 .htaccess 的 RewriteBase 修改为 /example 如果这没有帮助,请检查 MAMP apache 日志,他们会向您显示 PHP 没有的内容
  • 不幸的是,它没有用。虽然,RewriteBase 被列为我网站的 实际 名称的连字符版本,所以我删除了连字符。有趣...
  • MAMP 日志现在说什么?请将它们包括在问题中
  • 刚刚在上面添加了。
  • 你应该也有 PHP 日志的地方,请添加它们

标签: php wordpress localhost mamp staging


【解决方案1】:

将 WP 从 localhost 迁移到 live 的最简单方法是使用插件

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

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

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

【讨论】:

  • 感谢您的提示,但我真的想先手动解决这个问题。
【解决方案2】:

您也可以使用“复制器插件”。这非常简单快捷。

请看下面的链接... https://wordpress.org/plugins/duplicator/

【讨论】:

    【解决方案3】:

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

    更新:这让我的网站在本地启动并运行,但 SSL 错误的解决方案仅限于没有 JavaScript 功能,因为它创建了一个不安全的 SHA-1 证书。

    【讨论】:

      【解决方案4】:

      我修复了 SSL_ERROR_RX_RECORD_TOO_LONG。

      UPDATE 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'); UPDATE wp_tnxo_postmeta SET meta_value = replace(meta_value,'http://westerp7.local','http://localhost:81/westerp7');

      然后从这里开始:

      Secure, https When Live, Website Will Not Open Copy in XAMPP as http

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

      define('FORCE_SSL', false); 定义('FORCE_SSL_ADMIN', false);

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

      【讨论】:

        猜你喜欢
        • 2013-04-17
        • 1970-01-01
        • 2019-11-29
        • 2016-08-21
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-09-03
        相关资源
        最近更新 更多