MantisBT graphs not working
Just a little note which may save someone some time. If you’re using MantisBT and are having problems with getting the graphs and visual captcha working (even though you have GD installed), read on.
I spent several hours yesterday trying to get our issue tracker setup for registrations, of which the visual captcha is a part, and I also noticed the graphs weren’t working either. I tried numerous things including tweaking the headers and changing the output format (from JPEG to PNG). The interesting thing was that if I downloaded the image with a simple HTTP client written with Delphi, I could receive the image, stream it to disk and open it with Photoshop, but make the same request with a browser and there was nothing.
I even tried asking the guys in the Mantis channel on freenode, but the only person that replied couldn’t solve the problem. Then I remembered an issue I had with the file downloader I wrote for the PGDAnnual competition site… downloads were failing with that for no reason. Now I run PHP 5, like a lot of people, and I have output buffering turned on by default, and there in lies the problem.
If you are experiencing problems with images from scripts not working when all the other indicators suggest they should, or downloaders failing, turn off output buffering in the affected scripts and see if that helps. Just add the ‘ob_end_clean();’ command at the start of the script and check whether it helps.
I’ve solved several problems with scripts that generated/streamed content this way.


