Home > Article > Backend Development > What to do if $_SESSION cannot get the value in php
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.
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!