Reposted fromHttp://www.michaeltozzo.com/blog/2010/02/19/mongodb-php-problem/
While at work I was looking into something that we cocould replace MySQL with since the two trends these days are to not do any joins between tables and to work with large datasets. I Came login ss a database called MongoDB which was apparently very good at both of these things and used guides on the Internet to get it going on a local Linux box.
I got to a point where it was almost working 100% but for some reason my simple test script couldn't connect when run by Apache but cocould when run via command line. I wocould get the error:
PHP fatal error: uncaught exception 'lost connectionexception' with message 'permission denied'
I scoured the Internet and found only a single reference to my problem but couldn't find a solution. after direct emails with Kristina chodorow the primary maintainer for the MongoDB Perl and PHP drivers I found that the solution to my problem was to run the command:
$/Usr/sbin/setsebool-P httpd_can_network_connect 1
Hopefully this helps someone else. Thanks again Kristina.