Jump to content

Cookies - Work under firefox but not IE6 or IE7


TonyB

Recommended Posts

Cookies don't work on IE6, but work fine (same client PC) under Firefox.

Using Apache2.2 and PHP5.

 

I have a network of 7 PC's behind my Router.

One I use to develop and test, one for live.

Problem occurs on all clients (various specs) under IE, works fine under Firefox.

Basically cookies work fine (under IE) when I test locally, but don't get created when server is on one PC and client is another.  Sessions suffer the same problem.

I push the cookie using setcookie('Please_work','a_value');

I dump cookies using print_r($_COOKIE);

I refresh, I get cookie if localhost, empty array if different client / host.

I suspect it's something to do with domains.  ???

I call server 'ww_dell' (from client IE6 http://ww_dell/ pulls up pages fine).

Server httpd.conf has

ServerName ww_dell:80

I've tried commenting this out, this made no difference.

I've added

HostNameLookups On

basically so I can identify the client within PHP (my Router does DHCP, so IP addresses are dynamic).

Within PHP.ini I haven't changed anything, so it contains:

session.cookie_path = /

session.cookie_domain =

 

Is there a way to find what domain the setcookie command defaults to?

Or what domain the client 'thinks it is'.

I know if the two don't match cookies are not going to work.

 

Any help /suggestions appreciated; I have been bashing my head against this one for a couple of weeks now and it's driving me nuts!

Cheers,

Tony

Link to comment
Share on other sites

  • 1 month later...

www.php.net/setcookie

 

The way you called setcookie with only a name/value will work for localhost. But for production servers you need it to have varname, value, timetoexpire, path, domain

 

Thats your problem.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.