我将基于Wordpress的网站从Apache服务器移动到Nginx服务器,某些地方出了问题。
我收到了一个受到严重破坏的网站(如:未加载CSS,因此布局完全错误)。当我尝试访问/ wp-admin登录时,我得到:
Warning: Cannot modify header information - headers already sent by (output started at /var/hpwsites/u_potgieter/website/html/webroot/wp-config.php:1) in /var/hpwsites/u_potgieter/website/html/webroot/wp-login.php on line 390
Warning: Cannot modify header information - headers already sent by (output started at /var/hpwsites/u_potgieter/website/html/webroot/wp-config.php:1) in /var/hpwsites/u_potgieter/website/html/webroot/wp-login.php on line 403
我也从WP Super Cache插件中收到错误消息,但我能够从PHPmyAdmin禁用它。
查看网站(www.potgieter.nl)并查看firebug,我得到的结论是PHP没有正确执行。据我了解Wordpress,它使用PHP来调用帖子,页面和CSS之类的东西。现在正确调用文本,Javascript和图像并显示。即使是滑块也能工作。然而,尺寸,位置和颜色都是非常错误的。
我从SSH运行ps -ef
,它显示PHP正在运行:
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 Jun17 ? 00:00:30 /usr/lib/systemd/systemd --switched-root --system --deserialize 21
u_potgi+ 19752 19744 0 16:29 ? 00:00:00 sshd: u_potgieter@pts/0
u_potgi+ 19753 19752 0 16:29 pts/0 00:00:00 -bash
u_potgi+ 19924 19919 0 16:44 ? 00:00:00 sshd: u_potgieter@notty
u_potgi+ 19925 19924 0 16:44 ? 00:00:00 /usr/libexec/openssh/sftp-server
u_potgi+ 20774 19753 0 17:08 pts/0 00:00:00 php
u_potgi+ 20781 20776 0 17:10 ? 00:00:00 sshd: u_potgieter@pts/1
u_potgi+ 20782 20781 0 17:10 pts/1 00:00:00 -bash
u_potgi+ 20804 20782 0 17:10 pts/1 00:00:00 ps -ef
我正在运行PHP7
~]$ php -v
PHP 7.0.5 (cli) (built: Apr 19 2016 12:44:23) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
我已经看到了与下面相关的问题,我试图尽可能遵循其中列出的步骤,但无济于事。
How to fix "Headers already sent" error in PHP
我正在寻找网站未正确加载的原因,因此我可以开始寻找解决问题的方法。
非常感谢任何和所有帮助。
编辑:这是我的wp-config.php的第一位。第一行没有空格,<?php
标记之前也没有任何其他HTML。
<?php
/**
* The base configurations of the WordPress.
*
* This file has the following configurations: MySQL settings, Table Prefix,
* Secret Keys, WordPress Language, and ABSPATH. You can find more information
* by visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing
* wp-config.php} Codex page. You can get the MySQL settings from your web host.
*
* This file is used by the wp-config.php creation script during the
* installation. You don't have to use the web site, you can just copy this file
* to "wp-config.php" and fill in the values.
*
* @package WordPress
*/
答案 0 :(得分:2)
我不确定你检查了你所关联的问题有多好,因为它的答案非常明确。
错误消息也很清楚wp-config.php:1
您正在寻找能够在wp-config.php第1行生成输出的内容
在开放的php标记之前你可能有空格
例如
<!-- empty line here -->
<?php
...
..