我最近搬到了一台新服务器,现在突然我的PHP会话变量没有存储.
我已经安装了Nginx和PHP-fpm,它们似乎都可以工作,因为我可以执行其他PHP操作.
我知道我的代码很好,因为它在我部署了它的过去5台服务器上运行良好.
由于某种原因,我无法存储会话变量.
PHPMyAdmin返回此
“ PHPMyAdmin-错误
无法正确启动会话,请检查PHP和/或Web服务器日志文件中给出的错误,并正确配置PHP安装.另外,请确保在浏览器中启用了Cookie.”
Here is my PHP error log which shows some errors in regards to the session storage.
[14-Jan-2016 06:41:47] PHP Warning: session_start(): open(/var/lib/PHP/session/sess_ocjdclils55719l5ri9ue5aqu3,O_RDWR) Failed: No such file or directory (2) in /usr/share/Nginx/athenalayer/control-panel/checklogin.PHP on line 3
[14-Jan-2016 06:41:47] PHP Warning: Unknown: open(/var/lib/PHP/session/sess_ocjdclils55719l5ri9ue5aqu3,O_RDWR) Failed: No such file or directory (2) in Unknown on line 0
[14-Jan-2016 06:41:47] PHP Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/PHP/session) in Unknown on line 0
[14-Jan-2016 06:41:50] PHP Warning: session_start(): open(/var/lib/PHP/session/sess_ocjdclils55719l5ri9ue5aqu3,O_RDWR) Failed: No such file or directory (2) in /usr/share/Nginx/athenalayer/control-panel/checklogin.PHP on line 3
[14-Jan-2016 06:41:51] PHP Warning: Unknown: open(/var/lib/PHP/session/sess_ocjdclils55719l5ri9ue5aqu3,O_RDWR) Failed: No such file or directory (2) in Unknown on line 0
[14-Jan-2016 06:41:51] PHP Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/PHP/session) in Unknown on line 0
[14-Jan-2016 06:42:44] PHP Warning: session_start(): open(/var/lib/PHP/session/sess_ocjdclils55719l5ri9ue5aqu3,O_RDWR) Failed: No such file or directory (2) in /usr/share/Nginx/athenalayer/control-panel/checklogin.PHP on line 3
[14-Jan-2016 06:42:44] PHP Warning: Unknown: open(/var/lib/PHP/session/sess_ocjdclils55719l5ri9ue5aqu3,O_RDWR) Failed: No such file or directory (2) in Unknown on line 0
[14-Jan-2016 06:42:44] PHP Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/PHP/session) in Unknown on line 0
[14-Jan-2016 06:49:16] PHP Warning: session_start(): open(/var/lib/PHP/session/sess_ocjdclils55719l5ri9ue5aqu3,O_RDWR) Failed: No such file or directory (2) in /usr/share/Nginx/athenalayer/test.PHP on line 2
[14-Jan-2016 06:49:16] PHP Warning: Unknown: open(/var/lib/PHP/session/sess_ocjdclils55719l5ri9ue5aqu3,O_RDWR) Failed: No such file or directory (2) in Unknown on line 0
[14-Jan-2016 06:49:16] PHP Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/PHP/session) in Unknown on line 0
[14-Jan-2016 06:49:18] PHP Warning: session_start(): open(/var/lib/PHP/session/sess_ocjdclils55719l5ri9ue5aqu3,O_RDWR) Failed: No such file or directory (2) in /usr/share/Nginx/athenalayer/test.PHP on line 2
[14-Jan-2016 06:49:18] PHP Warning: Unknown: open(/var/lib/PHP/session/sess_ocjdclils55719l5ri9ue5aqu3,O_RDWR) Failed: No such file or directory (2) in Unknown on line 0
[14-Jan-2016 06:49:18] PHP Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/PHP/session) in Unknown on line 0
[14-Jan-2016 06:49:23] PHP Warning: session_start(): open(/var/lib/PHP/session/sess_ocjdclils55719l5ri9ue5aqu3,O_RDWR) Failed: No such file or directory (2) in /usr/share/Nginx/athenalayer/control-panel/checklogin.PHP on line 3
[14-Jan-2016 06:49:23] PHP Warning: Unknown: open(/var/lib/PHP/session/sess_ocjdclils55719l5ri9ue5aqu3,O_RDWR) Failed: No such file or directory (2) in Unknown on line 0
[14-Jan-2016 06:49:23] PHP Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/PHP/session) in Unknown on line 0
[14-Jan-2016 06:49:27] PHP Warning: session_start(): open(/var/lib/PHP/session/sess_ocjdclils55719l5ri9ue5aqu3,O_RDWR) Failed: No such file or directory (2) in /usr/share/Nginx/athenalayer/control-panel/checklogin.PHP on line 3
[14-Jan-2016 06:49:28] PHP Warning: Unknown: open(/var/lib/PHP/session/sess_ocjdclils55719l5ri9ue5aqu3,O_RDWR) Failed: No such file or directory (2) in Unknown on line 0
我进行了一些研究,似乎可能是权限错误?关于此问题,没有太多文档或与此相关的任何文档.这似乎是一个非常独特的问题,特别是考虑到我已经完成了许多Web服务器配置,这是我第一次遇到这种情况.
我希望也许这里有更多专业知识的人能有所启发.
最佳答案
@H_404_27@您需要刷新浏览器缓存,删除服务器/主机的cookie,然后重试加载PHPMyAdmin.
如果要全力以赴,请同时清除服务器上的会话文件夹.
一个可能的原因是浏览器和Web服务器之间的会话数据不匹配,导致其无法提取所需的会话信息并将此错误对话框转储到您的膝盖上.
另一个问题可能是由于文件和文件夹权限所致.您可以尝试更改文件夹权限:
sudo chmod 777 /var/lib/PHP/session/