Home >Backend Development >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
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.