Bootstrap FreeKB - PHP - Change the name of a PHP session cookie
PHP - Change the name of a PHP session cookie

Updated:   |  PHP articles

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

 

The ps command can be used to determine if your system is using init or systemd. If PID 1 is init, then you will use the service command. If PID 1 is systemd, then you will use the systemctl command.

If your system is using systemd, use the systemctl command to start and enable httpd.

systemctl enable httpd
systemctl start httpd
systemctl status httpd

 

If your system is using init, use the chkconfig and service commands to start and enable httpd.

chkconfig httpd on
service httpd start
service httpd status

 

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




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


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