Computery

Drupal makes "An illegal choice"

Tags: 

Here's a weird one. Have a content type with about forty fields. When I click Preview on an empty form it gives the error "An illegal choice has been detected. Please contact the site administrator." which you're sure to agree is not terribly useful. I took a look at the watchdog logs and saw that the field throwing the error is a required integer checkbox that had no items selected. So instead of saying "You must select one of the items" it says "sir you are a smeghead" - not very useful, Drupal.

Stop MySQL giving up on Drupal

Tags: 

With Drupal, if you have a content type with lots of records you can run into a problem where you start getting lots of "server has gone away" errors from MySQL. This stems from queries getting too long and MySQL giving up before the query has finished loading. So, to fix it, just edit your my.ini or my.cnf file to add the following line to the [mysqld] section:

  • max_allowed_packet=24M

There are other settings that can make a difference too, but this seems to be a good starting point.

Patch for wp2drupal for Drupal 6

Tags: 

I'm trying to migrate one of my personal sites from Wordpress to Drupal and needed a way to migrate the existing data. Well, it turned out to be a little tricky as I'm using Drupal 6 while the only really useful converter, wp2drupal, was written for Drupal 5. Luckily someone converted wp2drupal to D6, so away I went.

Unfortunately I wasn't able to get far, it turned out that there was a problem in the D6 port which causes an "Access Denied" error when you actually submit the form to begin the conversion. Not to be undone, I started poking around the script and discovered that the menu configuration was using an older format than what the current Drupal release (v6.4) required. A few quick lines later and I was able to get it working again.

In the interests of helping the community I've compiled the changes into a patch file:

There are still a bunch of syntax errors that will show up after the data has converted, but at least it will actually convert the data over. Also, I made some minor tweaks to the code according to the Drupal development guidelines based on what the coder module recommended. Lastly, be warned that the patch was created using git, so it may be easier to just add the few missing "access" lines manually.

One solution for "unexpected T_SR" errors in PHP

Tags: 

Here's a little tidbit. If you ever get "Parse error: syntax error, unexpected T_SR" errors in PHP, check to see if you had any svn merge conflicts. This error raised its ugle head this evening for me and that's exactly what it turned out to be. Then just bounce over to your svn client of choice, fix the conflict (or just delete the offending files and grab the latest file again), and the error will disappear.

Drupal imagecache setup on OSX

Tags: 

As mentioned before, PHP is misconfigured on OSX and you don't get their customized sourcecode in order to recompile it with the options you need. As such you can't run the GD plugin which is what most OSS programs use for image processing, and is generally the most recommended way of doing it. For Drupal's ImageCache / ImageAPI module(s) what you can do instead is install the ImageMagick package and then just tell Drupal to use the ImageAPI-ImageMagick module instead of the GD one. I've already got ImageMagick installed on my McBook for Rails use so it was only a few seconds to get it going for Drupal too.

Pages

Subscribe to Computery