How to connect with PHP and ezSQL in a MSSQL Server?

Posted on 2011-10-05
Last Modified: 2012-06-27

I have a .php file running in Apache on Linux... ok

Using ezSQL i need to connect in another server, a MSSQL Server running on Windows...

but i got the following error...

"Fatal Error: ezSQL_mssql requires ntwdblib.dll to be present in your winowds\system32 folder. Also enable MS-SQL extenstion in PHP.ini file"

Ok, what is the problem, local? (in my client machine) or server (apache on linux)?

How can i do that? any idea?


require "/var/lib/ezsql/mssql.php";

$reg = $db->get_results("SELECT * FROM table");
echo print_r($reg);

Open in new window

Question by:cebasso
    LVL 51

    Accepted Solution

    LVL 82

    Assisted Solution

    by:Dave Baldwin
    If you are trying to connect to SQL Server 2005 or 2008 from Linux, the only known methods at the moment are some ODBC connectors but they are not free.  UnixODBC and FreeTDS might work for SQL Server 2000 but Microsoft changed the connection methods for 2005/2008.

    'ntwdblib.dll' can be downloaded from several places and will help with 'mssql' on PHP 5.2 or less.  PHP 5.3 does not support that driver at all.  If you are on Windows, you can use the new Microsoft PHP SQL driver.  Make sure you also get the SQL Native Client.  This page has a lot of info:


    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Suggested Solutions

    This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
    JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
    Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
    Via a live example, show how to setup several different housekeeping processes for a SQL Server.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now