• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1714
  • Last Modified:

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


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

2 Solutions
HainKurtSr. System AnalystCommented:
Dave BaldwinFixer of ProblemsCommented:
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: http://php.net/manual/en/function.mssql-connect.php


Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now