• SELinux, Apache/httpd, PHP establishing socket connections using fsockopen() et al
    10/25/2010 7:43PM

    So I was getting permission denied errors when attempting to establish an outgoing network connection to an smtp server from a PHP script running under the Apache webserver on a Fedora Core 13 box. 

    To get familiar with it, I've left SELinux enabled and, as they occur, I track down the issues it raises.

    One SELinux permission that I was unaware of was the "allow http daemon scripts to establish outgoing connections". By default this is set to false which causes the "permission denied" errors.

    To enable outgoing socket connections, the command is:

    setsebool -P httpd_can_network_connect 1

    run as root.