Home > Article > Backend Development > How to clear server session in php
php method to clear the server session: first clear the server session using [delete all files under /tmp]; then restart all background services; finally the user needs to log in again.
【Related learning recommendations: php graphic tutorial】
How to clear server session in php:
删除 /tmp 下的所有文件(默认php的session文件是在/tmp下存着,直接此目录即可,如果改过php session的目录那么进入对应目录删除)
An error will be reported when accessing the website after deletion! An error will be reported when accessing the website! An error will be reported when accessing the website!
Solution:
Restart all background services. For example:
mysql
#nginx
php-fpm
rm -rf /tmp/* service mysql restart service nginx restart service php-fpm restart
Related learning recommendations:php programming (video)
The above is the detailed content of How to clear server session in php. For more information, please follow other related articles on the PHP Chinese website!