SQLSTATE[HY000] [2002] Permission denied
This is what came back each time I tried running the web application from my local httpd. I'm using PHP's PDO database interface, and its mysql driver, and it works when deployed on the remote server. I made sure that my remote server had permissions for my local user. I tested connecting from my local machine from the mysql client, and it worked. I tested the PHP connection statement from the command-line and ... it worked. It was only causing a problem when running within the web application.
Eventually, I found this explanation, which boils down to:
setsebool -P httpd_can_network_connect_db=1
Yes, SELinux on Fedora strikes again. I actually appreciate SELinux. The main problem with it is the often total lack of feedback. SELinux's troubleshooter is running and in theory it's suppose to report issues like this and give me options, but it didn't seem to notice at all. If things did not simply fail silently and mysteriously, I'm sure most complaints about SELinux would go away
Keine Kommentare:
Kommentar veröffentlichen