Thursday, May 22, 2014

Linux Redhat 5 and Lighttpd

While installing and configuring Lighttpd for Redhat. I came across a problem that took me hours to figure out. After a lot of research I found the answer.

Problem:
           While everything was setup correctly, I could serve php pages, I  could not connect to my database (Postgres). I checked everything I could to make it work. the error I was receiving was


Database error

Message: SQLSTATE[08006] [7] could not connect to server: Permission denied Is the server running on host "myserver" and accepting TCP/IP connections on port 9999?
to make matters a bit more difficult for me I had PGPOOL-II infront of the my db and had to troubleshoot both pg_hba.conf files from master db to PG_POOL which in my case were two different servers. After hours of trying to reconfigure my pg_hba.conf file I googled and came across this  post which saved my life.


Solution:
         If you try to install lighttpd make sure you give permissions to the process setsebool -P httpd_can_network_connect on otherwise you will wont be able to connect to postgres from php.

No comments:

Post a Comment