If you have trouble apache or PHP-FPM can not connect to remote MySQSL server, example error on PDO connection on remote server like below
SQLSTATE[HY000] [2002] Permission denied
First you need to check is SELinux enabled with this command:
[root@serverdiary ~]# sestatus
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: permissive
Mode from config file: disabled
Policy MLS status: enabled
Policy deny_unknown status: allowed
Max kernel policy version: 31
Or you can see on /etc/selinux/config
SELINUX=enforcing
There are 3 options for SELinux:
You can change to permissive, so SELinux only prints warnings instead of enforcing.
[root@serverdiary ~]# setenforce 0
[root@serverdiary ~]# sestatus
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: permissive
Mode from config file: disabled
Policy MLS status: enabled
Policy deny_unknown status: allowed
Max kernel policy version: 31
Or, if you still want to use option on SElinux config, apply this command as root and restart apache or php-fpm.
setsebool -P httpd_can_network_connect 1
setsebool -P httpd_can_network_connect_db 1
P option means permanent, so after reboot, this option still applied.
If you found error thread.error: can't start new thread on yum update command on CentOS…
Cockpit is a web-based graphical interface for servers, intended for everyone, especially those who are:…
From cockpit-project.org, Cockpit is a web-based graphical interface for servers, intended for everyone, especially those…
We have been using Nginx with HTTP3 for more than 1 year on our production…
On CentOS 7, to sync date time we often use NTPD. But on CentOS 9,…
Remi repository is one of third-party repository that have latest update of PHP on Enterprise…
View Comments
Kesinlikle şifre talep etmiyor, bir uygulamaya giri yapmanızı istemiyoruz. Bu şekilde sizden şifre talep eden yerlerden alışveriş yapmamanzı tavsiye ediyoruz.