Re: ini_set()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* veditio@xxxxxxxxxxx <veditio@xxxxxxxxxxx>:
> 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@xxxxxxxxxx         | http://vermontbotanical.org

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux