Home  >  Article  >  Backend Development  >  What to do if $_SESSION cannot get the value in php

What to do if $_SESSION cannot get the value in php

王林
王林Original
2020-11-06 10:49:152357browse

Solution to the problem that $_SESSION cannot get the value in php: 1. Create the sessionDIR directory; 2. Change the directory permissions; 3. Open the php.ini configuration file and modify the configuration [session.use_cookies = 1]; 4. , restart apache.

What to do if $_SESSION cannot get the value in php

Check the log error as follows:

[29-Apr-2013 16:32:14 PRC] PHP Warning:  session_start(): open(/tmp/sess_rkgh39rvdrqg5eij442u3mpvb5, O_RDWR) failed: Permission denied (13) in /var/www/html/marvin_au/module/userValidator.php on line 5

(Learning video recommendation: java course)

Cause analysis:

All files under /tmp have been deleted before, resulting in the inability to obtain the SESSION value and the system being unable to log in.

Solution:

mkdir /usr/local/php/sessionDIR 
chmod 777 /usr/local/php/sessionDIR 
vim /usr/local/php/etc/php.ini 
session.save_path = "/usr/local/php/sessionDIR" 
session.use_cookies = 1 
session.use_trans_sid = 1

Finally just restart apache.

Related recommendations: php training

The above is the detailed content of What to do if $_SESSION cannot get the value in php. 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