Re: Baffling! Redirects with header() takes minutes to respond.
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.php archive

Re: Baffling! Redirects with header() takes minutes to respond.

From: Andy Hassall <andy@andyh.co.uk>
Date: Wed Nov 16 2005 - 20:52:35 CET

On 15 Nov 2005 18:35:06 -0800, "Monty" <monty3@hotmail.com> wrote:

>The PHP version on my server is part of the standard Red Hat Linux ES
>3.0 bundle, and is updated by RedHat, so, while the version may be
>4.3.2, it has all the fixes and security updates already applied by
>RedHat Up2date.

 Ah. Fair enough.

>None of the things you mention as a possible cause for this are
>relevant, actually, because the fix is to add an "exit;" after a
>header. Once I do that, it works as it used to. If the cause was
>something else, I presume adding an exit would make no difference, but
>it does.

 I'm suggesting that some of your code that is running after the header() call
that is taking a significant time.

 Adding exit immediately after header() prevents that code running.

 For a trivial example:

<?php
header("Location: http://www.php.net/");
sleep(10);
?>

 This takes 10 seconds to actually redirect. So the code that runs after
header() is significant. exit skips it. If it worked before, then surely it is
a possible cause that the code used to run quickly so you didn't notice, but
now it runs slowly.

 So, what is running after the header call?

-- 
Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Received on Mon Nov 21 03:03:57 2005