将WordPress从实时迁移到Localhost

时间:2018-07-25 13:15:31

标签: php wordpress localhost mamp staging

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

从实时迁移到本地的步骤是从这个tutorial

开始的
  1. 安装MAMP的免费版本
  2. 在MAMP上使用phpMyAdmin导入实时数据库
  3. 使用此http://www.example.comhttp://localhost:8888/example的所有实例更改为tool
  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

4 个答案:

答案 0 :(得分:1)

将WP从本地主机迁移到实时环境(反之亦然)的最简单方法是使用插件

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

您导出所有内容,创建WP的本地版本,安装插件,然后使用此插件从实时页面导入已导出的wpress文件,然后完成操作,确认两次永久链接,应该是

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

答案 1 :(得分:0)

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

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

答案 2 :(得分:0)

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

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

答案 3 :(得分:0)

我修复了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'或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');

然后从这里:

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

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

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

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

相关问题