If you trust /usr/lib/php/modules/pgsql.so to run correctly, you can
change the file context to textrel_shlib_t. "chcon -t textrel_shlib_t
'/usr/lib/php/modules/pgsql.so'" You must also change the default file
context files on the system in order to preserve them even on a full
relabel. "semanage fcontext -a -t textrel_shlib_t
'/usr/lib/php/modules/pgsql.so'"
The following command will allow this access:chcon -t textrel_shlib_t
'/usr/lib/php/modules/pgsql.so'
If you want httpd to allow database connections you need to turn on
the httpd_can_network_connect_db boolean: "setsebool -P
httpd_can_network_connect_db=1"
The following command will allow this access:
setsebool -P httpd_can_network_connect_db=1

# "local" is for Unix domain socket connections only
local all all ident sameuser
# IPv4 local connections:
host all all 127.0.0.1/32 ident sameuser
# IPv6 local connections:
host all all ::1/128 ident sameuser

to this:

# "local" is for Unix domain socket connections only
#local all all ident sameuser
local all all trust
# IPv4 local connections:
#host all all 127.0.0.1/32 ident sameuser
host all all 127.0.0.1/32 trust
# IPv6 local connections:
#host all all ::1/128 ident sameuser
host all all ::1/128 trust