PDO DBLIB accessing SQL Server 2008 and 2012

后端 未结 1 1724
日久生厌
日久生厌 2021-01-23 16:33

After a lot of reading and searching I was able to get PDO DBLIB working in Centos 6.4 32bits (there is a lot of documentation for 64 bits and not for 32 bits). To my surprise t

1条回答
  •  悲哀的现实
    2021-01-23 17:26

    In my case SELinux (I am using CentOS) was blocking the connection when done from Apache web server in the linux box to the sql server in the windows box. To allow the connection you have two options:

    1. Disable SELinux

    2. As root or sudo run the two commands:

    setsebool -P httpd_can_network_connect 1

    setsebool -P httpd_can_network_connect_db 1

    To check if SELinux is blocking your network and DB connections run this command:

    getsebool -a | grep httpd_can_network_connect

    If the results are:

    httpd_can_network_connect --> on

    httpd_can_network_connect_db --> on

    You are good, if the are off then run the first commands in this answer.

    0 讨论(0)
提交回复
热议问题