Friday, December 7, 2007

Drupal White Screen of Death

Just when I thought that there's smooth sailing all the way I encounter a scarry problem with Drupal 5.3.

Being a newbie, I've probably been adding too many modules into the installation, but that's another story. So far, the Drupal was happily working and there was nothing weird happening. Until yesterday.

I added Embedded Video Field module (part of Embedded Media Field). Initially it worked fine - I was able to embed a YouTube video without any problems. However, after I've added this new module into my version control (I'm using Subversion), things started behaving strangely.

First symptom was after submitting a form on page (I was playing around with defining a user role) I was presented with a white screen. Some google-ing led me to posts talking about WSOD (White Screen of Death) on Drupal's main site. After reading through what to check first I realize that there was no memory shortage as my PHP.ini has a variable memory_limit set to 128M.

I turned on error reporting in PHP.ini as well by setting display_errors = On so that my apache error.log finally started showing up something. To my surprise it had something like:

[Fri Dec 07 10:01:49 2007] [error] [client 127.0.0.1] PHP Fatal error:  Cannot redeclare video_cck_bliptv_info()
(previously declared in ...sites\\all\\modules\\emfield\\contrib\\video_cck\\providers\\bliptv.inc:7)
in ...\\sites\\all\\modules\\emfield\\contrib\\video_cck\\providers\\_svn\\text-base\\bliptv.inc.svn-base on line 20
OK. Now we're getting somewhere I thought. From this I figured that Drupal was actually including SVN control files during execution. Now I have to be honest and admit that it says _svn and not .svn is not without a reason. There was a post somewhere out there that suggested modifying the default .svn extension for SVN to _svn so that Visual Studio .NET (!) can happily work with files under SVN. That fix truly did get my .NET work to move on but I suppose along the lines you end-up having this.

Disabling Drupal Module Directly

What to do now? Since the site was completely dead I figured to disable the offending module directly in the database. Modify table SYSTEM and set Status=0 for row with name cck_video. Remove everything from cache_content table as well and voila - the site is back online.

CCK_Video Module

Further reasearch lead me to a pending issue on the mentioned module. It seems its not playing nice with Subversion, so I suppose my bad that I did not catch that before. But who reads a list of pending issues prior to installing a module in Drupal? Too bad for this bug with Subversion. I guess one workaround is to have that particular module out of SVN which would not cause that error above.

Closing ?> Symbol in PHP Files

Another possible error for WSOD in Drupal could be related to Drupal coding standard. It is apparently recommended that the closing ?> symbol be omitted from all php files (read on that here, under Invisible Errors). I looked at my template.php and found that thing at the bottom (I'm using the wonderful Liquid Aberdeen theme). Promptly removing that thing crashes my site again. WSOD. Great. Apache says:
[Fri Dec 07 10:04:51 2007] [error] [client 127.0.0.1] PHP Parse error:
syntax error, unexpected '>' in ...Apache aberdeen\\template.php on line 223
Nothing else to do but to put back the closing ?> into my template.php and move on with my life. There's a lengthy discussion on this available here. From what I gather, most folks tend to suggest you should keep it there. Note that I'm not exactly sure whether you're supposed to have it in the template.php as compared to, say, an include file. I'm guessing that for template.php under Drupal it is supposed to be there

So my 2c: be on the lookout for possible issues with SVN messing-up your Drupal installation due to its control files, and as a workaround, move only those offending modules out of version control if possible. Oh, and you DO have version control on your Drupal site, rite?

3 comments:

Pedro J. Fernández said...

Thanks for post it. It was going to drive my crazy!! but here was your post and save me. I installed a new module "gallery" that work as a wrapper for the gallery2 platform. The same, all went well until the facking DWSD!!!

Thanks a lot!!!!

Spiderglow said...

Thanks for your post. This just ended my weekend long rush to reactivate a website. Views is dangerous for the unexperienced. I managed to disable access to my website by setting a view linked to a menu that was unaccesible to anonimous visitors. This resulted on a white screen of death to anyone except the admin :D

altavis said...

Yes, display_errors is in did very useful. Thanks for posting how to disable module directly in the database.