|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-03-10 19:46 UTC] jeff at qoolio dot org
Description:
------------
I am using PHP5 beta 4 and am experiencing a failure to redirect when using the header() function with the Location HTTP header. I have found that adding a print(" ") line after the header() call results in a successful redirect.
My configuration is:
#!/bin/sh
./configure \
--prefix=/opt \
--enable-inline-optimization \
--disable-short-tags \
--with-apache-hooks=/opt/httpd/bin/apxs \
--disable-cgi \
--with-sqlite \
--enable-sysvshm \
--enable-sysvsem \
--enable-sysvmsg \
--with-zlib=/usr \
--with-libxml-dir \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-zlib-dir \
--with-ttf \
--with-freetype-dir \
--with-mysql=/usr \
--with-pgsql \
--with-expat-dir=/usr \
--with-xsl \
--enable-exif \
--enable-soap \
--with-xmlrpc
This problem happens whether the .ini setting for output_buffering is On or Off. I have no special settings in my php.ini.
Reproduce code:
---------------
<?php
header("Location: http://www.php.net/");
?>
This code fails to redirect.
<?php
header("Location: http://www.php.net/");
print(" ");
?>
This code succesfully redirects
For now, this can be tested at:
http://blog.qoolio.org:82/header_test.php (w/o print)
http://blog.qoolio.org:82/header_test2.php (w/print)
Expected result:
----------------
Successful HTTP redirect via Location header.
Actual result:
--------------
Failure to redirect.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 01:00:02 2025 UTC |
I have experienced the same problem when the header tag was directly after a mysql query. I had to add a print statement after the header("Location: "); tag.