I stumbled over a strange bug on two systems the other day where the imagettftext() function was always writing the text in yellow. No matter how I set the colour, imagecolorallocate($image, 0, 0, 0);, I would always get yellow. Why yellow?
Both systems are Ubuntu, I don’t know if it is a mix up on the libraries from the package, or indeed PHP.
I had to recompile PHP ignoring the –with-ttf option which most docs suggest, and just use the –with-freetype-dir instead. Problem solved.