/
php 가 session 디렉터리에 쓰지 못할 때
php 가 session 디렉터리에 쓰지 못할 때
증상
다음과 같이 PHP가 세션을 쓰지 못한다는 에러가 발생.
"PHP message: PHP Warning: session_start(): open(/var/lib/php/session/, O_RDWR) failed: Permission denied (13) in /var/www/myapp/common.php on line 2" while reading response header from upstream, client: 192.168.1.1, server: example.com, request: "GET / HTTP/1.0", upstream: "fastcgi://127.0.0.1:9000", host: "example.com"
원인1
RHEL/CentOS 7 부터는 httpd_sys_rw_content_t 가 있어야 SELinux 가 접근을 허용하지만 PHP 의 파일 세션 디렉터리(/var/lib/php/session/) 에 해당 context 를 부여하지 않음.
$ ls -lZ /var/lib/php/session/ -rw-------. apache apache system_u:object_r:httpd_var_run_t:s0
해결
selinux context 수정
chcon -R -t httpd_sys_rw_content_t /var/lib/php/session
원인2
nginx 를 사용할 경우 session 디렉터리 소유자가 apache 라 쓰지 못함
해결
chown -R nginx:nginx /var/lib/php/session
같이 보기
, multiple selections available,
Related content
wordpress 설치시 'Error establishing a database connection' 에러 처리
wordpress 설치시 'Error establishing a database connection' 에러 처리
More like this
travis ci 에서 phpunit 에러날 때
travis ci 에서 phpunit 에러날 때
More like this
MySQL client 에 port 를 지정해도 자꾸 소켓으로 연결할 경우
MySQL client 에 port 를 지정해도 자꾸 소켓으로 연결할 경우
More like this
nginx php 연동
nginx php 연동
More like this
tomcat 세션 클러스터링 설정
tomcat 세션 클러스터링 설정
More like this
cURL error 77: error setting certificate verify locations 에러 해결책
cURL error 77: error setting certificate verify locations 에러 해결책
More like this