Jsbeginner schreef: > Hello, > > I don't know for sure is this problem is only related to PHP so I hope > I've posted in the right list. > > My problem is that with certain headers my script takes about 5 seconds > before sending the page, no matter how small the file I try to load... > My server : > Centos > Apache 2.2 > PHP 5.2.9 > > Here's my code : > > <?php > header('Content-Type: application/x-javascript'); > header('Content-Length: '.filesize('test.js')); > readfile('test.js'); > ?> > > test.js is only a few lines long, and if I remove the header content > type the file loads instantaniously do it's not a problem with readfile. > I thought about zlib gzip taking maybe a long time to load but I've > changed the compression level from 6 to 1 and the file still has a the > same lag. > > My server responds very fast for eveything else except this script. Do > you have an idea what might be causing this lag ? something to do with apache, usually we we see this it's something to do with DNS lookups ... unlikely in your case. I figure it's something to do with apaches' content negotiation, possibly it looks up your content-type for some reason but ends up not recognizing it (and tries alsort of stuff before giving up and just sending the output) http://httpd.apache.org/docs/2.0/content-negotiation.html question is do you really need "application/x-javascript"? won't "text/javascript" do just fine? or does that have the same problem? ... actually does the problem occur with any value for 'Content-Type'? > > Thanks in advance :) > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php