I am trying to move a WordPress site from my local server to the online server.
我试图将WordPress网站从我的本地服务器移动到在线服务器。
The problem is that, after the migration, if I try to open the administration page (wp-admin) I only obtain a white page, as you can see here: http://scorejava.com/wordpress/wp-admin/. Everything else seems work well in the homepage: http://scorejava.com/wordpress/.
问题是,在迁移之后,如果我尝试打开管理页面(wp-admin),我只会获得一个白页,如下所示:http://scorejava.com/wordpress/wp-admin/。其他一切似乎在主页上运行良好:http://scorejava.com/wordpress/。
In my local web server I have the WP site into the folder: /var/www/wordpress
. I have moved it into a wordpress folder that is into my root directory of my online web server.
在我的本地Web服务器中,我将WP站点放入文件夹:/ var / www / wordpress。我已将其移动到wordpress文件夹中,该文件夹位于我的在线Web服务器的根目录中。
I have also import the local database into the onlyne database using MySql and then I have use the Search and Replace for WordPress Databases Script to change automatically all the http://localhost/wordpress
occurrence into the database tables with http://scorejava.com/wordpress/.
我还使用MySql将本地数据库导入到onlyne数据库中,然后我使用WordPress数据库脚本的搜索和替换自动将所有http:// localhost / wordpress事件更改为带有http:// scorejava的数据库表。 COM / WordPress的/。
9 个解决方案
#1
11
There is an error on your site, and you need to find out what's happening.
您的网站上存在错误,您需要了解正在发生的情况。
WordPress URLs
When migrating WordPress sites where the URL changes, you will need to tell WordPress about the new URL. WordPress stores that information in the database, so if you're comfortable with that, you could find the correct entry in the wp_options
table in your database and update its value.
迁移URL更改的WordPress站点时,您需要告诉WordPress有关新URL的信息。 WordPress将该信息存储在数据库中,因此如果您对此感到满意,可以在数据库的wp_options表中找到正确的条目并更新其值。
I will show some fixes for standard WordPress installs (where the site URL is the WordPress root), but you may need to use different values for home
and siteurl
if you have a different setup.
我将展示标准WordPress安装的一些修复程序(其中站点URL是WordPress根目录),但如果您有不同的设置,则可能需要为home和siteurl使用不同的值。
Fix URLs via SQL
You will need to update the relevant fields in the DB, those being the entries of wp_options
where the option_name
is siteurl
or home
. You can find these fields using phpmyadmin, mysql-workbench, or another database management tool, or you can use the following query, changing the URL to be your own.
您需要更新数据库中的相关字段,这些字段是wp_options的条目,其中option_name是siteurl或home。您可以使用phpmyadmin,mysql-workbench或其他数据库管理工具找到这些字段,或者您可以使用以下查询,将URL更改为您自己的URL。
UPDATE `wp_options` SET `option_value`='http://www.myurl.com' WHERE `option_name` IN ('siteurl', 'home');
Fix URLs via wp-config.php
However, you can also do this via wp-config.php
, which I find to be much more comfortable. Just open wp-config.php
and add the lines:
但是,你也可以通过wp-config.php来做到这一点,我发现它更舒服。只需打开wp-config.php并添加以下行:
// Site URLS (override DB settings)
define('WP_HOME','http://www.myurl.com'); //<-- NO TRAILING /
define('WP_SITEURL','http://www.myurl.com'); //<-- NO TRAILING /
Obviously you'll need to supply your correct URL.
显然,您需要提供正确的URL。
It's possible that this is the only error you're having, and after adding those lines to wp-config.php
, you will be able to log in and use your site normally.
这可能是您遇到的唯一错误,在将这些行添加到wp-config.php后,您将能够正常登录并使用您的站点。
Debugging WordPress errors
However, if you continue to experience problems, and any time you're working on developing a website, you will want to see error output. You can check your server logs for information about the errors, but you may find it more convenient for WordPress to simply display the errors in the page. To enable error display, change the following setting to true
in wp-config.php
.
但是,如果您仍然遇到问题,并且在您开发网站的任何时候,您都希望看到错误输出。您可以检查服务器日志以获取有关错误的信息,但您可能会发现WordPress更方便地在页面中显示错误。要启用错误显示,请在wp-config.php中将以下设置更改为true。
define('WP_DEBUG', true);
Now WordPress will display any errors it encounters directly in the webpage. Be sure to change the setting to false
for use on a production site.
现在,WordPress将直接在网页中显示遇到的任何错误。请务必将设置更改为false,以便在生产站点上使用。
Working with wp-config.php
This file will be located in the root directory of your wordpress installation. To make any of the changes mentioned here, you may either edit the file directly on the server (via ssh
for example), or download the file with an FTP client, make your changes using a text editor, and upload the file again.
该文件将位于wordpress安装的根目录中。要进行此处提到的任何更改,您可以直接在服务器上编辑文件(例如通过ssh),或者使用FTP客户端下载文件,使用文本编辑器进行更改,然后再次上载文件。
It's also a good idea to keep a backup copy before making any changes in case you break something while you're working.
在进行任何更改之前保留备份副本也是一个好主意,以防您在工作时破坏某些内容。
References
You can read all about changing the WordPress site URL on the docs page.
您可以阅读有关在文档页面上更改WordPress站点URL的所有信息。
#2
6
Late To the party, I've experienced this recently and I managed to solve the issue. Here is what I've done.
迟到了,我最近经历过这个,我设法解决了这个问题。这就是我所做的。
Step 1: Set WP_DEBUG
to true
from the wp-config.php
file
步骤1:从wp-config.php文件中将WP_DEBUG设置为true
Step 2: I tried domain.com/wp-login.php
instead of domain.com/wp-admin
by this I was able to get atleast login form and some errors of Warning: Cannot modify header information - headers already sent by
第2步:我尝试使用domain.com/wp-login.php而不是domain.com/wp-admin这样我就能获得至少登录表单和一些错误警告:无法修改标题信息 - 已经发送的标题
Step 3: I've added ob_start();
in wp-login.php
file after <?php
in first line, of course to get me in for a while.
第3步:我添加了ob_start();在第一行
Step 4: This trick worked. I've disabled all the plugins, and errors are gone.
第4步:这个技巧奏效了。我已经禁用了所有插件,错误消失了。
Step 5: Activated all the plugins one by one to find which plugin is causing error, So that I can fix the error in particular plugin. Like there was one plugin adding style before wp_enqueque_style
so I set it to a function and hook it properly.
步骤5:逐个激活所有插件以找到导致错误的插件,以便我可以在特定插件中修复错误。就像在wp_enqueque_style之前有一个插件添加样式所以我将它设置为一个函数并正确挂钩。
There were some minor errors too like deprecated
functions. Its up to you whether you want to correct it or use alternate plugin.
有一些小错误也像已弃用的函数一样。无论您是要更正它还是使用备用插件,都取决于您。
And Don't forget to remove ob_start
from wp_login.php
file. The core files should not be changed.
并且不要忘记从wp_login.php文件中删除ob_start。不应更改核心文件。
Hope this helps someone like me.
希望这有助于像我这样的人。
#3
5
Inside your settings for your WordPress dashboard there are two fields named "WordPress address (URL)" and "Site address (URL)". These are also known as the "Home" and the "Site URL" settings for your website. The values need to match the server you're actually running on.
在您的WordPress仪表板设置中,有两个名为“WordPress地址(URL)”和“站点地址(URL)”的字段。这些也称为您网站的“主页”和“网站网址”设置。这些值需要与您实际运行的服务器相匹配。
If you can't get to the admin, you can use phpmyadmin, go into your database, find the fields kin the wp_options table, and make sure they reflect your domain.
如果你无法访问管理员,你可以使用phpmyadmin,进入你的数据库,找到wp_options表中的字段,并确保它们反映你的域名。
It should be enough in most of cases.
在大多数情况下应该足够了。
#4
4
I've fought the dreaded "White Screen of Death" myself a few times. You can browse the threads at the Wordpress Support Site to glean some suggestions, or Google it for lots and lots of people's stories and advice dealing with these. I can't recommend a single, authoritative reference for this.
我自己曾几次打过可怕的“死亡之白”。您可以浏览Wordpress支持网站上的主题以收集一些建议,或者谷歌搜索许多人的故事和建议。我不能为此推荐单一的权威参考。
In most of my cases it was caused by whitespace after a closing ?>
tag that got introduced because of changes in newline schemes between my dev and production servers, usually in a plugin.
在我的大多数情况下,它是由关闭?>标签引起的空格引起的,因为我的开发服务器和生产服务器之间的换行方案发生了变化,通常是在插件中。
You might also try putting Wordpress into debug mode or adding error_reporting(E_ALL);
to the first line of your site's /wp-admin/admin.php
file to see if these give you any hints.
您也可以尝试将Wordpress置于调试模式或添加error_reporting(E_ALL);到你网站的第一行/wp-admin/admin.php文件,看看这些是否给你任何提示。
I've personally been able to avoid these (touch wood) by using the XCloner plugin to make transfers between my Win dev machine and *nix production server.
我个人能够通过使用XCloner插件在我的Win dev机器和* nix生产服务器之间进行传输来避免这些(触摸木材)。
#5
2
Edit wp-content/themes/active-theme-folder/function.php and add this code just before:
编辑wp-content / themes / active-theme-folder / function.php并在之前添加此代码:
<?php
define('WP_HOME','http://www.myurl.com'); //<-- NO TRAILING /
define('WP_SITEURL','http://www.myurl.com');
#6
0
I had the same problem after migrating to a local server. A first attempt failed because there were many hardcoded filepaths in the database. So I tried again and took care to create the same path as on the live server and the same hostname and databasename. Now the website was good but wp-login gave a white screen.
迁移到本地服务器后,我遇到了同样的问题。第一次尝试失败,因为数据库中有许多硬编码的文件路径。所以我再次尝试并注意创建与实时服务器相同的路径以及相同的主机名和数据库名。现在网站很好,但是wp-login给了一个白色的屏幕。
With wp-debug I found that the problem was caused by wp-super-cache plugin that had a full filepath hardcoded in the config.php Changing this path to the full local path did the trick.
使用wp-debug我发现问题是由wp-super-cache插件引起的,该插件在config.php中有一个完整的文件路径硬编码。将这条路径改为完整的本地路径就可以了。
#7
0
Add the below line into the wp-config.php
file:
将以下行添加到wp-config.php文件中:
define('WP_HOME', 'http://' . $_SERVER['SERVER_NAME']);
define('WP_SITEURL', WP_HOME . '/');
#8
0
In you wp-config.php file just above the line stop editing line add this line:
在你停止编辑行上方的wp-config.php文件中添加以下行:
define('RELOCATE',true);
/* That's all, stop editing! Happy blogging. */
Then go to your login URL, refresh the page and log in. IMPORTANT: If you can log in, then remove the RELOCATE line before preceding any further. Then navigate to:
然后转到您的登录URL,刷新页面并登录。重要信息:如果您可以登录,请先删除RELOCATE行,然后再继续操作。然后导航到:
Settings > General
Set your Wordpress URL and Site address to the correct locations:
将您的Wordpress URL和站点地址设置为正确的位置:
WordPress Address (URL): http://example.com/wordpress
Site Address (URL): http://example.com/myblog
Press "Save".
#9
0
These are the steps I usually follow.
这些是我通常遵循的步骤。
- Upload files and database.
- Set the correct file permissions.
- Update the database configurations in the wp-config.php file to match the server db login.
- Update the
wp_options
table for updating the site url and home url. - If everything goes well you should be able to login to the admin using the
wp-login.php
as the url. - The first thing next to do is to go to the permalinks and click save it will automatically update the
.htaccess
file. If there is no write permisson it will show you can copy it and edit the file via ftp. - Next thing you can easily update all the urls safetly with a plugin named
velvet urls
. Using it for many years. It will update all other urls in the database.
上传文件和数据库。
设置正确的文件权限。
更新wp-config.php文件中的数据库配置以匹配服务器db登录。
更新wp_options表以更新站点URL和主URL。
如果一切顺利,您应该能够使用wp-login.php作为URL登录管理员。
接下来要做的第一件事就是转到固定链接并单击“保存”,它将自动更新.htaccess文件。如果没有写入权限,它将显示您可以复制它并通过ftp编辑该文件。
接下来,您可以使用名为velvet urls的插件轻松更新所有网址。使用它多年。它将更新数据库中的所有其他URL。
All these steps will be enough if everything goes correctly.
如果一切正常,所有这些步骤就足够了。
If you get a blank page or something you can turn on the error reporting and write the logs from the wp config file itself. You can try some of these to debug.
如果您获得空白页面或其他内容,您可以打开错误报告并从wp配置文件本身写入日志。您可以尝试其中一些进行调试。
- Just remove plugins from the folders one by one.
- Remove the custom theme which you are using.
只需逐个删除文件夹中的插件即可。
删除您正在使用的自定义主题。
Unless you edited the core files mostly it will solve the issue. Only other chance is the version mismatch for php or mysql that is also very important thing to note while migrating. Hope this helps someone.
除非您主要编辑核心文件,否则它将解决问题。只有其他机会是php或mysql的版本不匹配,这也是迁移时需要注意的重要事项。希望这有助于某人。
#1
11
There is an error on your site, and you need to find out what's happening.
您的网站上存在错误,您需要了解正在发生的情况。
WordPress URLs
When migrating WordPress sites where the URL changes, you will need to tell WordPress about the new URL. WordPress stores that information in the database, so if you're comfortable with that, you could find the correct entry in the wp_options
table in your database and update its value.
迁移URL更改的WordPress站点时,您需要告诉WordPress有关新URL的信息。 WordPress将该信息存储在数据库中,因此如果您对此感到满意,可以在数据库的wp_options表中找到正确的条目并更新其值。
I will show some fixes for standard WordPress installs (where the site URL is the WordPress root), but you may need to use different values for home
and siteurl
if you have a different setup.
我将展示标准WordPress安装的一些修复程序(其中站点URL是WordPress根目录),但如果您有不同的设置,则可能需要为home和siteurl使用不同的值。
Fix URLs via SQL
You will need to update the relevant fields in the DB, those being the entries of wp_options
where the option_name
is siteurl
or home
. You can find these fields using phpmyadmin, mysql-workbench, or another database management tool, or you can use the following query, changing the URL to be your own.
您需要更新数据库中的相关字段,这些字段是wp_options的条目,其中option_name是siteurl或home。您可以使用phpmyadmin,mysql-workbench或其他数据库管理工具找到这些字段,或者您可以使用以下查询,将URL更改为您自己的URL。
UPDATE `wp_options` SET `option_value`='http://www.myurl.com' WHERE `option_name` IN ('siteurl', 'home');
Fix URLs via wp-config.php
However, you can also do this via wp-config.php
, which I find to be much more comfortable. Just open wp-config.php
and add the lines:
但是,你也可以通过wp-config.php来做到这一点,我发现它更舒服。只需打开wp-config.php并添加以下行:
// Site URLS (override DB settings)
define('WP_HOME','http://www.myurl.com'); //<-- NO TRAILING /
define('WP_SITEURL','http://www.myurl.com'); //<-- NO TRAILING /
Obviously you'll need to supply your correct URL.
显然,您需要提供正确的URL。
It's possible that this is the only error you're having, and after adding those lines to wp-config.php
, you will be able to log in and use your site normally.
这可能是您遇到的唯一错误,在将这些行添加到wp-config.php后,您将能够正常登录并使用您的站点。
Debugging WordPress errors
However, if you continue to experience problems, and any time you're working on developing a website, you will want to see error output. You can check your server logs for information about the errors, but you may find it more convenient for WordPress to simply display the errors in the page. To enable error display, change the following setting to true
in wp-config.php
.
但是,如果您仍然遇到问题,并且在您开发网站的任何时候,您都希望看到错误输出。您可以检查服务器日志以获取有关错误的信息,但您可能会发现WordPress更方便地在页面中显示错误。要启用错误显示,请在wp-config.php中将以下设置更改为true。
define('WP_DEBUG', true);
Now WordPress will display any errors it encounters directly in the webpage. Be sure to change the setting to false
for use on a production site.
现在,WordPress将直接在网页中显示遇到的任何错误。请务必将设置更改为false,以便在生产站点上使用。
Working with wp-config.php
This file will be located in the root directory of your wordpress installation. To make any of the changes mentioned here, you may either edit the file directly on the server (via ssh
for example), or download the file with an FTP client, make your changes using a text editor, and upload the file again.
该文件将位于wordpress安装的根目录中。要进行此处提到的任何更改,您可以直接在服务器上编辑文件(例如通过ssh),或者使用FTP客户端下载文件,使用文本编辑器进行更改,然后再次上载文件。
It's also a good idea to keep a backup copy before making any changes in case you break something while you're working.
在进行任何更改之前保留备份副本也是一个好主意,以防您在工作时破坏某些内容。
References
You can read all about changing the WordPress site URL on the docs page.
您可以阅读有关在文档页面上更改WordPress站点URL的所有信息。
#2
6
Late To the party, I've experienced this recently and I managed to solve the issue. Here is what I've done.
迟到了,我最近经历过这个,我设法解决了这个问题。这就是我所做的。
Step 1: Set WP_DEBUG
to true
from the wp-config.php
file
步骤1:从wp-config.php文件中将WP_DEBUG设置为true
Step 2: I tried domain.com/wp-login.php
instead of domain.com/wp-admin
by this I was able to get atleast login form and some errors of Warning: Cannot modify header information - headers already sent by
第2步:我尝试使用domain.com/wp-login.php而不是domain.com/wp-admin这样我就能获得至少登录表单和一些错误警告:无法修改标题信息 - 已经发送的标题
Step 3: I've added ob_start();
in wp-login.php
file after <?php
in first line, of course to get me in for a while.
第3步:我添加了ob_start();在第一行
Step 4: This trick worked. I've disabled all the plugins, and errors are gone.
第4步:这个技巧奏效了。我已经禁用了所有插件,错误消失了。
Step 5: Activated all the plugins one by one to find which plugin is causing error, So that I can fix the error in particular plugin. Like there was one plugin adding style before wp_enqueque_style
so I set it to a function and hook it properly.
步骤5:逐个激活所有插件以找到导致错误的插件,以便我可以在特定插件中修复错误。就像在wp_enqueque_style之前有一个插件添加样式所以我将它设置为一个函数并正确挂钩。
There were some minor errors too like deprecated
functions. Its up to you whether you want to correct it or use alternate plugin.
有一些小错误也像已弃用的函数一样。无论您是要更正它还是使用备用插件,都取决于您。
And Don't forget to remove ob_start
from wp_login.php
file. The core files should not be changed.
并且不要忘记从wp_login.php文件中删除ob_start。不应更改核心文件。
Hope this helps someone like me.
希望这有助于像我这样的人。
#3
5
Inside your settings for your WordPress dashboard there are two fields named "WordPress address (URL)" and "Site address (URL)". These are also known as the "Home" and the "Site URL" settings for your website. The values need to match the server you're actually running on.
在您的WordPress仪表板设置中,有两个名为“WordPress地址(URL)”和“站点地址(URL)”的字段。这些也称为您网站的“主页”和“网站网址”设置。这些值需要与您实际运行的服务器相匹配。
If you can't get to the admin, you can use phpmyadmin, go into your database, find the fields kin the wp_options table, and make sure they reflect your domain.
如果你无法访问管理员,你可以使用phpmyadmin,进入你的数据库,找到wp_options表中的字段,并确保它们反映你的域名。
It should be enough in most of cases.
在大多数情况下应该足够了。
#4
4
I've fought the dreaded "White Screen of Death" myself a few times. You can browse the threads at the Wordpress Support Site to glean some suggestions, or Google it for lots and lots of people's stories and advice dealing with these. I can't recommend a single, authoritative reference for this.
我自己曾几次打过可怕的“死亡之白”。您可以浏览Wordpress支持网站上的主题以收集一些建议,或者谷歌搜索许多人的故事和建议。我不能为此推荐单一的权威参考。
In most of my cases it was caused by whitespace after a closing ?>
tag that got introduced because of changes in newline schemes between my dev and production servers, usually in a plugin.
在我的大多数情况下,它是由关闭?>标签引起的空格引起的,因为我的开发服务器和生产服务器之间的换行方案发生了变化,通常是在插件中。
You might also try putting Wordpress into debug mode or adding error_reporting(E_ALL);
to the first line of your site's /wp-admin/admin.php
file to see if these give you any hints.
您也可以尝试将Wordpress置于调试模式或添加error_reporting(E_ALL);到你网站的第一行/wp-admin/admin.php文件,看看这些是否给你任何提示。
I've personally been able to avoid these (touch wood) by using the XCloner plugin to make transfers between my Win dev machine and *nix production server.
我个人能够通过使用XCloner插件在我的Win dev机器和* nix生产服务器之间进行传输来避免这些(触摸木材)。
#5
2
Edit wp-content/themes/active-theme-folder/function.php and add this code just before:
编辑wp-content / themes / active-theme-folder / function.php并在之前添加此代码:
<?php
define('WP_HOME','http://www.myurl.com'); //<-- NO TRAILING /
define('WP_SITEURL','http://www.myurl.com');
#6
0
I had the same problem after migrating to a local server. A first attempt failed because there were many hardcoded filepaths in the database. So I tried again and took care to create the same path as on the live server and the same hostname and databasename. Now the website was good but wp-login gave a white screen.
迁移到本地服务器后,我遇到了同样的问题。第一次尝试失败,因为数据库中有许多硬编码的文件路径。所以我再次尝试并注意创建与实时服务器相同的路径以及相同的主机名和数据库名。现在网站很好,但是wp-login给了一个白色的屏幕。
With wp-debug I found that the problem was caused by wp-super-cache plugin that had a full filepath hardcoded in the config.php Changing this path to the full local path did the trick.
使用wp-debug我发现问题是由wp-super-cache插件引起的,该插件在config.php中有一个完整的文件路径硬编码。将这条路径改为完整的本地路径就可以了。
#7
0
Add the below line into the wp-config.php
file:
将以下行添加到wp-config.php文件中:
define('WP_HOME', 'http://' . $_SERVER['SERVER_NAME']);
define('WP_SITEURL', WP_HOME . '/');
#8
0
In you wp-config.php file just above the line stop editing line add this line:
在你停止编辑行上方的wp-config.php文件中添加以下行:
define('RELOCATE',true);
/* That's all, stop editing! Happy blogging. */
Then go to your login URL, refresh the page and log in. IMPORTANT: If you can log in, then remove the RELOCATE line before preceding any further. Then navigate to:
然后转到您的登录URL,刷新页面并登录。重要信息:如果您可以登录,请先删除RELOCATE行,然后再继续操作。然后导航到:
Settings > General
Set your Wordpress URL and Site address to the correct locations:
将您的Wordpress URL和站点地址设置为正确的位置:
WordPress Address (URL): http://example.com/wordpress
Site Address (URL): http://example.com/myblog
Press "Save".
#9
0
These are the steps I usually follow.
这些是我通常遵循的步骤。
- Upload files and database.
- Set the correct file permissions.
- Update the database configurations in the wp-config.php file to match the server db login.
- Update the
wp_options
table for updating the site url and home url. - If everything goes well you should be able to login to the admin using the
wp-login.php
as the url. - The first thing next to do is to go to the permalinks and click save it will automatically update the
.htaccess
file. If there is no write permisson it will show you can copy it and edit the file via ftp. - Next thing you can easily update all the urls safetly with a plugin named
velvet urls
. Using it for many years. It will update all other urls in the database.
上传文件和数据库。
设置正确的文件权限。
更新wp-config.php文件中的数据库配置以匹配服务器db登录。
更新wp_options表以更新站点URL和主URL。
如果一切顺利,您应该能够使用wp-login.php作为URL登录管理员。
接下来要做的第一件事就是转到固定链接并单击“保存”,它将自动更新.htaccess文件。如果没有写入权限,它将显示您可以复制它并通过ftp编辑该文件。
接下来,您可以使用名为velvet urls的插件轻松更新所有网址。使用它多年。它将更新数据库中的所有其他URL。
All these steps will be enough if everything goes correctly.
如果一切正常,所有这些步骤就足够了。
If you get a blank page or something you can turn on the error reporting and write the logs from the wp config file itself. You can try some of these to debug.
如果您获得空白页面或其他内容,您可以打开错误报告并从wp配置文件本身写入日志。您可以尝试其中一些进行调试。
- Just remove plugins from the folders one by one.
- Remove the custom theme which you are using.
只需逐个删除文件夹中的插件即可。
删除您正在使用的自定义主题。
Unless you edited the core files mostly it will solve the issue. Only other chance is the version mismatch for php or mysql that is also very important thing to note while migrating. Hope this helps someone.
除非您主要编辑核心文件,否则它将解决问题。只有其他机会是php或mysql的版本不匹配,这也是迁移时需要注意的重要事项。希望这有助于某人。