Home > Backend Development > PHP Problem > What should I do if PHP cannot obtain SESSION information?

What should I do if PHP cannot obtain SESSION information?

coldplay.xixi
Release: 2023-03-04 08:26:01
Original
2983 people have browsed it

Solution to the problem that PHP cannot obtain SESSION information: first check [php.ini] and check whether [/var/tmp] has read and write permissions; then check the [php-fpm] configuration file; finally restart [php-fpm].

What should I do if PHP cannot obtain SESSION information?

Solution to PHP failing to obtain SESSION information:

1. Check php.ini

vim /etc/php.ini
Copy after login

Check these items:

session.save_handler = files // session 的存储类型;
 
session.auto_start = 1 //是否自启动
 
session.save_path = "/var/tmp" //存储位置
Copy after login

2. Check whether /var/tmp has read and write permissions, if not:

chmod 777 -R /var/tmp
Copy after login

3. Check the php-fpm configuration file

vim /etc/php-fpm.d/www.conf
Copy after login

Check these items:

php_value[session.save_handler] = files
 
php_value[session.save_path] = /var/tmp
 
php_value[soap.wsdl_cache_dir] = /var/tmp
Copy after login

Change to the same path as php.ini

4. Restart php-fpm

/bin/systemctl restart php-fpm.service
Copy after login

Related learning recommendations: php programming (video)

The above is the detailed content of What should I do if PHP cannot obtain SESSION information?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template