0

I need help with SELinux, it will not allow database connections despite being enabled.

I know that SELinux is the issue as turning it off eliminates the connection error I receive: mysqli::real_connect(): (HY000/2002): Permission denied. I also realize the security issues of turning it off.

I have searched as many solutions as possible. They all seem to give the same solution as this thread: How do I allow MySQL connections through SELinux?

Running the commands in this thread I get the following output sestatus:

  • SELinux status: enabled
  • SELinuxfs mount: /sys/fs/selinux
  • SELinux root directory: /etc/selinux
  • Loaded policy name: targeted
  • Current mode: enforcing
  • Mode from config file: enforcing
  • Policy MLS status: enabled
  • Policy deny_unknown status: allowed
  • Memory protection checking: actual (secure)
  • Max kernel policy version: 33

getsebool -a | grep httpd:

  • httpd_can_network_connect --> on
  • httpd_can_network_connect_cobbler --> off
  • httpd_can_network_connect_db --> on

My System Setup is as follows:

  • CentOS 9 Stream x64
  • Apache 2.4.57
  • MariaDB 10.11.8
  • PHP 8.1.29 (php-fpm)

What am I missing here?

0 Answers0