FreeBSD users are lucky to have the option of compiling GIF support in GD2.x through the ports system.
All you need to do is to export the "WITH_LZW=yes" global variable when compiling the graphics/gd2 port, e.g.:
# cd /usr/ports/graphics/gd2
# export WITH_LZW=yes
# make && make install
Then recompile and (re)install the www/mod_php4 port and you are in business... :)
Good luck!