Setting cookies - Apache 1.3.27, PHP 4.3.1, Win2K, MySQL 4.0.13-max-debug, PHPLib 7.4-pre2
| From: | Stephen & Micaela | Date: | Thu, 22 May 2003 15:43:04 +0000 |
| Subject: | Setting cookies - Apache 1.3.27, PHP 4.3.1, Win2K, MySQL 4.0.13-max-debug, PHPLib 7.4-pre2 | ||
| Groups: | php.install | ||
| Request: | Send a blank email to php-install+get-10937@lists.php.net to get a copy of this message | ||
Using Mozilla 1.3 (HTTP Mozilla/5.0) and IE 5.50 SP 2, setcookie() does
not actually set a session cookie. At one point before re-installing
Apache 1.3.27, I was able to set a cookie in both browsers, but
something has broken since and I have not been able to recall which of
my configuration actions was responsible. I cross-compared my old
httpd.conf with my new one to try to ensure the same environment on the
webserver as was successful previously.
PHP interprets all PHP scripts properly and I'm getting no PHP errors in
my log file nor Apache errors in my error.log.
I mainly use Mozilla, which is set to prompt me if a cookie wants to be
set, and I have double-checked to ensure that it is not set to block
cookies from localhost.
I run the ZoneLabs Pro firewall but have unloaded it completely to test
localhost scripts, in case it was interfering with cookies (but it
hasn't interfered with any others when loaded and is set to allow
localhost cookies when running). But no joy.
Here is the test script I used to try setting a test cookie (first lines
in script) - without calling PHPLib session (or any other) classes:
<?php
setcookie("osp", "hello", time()+3600, "/", ".localhost",
0);
?>
<html>
[...]
</html>
Here are HTTP-Headers from phpinfo(), which result from using PHPLib's
prepend.php (from phplib 7.4-pre2) for db virtualization including
session setup and have double-checked all PHPLib manual instructions
(the only test that doesn't work is incrementing the SID with
test.php3 - I have register_globals=Off in php.ini). Note the weird
expiration date on the Set-Cookie instruction in HTTP Response (PHPLib
simply uses (date()*60)+43200 to set the cookie lifetime), which should
expire in 30 days from cookie set date:
HTTP Request GET /test.php3 HTTP/1.1
Accept
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plai
n;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
Accept-Encoding gzip,deflate,compress;q=0.9
Accept-Language en-us,en;q=0.5
Cache-Control max-age=0
Connection keep-alive
Host localhost
Keep-Alive 300
Referer http://localhost/index.php3
User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3)
Gecko/20030312
User-Agent Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0; T312461)
HTTP Response Headers
Set-Cookie osp=036aafb8e93397edd3733011430cc331; expires=Sun, 09-Nov-36
03:59:51 GMT; path=/; domain=localhost
Expires Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control no-store, no-cache, must-revalidate, post-check=0,
pre-check=0
Pragma no-cache
Keep-Alive timeout=15, max=100
Connection Keep-Alive
Transfer-Encoding chunked
Content-Type text/html
Here are my php.ini [Sessions] directives (all of these show up in
phpinfo()'s Sessions block):
session.save_handler=files
session.save_path="C:\phpdev\php\temp"
session.use_cookies=1
session.use_only_cookies=False
session.name=PHPSESSID
session.auto_start=0
session.cookie_lifetime=0 ; 2592000
session.cookie_path=/
session.cookie_domain=localhost
session.cookie_secure=False
session.serialize_handler=php
session.gc_probability=5
session.gc_maxlifetime=1440
session.referer_check=
session.entropy_length=0
session.entropy_file=
session.cache_limiter=nocache
session.cache_expire=1
session.use_trans_sid=0
url_rewriter.tags="a=href,area=href,frame=src,input=src,fieldset=" ;
form=fakeentry removed for XHTML compatibility
session.bug_compat_42 = 0
session.bug_compat_warn = 1
Here is my <IfModule mod_mime.c> from httpd.conf (ServerName localhost):
LoadModule php4_module "c:/phpdev/php/sapi/php4apache.dll"
# AddModule mod_php4.c [Note: apache -t complained - module not found -
when I uncommented this]
# ScriptAlias /php/ "c:/phpdev/php/"
AddType application/x-httpd-php .php4
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .inc
AddType application/x-httpd-php .fire
AddType application/x-httpd-php .osp
AddType application/x-httpd-php .htm
AddType application/x-httpd-php-source .phps
# Action application/x-httpd-php "/php/php.exe"
Can't think of anything else - thanks in advance,
Stephen