Home > Article > Backend Development > Web server Unable to create session when error occurs, please check PHP or web server logs and configure PHP correctly Install win+linux
Solution under windows:
By looking for the path of session.save_path = "" in php.ini, check whether this directory exists or whether this directory has write permissions for everyone or Authenticated Users. Generally it's fine
Solution under Linux:
I updated PHP today, and when I logged in to the configured phpmyadmin, it showed "Unable to create a session when an error occurred. Please check the PHP or website server logs and configure the PHP installation correctly." mistake.
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 the executed 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
Afraid that 777 has too much permissions, test 770, 766, and 776 Unable to solve the above problem, I had to give 777 permission first.
I don’t know if there will be any safety hazards when trying to use it, so please note this position first.
The above introduces that the website server cannot create a session when an error occurs. Please check PHP or website server logs and configure PHP correctly. Install win+linux, including website server content. I hope it will be helpful to friends who are interested in PHP tutorials. .