Unable to register with mysql if selinux is enforcing (symfony3)

Asked 1 years ago, Updated 1 years ago, 106 views

Thank you for your help.

I am practicing the code in a Symfony introduction, but if I set selinux to enforcing, I will not be able to register a record in mysql, so could you help me?

The error message is as follows:
An exception occurred driver: SQLSTATE [HY000] [2002] Permission denied

The environment is as follows:
CentOS 7php 7 MariaDB Symphony 3.04

By the way...
If selinux is set to Permissive, records can be registered.

In addition, records can be registered if previously created on the same server with reference to the introductory site.
This can be registered even if selinux is enforcing.

Based on the above, I think the selinux setting is wrong for what I'm practicing now, but I'm not sure.

An excerpt of the error part of the symfony is
CRITICAL-Uncaught PHP Exception Doctrine\DBAL\Exception\ConnectionException: "An exception occurred in driver: SQLSTATE [HY000][2002] Permission denied" at/home/www/classic-symfony/vendor/doctrine/dbal/lib/DoverLibrine/DriverLactM103

However, AbstractMySQLDriver.php is
system_u:object_r:httpd_sys_content_t:s0.

Thank you for your cooperation.

mysql symfony2 mariadb doctrine2 selinux

2022-09-30 21:15

1 Answers

Is there any difference between the server that works well with Enforcing and getsebool-a?
For example, how about giving permission with setsebool httpd_can_nnetwork_connect_dbon?

/var/log/audit/audit.log contains a violation of SELinux's policy ("avc:denied"), so you may find out what it is.


2022-09-30 21:15

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.