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

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

王林
Release: 2023-03-07 12:36:02
Original
2442 people have browsed it

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
Copy after login

(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
Copy after login

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!

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