Support » Fixing WordPress » Database and Header error using Lighttpd and FastCGI

  • I have full control of my server so I decided to run Lighttpd and FastCGI running on Ubuntu server (all latest versions).

    Everything seems to work fine EXCEPT the comment system.

    I’ve reverted to a 100% default installation of WordPress to eliminate any theme/plugin conflicts.

    When posting a comment I get this error:

    WordPress database error: [MySQL server has gone away]
    SELECT * FROM wp_comments WHERE comment_ID = '13' LIMIT 1
    
    Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/publicvent.com/subdomains/t7/httpdocs/blog/wp-includes/wp-db.php:133) in /var/www/vhosts/publicvent.com/subdomains/t7/httpdocs/blog/wp-comments-post.php on line 67
    
    Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/publicvent.com/subdomains/t7/httpdocs/blog/wp-includes/wp-db.php:133) in /var/www/vhosts/publicvent.com/subdomains/t7/httpdocs/blog/wp-comments-post.php on line 68
    
    Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/publicvent.com/subdomains/t7/httpdocs/blog/wp-includes/wp-db.php:133) in /var/www/vhosts/publicvent.com/subdomains/t7/httpdocs/blog/wp-comments-post.php on line 69
    
    Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/publicvent.com/subdomains/t7/httpdocs/blog/wp-includes/wp-db.php:133) in /var/www/vhosts/publicvent.com/subdomains/t7/httpdocs/blog/wp-includes/pluggable.php on line 331

    You may see it live in action here, just try leaving a comment.

    The comment still gets sent to the database and will show up once refreshed.

    I have read around and tried some older fixes I’ve found, none of which work on 2.2.

    The problem for the header seems to be in how the cookies are handled.

    Even the code of the wp-includes/pluggable.php hint towards this.

    // Cookie safe redirect.  Works around IIS Set-Cookie bug.
    // http://support.microsoft.com/kb/q176113/
    if ( !function_exists('wp_redirect') ) :
    function wp_redirect($location, $status = 302) {
    	global $is_IIS;
    
    	$location = apply_filters('wp_redirect', $location, $status);
    
    	if ( !$location ) // allows the wp_redirect filter to cancel a redirect
    		return false; 
    
    	$location = preg_replace('|[^a-z0-9-~+_.?#=&;,/:%]|i', '', $location);
    	$location = wp_kses_no_null($location);
    
    	$strip = array('%0d', '%0a');
    	$location = str_replace($strip, '', $location);
    
    	if ( $is_IIS ) {
    		header("Refresh: 0;url=$location");
    	} else {
    		if ( php_sapi_name() != 'cgi-fcgi' )
    			//status_header($status); // This causes problems on IIS and some FastCGI setups
    		header("Location: $location");
    	}
    }

    As for the database error, this is strange,. the install of MySQL is 100% default. I haven’t changed or tweaked a thing.

    ANY suggestions or pointers on how I may resolve these problems will be GREATLY appreciated.

    Thanks in advance,
    Steven

Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Database and Header error using Lighttpd and FastCGI’ is closed to new replies.