Receiving the 500 Internal Server error header in Drupal despite your site displaying normally? Here's where to look.


Category: server, php, drupal, seo

Ah, they joys of TinyMCE. The lovely editor will sometimes insert a line of blank text into the 'PHP Code' window of your custom content kit (CCK) type, this causes an eval() statement to break - you may see an error in your logs along the lines of :-

[Sat Feb 14 11:15:16 2009] [error] [client 64.39.0.38] 
 PHP Parse error:  syntax error, unexpected '<' in 
 /var/www/vhosts/yourdomain.com/httpdocs/modules/cck/content.module(1638) : 
 eval()'d code on line 1

If you have display_errors turned off in PHP, eval() can return a 500 Internal Server error header. This will mean Google and any monitoring software will receive a 500 error despite the site seeming to display normally.

So, to solve, head to

site building -> modules -> list

Turn off TinyMCE and save.

Then head to

Content Management -> Content Types -> Edit *your content type* -> manage fields.

Check the PHP Code area of each field for some text that TinyMCE may have dropped in there, delete it. Reenable TinyMCE problem gone!

Now resubmit to Google and breathe a sigh of relief :)

***UPDATE***

We tend to use CKEditor these days in Drupal installations, we've found it to be a stronger, tidier editor and the include/exclude rules are far more flexible and much stronger out of the box.

 


Comments

Your solution has saved the day

I just stumbled upon this after having spent and wasted nearly a whole day trying to fix the WSOD I was getting.

Thank you very much

This was very useful and

This was very useful and probably saved me several hours investigation.

Thank you

Other causes

The error you mention here can also be caused by syntax errors in code inside blocks or the visibilty settings of blocks.

other errors

The error can also be found in php code in your blocks, or the visibility settings of a block.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Post new comment

The content of this field is kept private and will not be shown publicly.