Home  >  Article  >  Backend Development  >  How to solve the problem that php cannot get the session

How to solve the problem that php cannot get the session

王林
王林Original
2020-11-10 10:05:482030browse

Methods to solve the problem that PHP cannot get the session: 1. Open the php.ini file and check the storage type of the session; 2. Check whether the /var/temp directory has read and write permissions; 3. Check the php- fpm configuration file; 4. Restart php-fpm.

How to solve the problem that php cannot get the session

Solution ideas:

(Learning video recommendation: java video tutorial)

1. Check php.ini

vim /etc/php.ini

Check these items:

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

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

chmod 777 -R /var/tmp

3.Check php -fpm configuration file

vim /etc/php-fpm.d/www.conf

Check these items:

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

Change to the same path as php.ini

4. Restart php-fpm

/bin/systemctl restart php-fpm.service

Related recommendations: php training

The above is the detailed content of How to solve the problem that php cannot get the session. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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
Previous article:How to delete php on macNext article:How to delete php on mac