Re: ini_set()
| From: | Matthew Weier O'Phinney | Date: | Mon, 06 Jun 2005 15:49:39 +0000 |
| Subject: | Re: ini_set() | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-39591@lists.php.net to get a copy of this message | ||
* veditio@comcast.net <veditio@comcast.net>:
> In order to create a session handling function that does not rely at
> all on cookies, I'm trying to use ini_set('session.use_cookies', '0')
> to make sure that the PHP server does not set cookies on page load.
>
> However, even though the ini_set goes through (as evidenced by the "0"
> in the ini_get()) the page sets a cookie every time with the name
> PHPSESSID.
>
> No matter what I do, that cookie still gets set, and I can't seem to
> get it to stop. Even on the simplest pages, it still sets. The
> following code still sets a cookie:
>
> <?php
> ini_set('session.use_cookies', '0');
> $x=ini_get('session.use_cookies');
> echo($x);
> ?>
>
> Even though the $x returns the correct value, ('0'), the cookie still gets set.
>
> I'm using PHP 4.3.10 on OS 10.3 Mac, but the same thing happens on my
> ISP who serves the same version of PHP on a Linux box.
>
> Any ideas?
Is session.auto_start on (i.e., non-zero)? If so, that's occurring
*before* your script is compiled, and will be using the value for
session.use_cookies that is in the php.ini file.
One possible way to get around this is to do your ini_set in a .htaccess
file instead (assuming htaccess files are enabled, and you're using
Apache):
.htaccess:
php_value session.use_cookies 0
Try that and see if it works.
--
Matthew Weier O'Phinney | WEBSITES:
Webmaster and IT Specialist | http://www.garden.org
National Gardening Association | http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org
mailto:matthew@garden.org | http://vermontbotanical.org