php open(/var/lib/php/session/sess_4ofxxx, O_RDWR) failed: Permission denied (13)

Meet
session_start () :
open (/ var/opt/remi php72/lib/PHP/session/sess_4ofga8ehv8s2ct2b9dnn40qtp2, O_RDWR) failed: Permission denied (13)
Error message

session_start(): open(/var/opt/remi/php72/lib/php/session/sess_4ofga8ehv8s2ct2b9dnn40qtp2, O_RDWR) failed: Permission denied (13)

Solutions:

sudo chmod 1733 [报错的session的路径]

The solution for the above example is as follows

sudo chmod 1733 /var/opt/remi/php72/lib/php/session

Refer to the article

Read More: