Fatal error: Call to undefined function sqlsrv_connect() in C:\\xampp\\htdocs

旧巷老猫 提交于 2019-11-27 21:27:18
Leandro Papasidero

The MSSQL extension is not available anymore on Windows with PHP 5.3 or later. SQLSRV, an alternative driver for MS SQL is available from Microsoft: » http://www.microsoft.com/en-us/download/details.aspx?id=20098

Step by Step

  1. Download SQLSRV32.EXE (Microsoft Drivers for PHP for SQL Server) from: http://www.microsoft.com/en-us/download/details.aspx?id=20098

  2. Choose path: C:\xampp\php\ext

  1. Uncomment or Append extension = php_sqlsrv_56_ts.dll in php.ini

  2. Restart Apache from XAMPP Control Panel (Stop/Start)

I tested it and it works 100%

You can find the most recent compiled binaries in the official Microsoft Git repository.

I followed Lea Tano guide and didn't work. I needed a fer more steps. At least for Windows7 (or for my system) there're some missing steps(ie those who don't have MSSQL Server installed in the same server/machine).

Here's how i made it work:

  1. Follow Lea Tano guide to install SQLSRV 5.6 (or 5.3 or..)
  2. Download and install the OBDC Driver 11 (msodbcsql.msi)
  3. Download and install the SQL Server Native Client (sqlncli.msi file)
  4. Check if installed (if not, download and install) Visual C++ Redistributable VS2012 Update4 (vcredist_x86.exe)

Lea's answer should do the trick for you. It is very important that you download PHP 5.6 from the Web PI - https://www.microsoft.com/web/downloads/platform.aspx

Use IE when you download the Web PI to your machine. Let me know if that does the trick for you, if not please have a look at the following blog. It is a getting started guide for Azure SQL DB + PHP + IIS.

http://blogs.msdn.com/b/sqlphp/archive/2015/05/11/getting-started-with-php-and-microsoft-sql-server.aspx

Best,
Meet Bhagdev
Program Manager, Microsoft

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!