0

I moved my Wordpress-based website from an Apache server to a Nginx server, and something, somewhere went wrong.

I'm getting a mangled website (as in: CSS isn't being loaded so the lay-out is completely wrong). When I try to access /wp-admin to log in, I get:

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

I was also getting error messages from WP Super Cache plugin, but I was able to disable that from PHPmyAdmin.

Looking at the website (www.potgieter.nl), and checking firebug, I get the impression the PHP isn't being executed properly. As far as I understand Wordpress, it uses PHP to call things like posts, pages and CSS. Now the text, Javascript and images are being called correctly and are displayed. Even the slider works. However, the sizing, positioning and color are all horribly wrong.

I ran ps -ef from the SSH, and it showed PHP is running:

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

I'm runnning 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

I have seen the question linked to below, and I've tried to follow the steps outlined there as best I could, but to no avail.

How to fix "Headers already sent" error in PHP

I am looking for the reason the website isn't loading properly, so I can start looking for a way to solve the issue.

Any and all help would be greatly appreciated.

Edit: this is the first bit of my wp-config.php. There is no whitespace on line one, nor is there any other HTML before the <?php tag.

<?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
 */
Community
  • 1
  • 1
Tijmen
  • 542
  • 1
  • 6
  • 29

1 Answers1

2

I'm not sure how well you checked the question you linked because it's answers are quite clear.

The error message is also clear wp-config.php:1

You are looking for something that will cause output to be produced on line 1 of wp-config.php

You probably have whitespace before the opening php tag

eg

<!-- empty line here -->
<?php
...
..
andrew
  • 9,313
  • 7
  • 30
  • 61
  • I must have checked for a whitespace at least 10 times by now, and it's not there. – Tijmen Jun 23 '16 at 15:37
  • 1
    To make sure you could copy the file contents to a new file (selecting everything from the ` – andrew Jun 23 '16 at 15:41
  • Wow, that actually worked. Thank you so much. I had no idea there was such a thing as an invisible, unelectable whitespace. Any idea why simply putting the cursor before the < and backspacing didn't work? – Tijmen Jun 23 '16 at 15:48
  • I accepted your answer, because in the end, it was the right solution after all. – Tijmen Jun 23 '16 at 15:49
  • No worries, glad to help – andrew Jun 23 '16 at 15:49
  • 1
    tbh Im not entirely sure, i think it is something to do with the way line feeds and carriage returns are handled across operating systems – andrew Jun 23 '16 at 15:51