PDO Connection Error

PDO Connection Error: SQLSTATE[08006] [7] could not connect to server: Permission denied

Is the server running on host "127.0.0.1" and accepting

TCP/IP connections on port 5432?

SELinux may be preventing PDO from accessing your database. I found a quick solution from Linux permission denied on Apache while connecting to PostgreSQL

Run the following as root (or sudo) and you’re all done :)


setsebool -P httpd_can_network_connect 1