PHP错误open(/var/lib/php/session/sess_x, O_RDWR) failed: Permission denied (13)解决

  • 发表于
  • PHP

突然所有校验token都用不了了,提示token过期或无效,找到log看到如下错误:

[ 2019-11-14T22:21:34+08:00 ] xx.xx.xx.xx GET 123.207.97.55:8081/index
[ error ] [2]session_start(): open(/var/lib/php/session/sess_58947000e94f430db83ada513ad7c104, O_RDWR) failed: Permission denied (13)
[ error ] [2]session_start(): Failed to read session data: files (path: /var/lib/php/session)

上面已经提示了,权限错误,我们给它个权限就行:

sudo chmod 1733 /var/lib/php/session

再刷新,问题解决!