Php settings in a .htaccess file only work when php is running as a server module.
If php is being executed via CGI (Common Gateway Interface), putting settings in a .htaccess file won’t work. In this case, you need to put the settings into either the main php.ini, a local php,ini, or in your php code so that those settings are set before every session_start statement.
Now, why do you want to do this, since the main purpose of session data is to only last one browser session?
That is for setting the cookie, how are you then reading the cookie to print it?
Do you see the cookie in your browser development tools (under the “Application” tab in the storage section… if you are using Chrome). Once you set it, you should then see it there while browsing the site where you set the cookie on.
I’m surprised nobody has mentioned Windows local storage which is browser specific and lasts forever until deleted. Also has a lot more storage than sessions or cookies I think, but could be wrong. I’m developing a local storage on a Shopping Cart: