Sqlserver-2012-centos using PHP's PDO to access SQL Server failed

Source: Internet
Author: User
Because the company needs to, so need to access SQL Server 2012 in the Linux environment, my local debug system is the CentOS
The PHP environment has been set up and the PDO extension, ODBC extension
Unixodbc and FreeTDS are also installed.
Now the problem is that I pass MSSQL Connect and ODBCConnect two is normally accessible to SQL Server 2012 and is able to take out the appropriate data
But when I tried to use the ODBC under the PDO to read it, there was a problem and it never succeeded.
The error message is as follows:

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[08S01] SQLDriverConnect: 20009 [unixODBC][FreeTDS][SQL Server]Unable to connect: Adaptive Server is unavailable or does not exist'

Find a degree Niang and Google asked for a long time, has been unable to solve this problem, ask who know the reason?

Reply content:

Because the company needs to, so need to access SQL Server 2012 in the Linux environment, my local debug system is the CentOS
The PHP environment has been set up and the PDO extension, ODBC extension
Unixodbc and FreeTDS are also installed.
The problem now is that I have access to SQL Server 2012 through the MSSQLConnect and ODBCconnect two ways, and I am able to retrieve the corresponding data
But when I tried to use the ODBC under the PDO to read it, there was a problem and it never succeeded.
The error message is as follows:

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[08S01] SQLDriverConnect: 20009 [unixODBC][FreeTDS][SQL Server]Unable to connect: Adaptive Server is unavailable or does not exist'

Find a degree Niang and Google asked for a long time, has been unable to solve this problem, ask who know the reason?

Are you sure that your PHP installation directory ext extension directory has a. dll file for SQL Server that is a. dll suffix on windows

LZ solved it? Welcome to share a solution!

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.