PHP - Readfile being slow, what are my options

TriLoGuE

New Member
I'm trying out at PHP for the first time (coming from classic ASP) and I'm testing loading a remote image and displaying it, using READFILE. During testing, I noticed a huge difference in return times compared to my old ASP script, which does exactly the same thing, pretty much. The PHP version actually took twice as long to load.Here is my PHP, which is only 3 little lines of code:\[code\]<?php$url = "https://s3.amazonaws.com/bucket/file.jpg";header("Content-Type: image/jpeg"); readfile($url);?>\[/code\]Here is my ASP version:\[code\]<%Set objHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")objHTTP.Open "GET", "https://s3.amazonaws.com/bucket/file.JPG"objHTTP.SendSet Jpeg = Server.CreateObject("Persits.Jpeg")Jpeg.OpenBinary(objHTTP.responseBody)Jpeg.SendBinary%>\[/code\]Why is my old, finished, dead, deprecated, old-school, diseased Classic ASP version doing much better than good old PHP? The ASP version is actually doing more than the PHP version. Is there something else I can use apart from READFILE that could be quicker? Am I using READFILE correctly? I'm not saying I'm looking at my clock waiting, both load in a split second, but PHP has a very noticeable delay.
 
Back
Top