I have a problem with my apache2 server and I'm not quite sure how to best debug it.
What I'm seeing:
- I've got a PHP script that renders a barcode. When this script is requested externally to the server the response is as you'd expect (> 1 sec)
- I'm using the output from the script in another script on the same server, to embed the barcode in another image using GD. For some reason, the request to fetch the barcode image using PHP (specifically using imagecreatefrompng()) is very slow ~ 15-20 seconds at least
How would I debug this issue? I've had a bit of a google and best guess so far is slow DNS lookup - how would I check this best? And if it's the case, what's the easiest fix?
Edit: The reason I'm fairly certain that the issue is related to requesting the image from the first script is that the second script runs very slow if the extra image is requested, but fast if the image is not requested. The barcode getting embedded is not the only image rendering going on (there's a fair amount of text rendering and image copying happening) but it's only when I include the barcode that the slow-down happens.