|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #27558 [apache hooks] Location HTTP header failure
Submitted: 2004-03-10 19:46 UTC Modified: 2016-06-20 15:41 UTC
Avg. Score:4.8 ± 0.4
Reproduced:4 of 4 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: jeff at qoolio dot org Assigned: cmb (profile)
Status: Closed Package: Apache related
PHP Version: 5CVS-2004-03-11 OS: Linux
Private report: No CVE-ID: None
 [2004-03-10 19:46 UTC] jeff at qoolio dot org
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:


./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 \

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:



This code fails to redirect.


print(" ");


This code succesfully redirects

For now, this can be tested at:  (w/o print) (w/print)

Expected result:
Successful HTTP redirect via Location header.

Actual result:
Failure to redirect.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-03-11 14:41 UTC] jeff at qoolio dot org
I downloaded and compiled the latest snapshot (200403110630) and this problem still exists. I also compiled beta 1 and beta 3 as a test and the problem still exists in these versions as well. This is not a problem with the 4.3.x series.
 [2004-03-15 09:59 UTC]
Please try using --with-apxs=/opt/httpd/bin/apxs 
so we'll know if this is purely apache-hooks sapi issue.

 [2004-03-16 16:57 UTC] jeff at qoolio dot org
I reconfigured with the --with-apxs switch instead of --with-apache-hooks switch and the problem disappears. So it looks like the apache hooks SAPI.
 [2005-01-14 04:24 UTC] vtexjunk at ameritech dot net
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.
 [2011-01-01 23:22 UTC]
-Package: Feature/Change Request +Package: Apache related
 [2016-06-20 15:41 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2016-06-20 15:41 UTC]
Hm, Apache 1… Guess this ticket can be closed now.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Feb 22 05:01:28 2024 UTC