Question:
I'm making a connection in windowns via php to SQL SERVER and it's going normal, on a machine where the php server is linux is giving the following error:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[01000] SQLDriverConnect: 0 [unixODBC][Driver Manager]Can't open lib 'SQL Server' : file not found' in /var/www/html/sql/index.php:8 Stack trace: #0 /var/www/html/sql/index.php(8): PDO->__construct('odbc:Driver={SQ...') #1 {main} thrown in /var/www/html/sql/index.php on line 8
How do I enable the odbc
driver on linux?
LINUX:
PRETTY_NAME="Debian GNU/Linux 8 (jessie)"
NAME="Debian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=debian
HOME_URL="http://www.debian.org/"
SUPPORT_URL="http://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
APACHE:
Server version: Apache/2.4.10 (Debian)
Server built: Nov 28 2015 14:05:48
SQL:
Microsoft SQL Server Standard Edition (64-bit)
Microsoft Windows NT 6.1 (7601)
NT x64
10.0.2531.0
PHP:
PHP Version 5.6.22-0+deb8u1
Answer:
1) First, take a look at the nolibsqlncli-11.0.so.1790.0 permissions, to see if apache can write and read.
2) It is necessary to look at the lib dependencies and see if there are any missing.
ldd /opt/microsoft/sqlncli/lib64/libsqlncli-11.0.so.1790.0
3) If you are using CENTos try disabling SELinux.