http://www.perlmonks.org?node_id=1078181


in reply to How to get over 'premature end of script headers' in Apache?

This works on CentOS:
chcon -R -t httpd_sys_content_t /usr/local/web/cgi-bin
It changes security context recursively on /usr/local/web/cgi-bin/.