Tuesday, 25 September 2007

FSG3, SMF, Visual Verification Headache

I am running the Simple Machines Forum software (php) on an Freecom FSG3 Network Storage Box, and have been banging my head on the table because I cannot get the visual verification function to work - all I see is the randomised dots, and no letters in the middle.

The server is Apache, so I checked that it could do graphics - I ran httpd -l to get a list of all of the included modules, and didn’t see the ‘gd’ module, which is needed for the graphics - I though that was it, and wasted a long time trying to cross-compile Apache (that’s a different story). Eventually I found that if you create a php file as follows:

And access if from your webserver, it tells you everything you need to know, including the fact that the gd modules are, after all, included.

Configure Command: ‘./configure’ ‘–prefix=’ ‘–target=arm-linux’ ‘–host=arm-linux’ ‘–build=i686-pc-linux-gnu’ ‘–with-mysql’ ‘–with-apxs=../apache_1.3.33/apxs’ ‘–with-config-file-path=/usr/local/apache/conf’ ‘–enable-mbstring’ ‘–with-gd’ ‘–with-png-dir=/lib’ ‘–with-jpeg-dir=/lib’ ‘–with-zlib’

Knowing that it was after all supported, I started to delve into the php code for the server, looking at each function in turn to check if it was supported. The only thing that was not supported was the true-type-font functions, but this didn’t matter as the code checked for it.

Eventually, I looked at the manpage for the imageloadfont, and saw the following:

“The font file format is currently binary and architecture dependent. This means you should generate the font files on the same type of CPU as the machine you are running PHP on.”

It all became clear. The FSG3 is a big-endian system, whereas (I presume) the SMF software was tested on a little-endian system.

The simple act of replacing the font files with big-endian versions enabled the visual verification system to work.

If you just see random dots and no text in the SMF visual verification image, and your system is big-endian, simply replace the gdf font files with big-endian versions.

No comments:

Post a Comment