ID: 22440 Comment by: davidfelton at codemasters dot com Reported By: garfield_fr at tiscali dot fr Status: Feedback Bug Type: IIS related Operating System: Windows 2000 pro SP3 PHP Version: 4.3.2-dev New Comment:
I've been experiencing a very similar/the same bug with IIS on windows 2000 and setting cookies using PHP as CGI. How I set my cookies is as follows: As there is a bug in IIS that prevents you from setting cookies in conjunction with Header("Location: ...") the filenames of the files that set cookies are preceded with 'nph-' as detailed here: http://support.microsoft.com/default.aspx?scid=KB;en-us;q176113 so that I can send my own headers. This worked fine in PHP 4.2.3, now with PHP 4.3.2 It just doesn't work and headers are printed out to the screen. Code used is as follows: function MySetCookie($CkyName, $CkyValue, $exp, $pth, $domain, $Secure) { $exp = gmstrftime("%A, %d-%b-%Y %H:%M:%S",$exp); return "Set-Cookie: Territory=$CkyValue; path=$pth; domain=$domain; expires=$exp"; } $territory="EnglishUK"; //go to the main page Header("HTTP/1.0 302 Redirect"); Header("Location: http://www.mydomain.com/mainpage.php?territory=$territory"); //set cookie Header(MySetCookie("Territory",$territory,mktime(0,0,0,date("n"),date("j")+30),"/","mydomain.com",0)); (note this file needs to be saved as 'nph-index.php') This is an issue with PHP and not ISS. Thanks. Previous Comments: ------------------------------------------------------------------------ [2003-02-26 10:47:28] [EMAIL PROTECTED] Not enough information was provided for us to be able to handle this bug. Please re-read the instructions at http://bugs.php.net/how-to-report.php If you can provide more information, feel free to add it to this bug and change the status back to "Open". Thank you for your interest in PHP. ------------------------------------------------------------------------ [2003-02-26 10:46:25] garfield_fr at tiscali dot fr No change .... same problem ... PHPNuke doesn't work with CGI but it works with ISAPI ... ------------------------------------------------------------------------ [2003-02-26 10:23:09] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip ------------------------------------------------------------------------ [2003-02-26 10:13:23] garfield_fr at tiscali dot fr I don't know if it's a real bug but .... Config : Windows 2K pro + SP3 Serveur IIS PHP 4.3.0 this is my php.ini (full version for testing purpose) : [PHP] cgi.force_redirect = 0 cgi.rfc2616_headers = 1 [Session] session.save_handler = files session.save_path = "C:\PHP\sessions\" I'm trying to use PHPNuke 6.0.17 and I found this bug : When you want to login under PHPNuke you enter your name/password. if your login is ok the script send a cookie and redirect to an URL (your personal page). With PHP in CGI mode, no cookie are send/receive (?) to the browser (IE6 SP1) and you are not connect to PHPNuke BUT if PHP run in ISAPI mode the cookie is well receive by browser and you are connected to PHPNuke.... I don't test under Apache because I don't know how to run PHP in CGI mode under Apache, but Apache+PHP module work fine (W2K) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=22440&edit=1