note 53825 added to function.header

From: Date: Tue, 14 Jun 2005 13:18:42 +0000
Subject: note 53825 added to function.header
Groups: php.notes 
Request: Send a blank email to php-notes+get-90412@lists.php.net to get a copy of this message
Perl users beware, if you are used to printing headers to Apache, PHP will likely work differently. I am on a typical Apache/Linux server and I found that # php header("HTTP/1.1 301 Moved Permanently"); header("Location: ".$url); works the same as # perl print "Status: 301 Location: $url\n\n"; Both produced the proper headers HTTP/1.1 301... Location: ... Connection: close... and neither method worked in the other language. In other words: # php: Did not work, in either order: header("Location: ".$url); header("Status: 301"); # php: Not needed: header("Connection: close"); This is contrary to some of the comments below, so you may want to try both methods and check the actual headers your server returns. The telnet method is this: telnet domain.tld 80 GET /page.htm HTTP/1.0 (return-return) ---- Manual Page -- http://www.php.net/manual/en/function.header.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+53825 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53825&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53825&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53825&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53825&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53825&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+53825&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#90412) next »