Have you ever experiencing this problem like this? after your install wordpress, setup anything, webserver, database, everything is completed. Yet, wordpress still cannot establishing your database connection.
Eventhough you’ve already make sure that your database is up and running (I’m using MySQL) and your port is already open, though.
Trust me! I’ve done anything properly, I spent hours just to figure out what the root cause was and after some googling and stackoverflowing, I found this problem was due to SE in linux.
$ sudo setsebool -P httpd_can_network_connect_db=1
Thanks in advance SElinux!