상세 컨텐츠

본문 제목

[php] PHP Warning: mysqli_connect(): (HY000/2002): Permission denied

php

by 2hansoul 2022. 4. 27. 22:12

본문

반응형

레드햇 기반에 리눅스를 사용하게 되면 selinux 때문에 연결이 안 될 때가 있어서

권한이 없다고 나오는 것 같음 

 

1.일시적인 방법

setenforce 0

 

2.파일 수정 하기

vi /etc/selinux/config 

 

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

 

저 부분을 disabled 로 수정을 해준다 

반응형

관련글 더보기

댓글 영역