Title: Database and Header error using Lighttpd and FastCGI
Last modified: August 18, 2016

---

# Database and Header error using Lighttpd and FastCGI

 *  [tseven](https://wordpress.org/support/users/tseven/)
 * (@tseven)
 * [18 years, 11 months ago](https://wordpress.org/support/topic/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](http://t7.publicvent.net/blog/), 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)

 *  Thread Starter [tseven](https://wordpress.org/support/users/tseven/)
 * (@tseven)
 * [18 years, 11 months ago](https://wordpress.org/support/topic/database-and-header-error-using-lighttpd-and-fastcgi/#post-588943)
 * I’m not sure why my post doesn’t show up in the search, but thought I’d give 
   it a *bump*.
 * Thanks
 *  [smatthews](https://wordpress.org/support/users/smatthews/)
 * (@smatthews)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/database-and-header-error-using-lighttpd-and-fastcgi/#post-589130)
 * I’ve had this same exact problem on Bluehost. No solution yet, and could use 
   some help also.
 * Steve
 *  [smatthews](https://wordpress.org/support/users/smatthews/)
 * (@smatthews)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/database-and-header-error-using-lighttpd-and-fastcgi/#post-589131)
 * Follow up. Works fine once FastCGI is shut down.
 *  [mwhistle](https://wordpress.org/support/users/mwhistle/)
 * (@mwhistle)
 * [18 years, 9 months ago](https://wordpress.org/support/topic/database-and-header-error-using-lighttpd-and-fastcgi/#post-589155)
 * smatthews, thanks for posting that follow-up. Disabling fastCGI on BlueHost fixed
   my comment posting problem (same as original poster) and several other issues
   too. I was just about to re-install WordPress when I found your post. Thanks 
   for saving me the headache.
 *  [meonkeys](https://wordpress.org/support/users/meonkeys/)
 * (@meonkeys)
 * [18 years, 6 months ago](https://wordpress.org/support/topic/database-and-header-error-using-lighttpd-and-fastcgi/#post-589189)
 * I’m also on Bluehost, using WordPress 2.3.1. Disabling FastCGI fixed anonymous
   comment posting for me. Thanks!
 *  [meonkeys](https://wordpress.org/support/users/meonkeys/)
 * (@meonkeys)
 * [18 years, 6 months ago](https://wordpress.org/support/topic/database-and-header-error-using-lighttpd-and-fastcgi/#post-589190)
 * Ticket entered to track this issue: [http://trac.wordpress.org/ticket/5382](http://trac.wordpress.org/ticket/5382)

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Database and Header error using Lighttpd and FastCGI’ is closed to new
replies.

## Tags

 * [cookie](https://wordpress.org/support/topic-tag/cookie/)
 * [database](https://wordpress.org/support/topic-tag/database/)
 * [fastcgi](https://wordpress.org/support/topic-tag/fastcgi/)
 * [header already sent](https://wordpress.org/support/topic-tag/header-already-sent/)
 * [lighttpd](https://wordpress.org/support/topic-tag/lighttpd/)
 * [MySQL](https://wordpress.org/support/topic-tag/mysql/)
 * [MySQL server has gone away](https://wordpress.org/support/topic-tag/mysql-server-has-gone-away/)
 * [session](https://wordpress.org/support/topic-tag/session/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 6 replies
 * 4 participants
 * Last reply from: [meonkeys](https://wordpress.org/support/users/meonkeys/)
 * Last activity: [18 years, 6 months ago](https://wordpress.org/support/topic/database-and-header-error-using-lighttpd-and-fastcgi/#post-589190)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
