I configured EC2 instance with following environment
Centos 7.4 , PHP 5.4 , HTTPD 2.4
From this EC2 instance when I heat external DB connection request through web page it turns out to be connection timeout , while If I run same PHP script through CLI it works fine any connects with database. Also I did telnet on remote DB server on port 3306 it gots connected.
I have tried by disabling selinux "setenforce 0" and allowed apache to make remote connections
setenforce 0
setsebool -P httpd_can_network_connect 1
setsebool -P httpd_can_network_connect_db 1
But nothing worked.