How to change the name of a PHP session cookie

Home > Search > How-to
  by

The session.name option in the /etc/php.ini file will contain the name of the session cookie. By default, the name of the session code is PHPSESSID. 

session.name = PHPSESSID

 

You can change this to some other name, such as SessionCookie. The name should not contain any spaces or special characters.

session.name = SessionCookie

 

Restart HTTPD, and ensure HTTPD is active and running.

[root@server1 ~]# systemctl restart httpd

 

The cookie in the browser should now show the updated name.



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter in the box below so that we can be sure you are a human.




Comments