What would stop header("Location...) from working?

View: New views
4 Messages — Rating Filter:   Alert me  

What would stop header("Location...) from working?

by Tedd-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi gang:

I just had a script stop following this statement:

    header("Location:users.php");

It *was* working, but now instead of running "users.php", it defaults
to the parent script.

When I place exit() after it, such as:

    header("Location:users.php");
    exit();

The script simply exits. It does not continue to users.php -- BUT -- it did.

What would stop this statement from working?

Thanks,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Parent Message unknown Re: What would stop header("Location...) from working?

by James McLean-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Oct 28, 2009 at 10:01 AM, tedd <tedd@...> wrote:

> I just had a script stop following this statement:
>
>   header("Location:users.php");
>
> It *was* working, but now instead of running "users.php", it defaults to the
> parent script.
>
> When I place exit() after it, such as:
>
>   header("Location:users.php");
>   exit();
>
> The script simply exits. It does not continue to users.php -- BUT -- it did.
>
> What would stop this statement from working?

Any text output before the header() statement would stop it, this
includes spaces after closing ?> in any included files before the
header() as well, not just text from echos or prints.

If you have errors hidden or disabled, then you would not see the
warning from header(), try it with all errors enabled.

Cheers,

James

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: What would stop header("Location...) from working?

by Mark Cilissen-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

tedd schreef:

> Hi gang:
>
> I just had a script stop following this statement:
>
>    header("Location:users.php");
>
> It *was* working, but now instead of running "users.php", it defaults to
> the parent script.
>
> When I place exit() after it, such as:
>
>    header("Location:users.php");
>    exit();
>
> The script simply exits. It does not continue to users.php -- BUT -- it
> did.
>
> What would stop this statement from working?
>
> Thanks,
>
> tedd
>

If ANYTHING is output before header(), it stops working. Did you turn
off error reporting? You might want to double-check, because it returns
an error if anything is output.

--
Kind regards,
Mark Cilissen / Pixlism

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: ... stop header("Location...) from working? [SOLVED]

by tedd-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

At 7:31 PM -0400 10/27/09, tedd wrote:

>Hi gang:
>
>I just had a script stop following this statement:
>
>    header("Location:users.php");
>
>It *was* working, but now instead of running "users.php", it
>defaults to the parent script.
>
>When I place exit() after it, such as:
>
>    header("Location:users.php");
>    exit();
>
>The script simply exits. It does not continue to users.php -- BUT -- it did.
>
>What would stop this statement from working?
>
>Thanks,
>
>tedd

To all:

Okay, I found the problem.

The directory that contained the above script had a .htaccess file
that required authorization before running any script in that
directory -- and -- that authorization script had a trailing space.

As it turned out, there was nothing wrong with the script I was
working on and thus my confusion as to why it stopped working. It
simply stopped working because the authorization script in the
directory had been changed.

Many thanks to all who contributed.

Cheers,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php