PDO connection works from command line, but not through Apache?

前端 未结 4 1179
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-16 17:40

I have a very simple test script:



        
4条回答
  •  隐瞒了意图╮
    2020-12-16 18:18

    If this is a Red Hat-derived distribution (RHEL, CentOS, Fedora, ScientificLinux) running SELinux (or any non Red Hat derivative using SELinux), the default policy setting at time of this writing is to prohibit Apache from making external connections to other servers or databases. As root, you must enable the following two SELinux booleans. Use the -P option to persist the change across a reboot.

    setsebool -P httpd_can_network_connect=1
    setsebool -P httpd_can_network_connect_db=1
    

    Note that httpd_can_network_connect may not be necessary. Try it first turning on only httpd_can_network_connect_db.

提交回复
热议问题