Home  >  Article  >  Backend Development  >  Unable to create session when error occurs, please check PHP or website server logs and configure PHP correctly Installation (win+linux)_PHP Tutorial

Unable to create session when error occurs, please check PHP or website server logs and configure PHP correctly Installation (win+linux)_PHP Tutorial

WBOY
WBOYOriginal
2016-07-21 15:19:29790browse

Solution under windows:

By looking for the path of session.save_path = "" in php.ini, check whether this directory exists or whether this directory is written by everyone or Authenticated Users permissions. Generally it's fine

Solution under Linux:

I updated PHP today, and when I logged in to the configured phpmyadmin, I got the message "Unable to create a session when an error occurred. Please check the PHP or web server logs and configure your PHP installation correctly." error.

Cause of error:

After php was updated, the original permissions of /var/lib/php/session were overwritten, causing the apache user to be unable to write to the session, resulting in this error.

Solution:
Execute: #chown -R root:username /var/lib/php/session

Where username is the hosting user of apache, mine is apache, so execute The command is:
#chown -R root:apache /var/lib/php/session

If the error message still appears at this time, it is recommended to execute:
#chmod -R 777 /var /lib/php/session

I am afraid that 777’s permissions are too large. Testing 770, 766, and 776 cannot solve the above problems, so I have to give 777 permissions first.
I don’t know if there will be any safety hazards when trying to use it, so please note this location first.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/325276.htmlTechArticleSolution under windows: Check whether it exists by looking for the path of session.save_path = "" in php.ini Does this directory or this directory have write permissions for everyone or Authenticated Users...
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