Error when connecting PHP to SQL Server via ODBC Linux

Asked

Viewed 301 times

3

I am making a connection in no windowns via php to SQL SERVER and it is going normal, in a machine where the php server is linux this 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 skilled the driver odbc 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
  • What versions of your environment? Go to [Edit] and include this information in the question

  • @gmsantos edited, see if it’s the information you need

  • version of PHP ?

  • @gmsantos Inserted in question.

1 answer

1


1) First, take a look at the permissions nolibsqlncli-11.0.so.1790.0, to see if apache can write and read.

2) It is necessary to see the lib dependencies and see if there are any missing ones.

ldd /opt/microsoft/sqlncli/lib64/libsqlncli-11.0.so.1790.0

3) If you are using Centos try to disable Selinux.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.