I realise this has been asked many times, and the answer is usually some whitespace before or after the PHP tags however I have checked all my files and not found any evidence of this.
I am using Wordpress and have debug mode switched on. My site works on one domain however I recently moved it to a new server (still running apache on linux - I did move from shared to a VPS) and gave it a new domain. All I have changed is the following in wp-config.php
:
define('DB_NAME', 'new db name');
define('DB_USER', 'new db user');
define('DB_PASSWORD', 'new db password');
define('WP_HOME','new url');
define('WP_SITEURL','new url');
However I am now unable to log in, I have narrowed this down to the fact cookies are not being set. If I visit wp-login.php
I get the following errors:
Warning: Cannot modify header information - headers already sent by (output started at /home/rcnhca/public_html/wp-includes/load.php:270) in /home/rcnhca/public_html/wp-login.php on line 368
Warning: Cannot modify header information - headers already sent by (output started at /home/rcnhca/public_html/wp-includes/load.php:270) in /home/rcnhca/public_html/wp-login.php on line 380
Note: Both wp-login.php
and load.php
are core Wordpress files.
line 368 of wp-login.php
is:
header('Content-Type: '.get_bloginfo('html_type').'; charset='.get_bloginfo('charset'));
and line 380:
setcookie(TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN);
line 270 of load.php
is:
ini_set( 'display_errors', 1 );
However I also recieve the following warning:
Warning: ini_set() has been disabled for security reasons in /home/rcnhca/public_html/wp-includes/load.php on line 270
Which I believe is because I have the Suhosin PHP patch installed but I am not definite on this. I do not want to run a more vulnerable version of PHP.
I can't work out why this error is occurring, there is no trailing whitespace in any of my theme's PHP files.
Note: I also realise I can use output buffering to solve this, however I want to understand where the problem is occurring instead of applying a one-size fits all patch which will affect my debugging capabilities.