简体   繁体   English

致命错误:使用 wamp php 5.5.12 调用未定义的函数 sqlsrv_connect()

[英]Fatal error: Call to undefined function sqlsrv_connect() using wamp php 5.5.12

I am trying to connect to a Azure data base.我正在尝试连接到 Azure 数据库。 I have read many other stack overflow answers but they did not work for me:我已经阅读了许多其他堆栈溢出答案,但它们对我不起作用:

-I have downloaded all the drivers that Azure offers to you. - 我已经下载了 Azure 提供给你的所有驱动程序。 They are in他们在

C:\\wamp\\bin\\php\\php5.5.12\\ext folder: C:\\wamp\\bin\\php\\php5.5.12\\ext 文件夹: 在此处输入图片说明

-I have added to the system variable the path to extensions folder. - 我已将扩展文件夹的路径添加到系统变量中。

-I have set the extension in both php.ini files (inside the apache and php folders). - 我已经在两个 php.ini 文件中设置了扩展名(在 apache 和 php 文件夹中)。

-Extensions have been set like - 扩展已设置为

extension=php_sqlsrv_5X_ts.dll扩展名=php_sqlsrv_5X_ts.dll
extension=php_pdo_sqlsrv_5X_ts.dll and like extension=C:/wamp/bin/php/php5.5.12/ext/php_sqlsrv_5X_ts.dll extension=C:/wamp/bin/php/php5.5.12/ext/php_pdo_5X_ts.dll extension=php_pdo_sqlsrv_5X_ts.dll 等 extension=C:/wamp/bin/php/php5.5.12/ext/php_sqlsrv_5X_ts.dll extension=C:/wamp/bin/php/php5.5.12/ext/php_pdo_5X_ts.dll

Where X means that I have tried 53, 54, 55 and 56.其中X表示我尝试了 53、54、55 和 56。

-I restart all wamp services every single time that I try new changes. - 每次尝试新更改时,我都会重新启动所有 wamp 服务。

-I have even tried with IISExpress. -我什至尝试过 IISExpress。

-It is still giving me this error and I can't see "sqlsvr" when I use phpinfo() . - 它仍然给我这个错误,当我使用phpinfo()时我看不到“sqlsvr”。

what more I should do?我还应该做什么? I have been suffering this for weeks.我已经受苦了好几个星期了。

I use this XAMPP with PHP 5.5.34 at https://www.apachefriends.org/download.html to have the test to enable the sqlsrv extension of PHP.我在https://www.apachefriends.org/download.html上将此 XAMPP 与 PHP 5.5.34 一起使用,以进行测试以启用 PHP 的sqlsrv扩展。

You can refer my steps:你可以参考我的步骤:

  1. After install the XAMPP application, run xampp-control.exe , click config => PHP(php.ini) to check the extension folder.安装 XAMPP 应用程序后,运行xampp-control.exe ,单击config => PHP(php.ini)检查扩展文件夹。 在此处输入图片说明
  2. Download the MSSQL driver for PHP in 3.2 version from https://msdn.microsoft.com/en-us/library/cc296170%28v=sql.105%29.aspx?f=255&MSPPError=-2147217396 .https://msdn.microsoft.com/en-us/library/cc296170%28v=sql.105%29.aspx?f=255&MSPPError=-2147217396下载 3.2 版 PHP 的 MSSQL 驱动程序。 Uncompress it.解压它。
  3. Copy php_pdo_sqlsrv_55_ts.dll and php_sqlsrv_55_ts.dll from the uncompressed driver folder to the PHP extension folder ( X:\\xampp\\php\\ext in my scenario).php_pdo_sqlsrv_55_ts.dllphp_sqlsrv_55_ts.dll从未压缩的驱动程序文件夹复制到 PHP 扩展文件夹(在我的场景中为X:\\xampp\\php\\ext )。
  4. Add extension=php_pdo_sqlsrv_55_ts.dll and extension=php_sqlsrv_55_ts.dll in PHP.ini file.PHP.ini文件中添加extension=php_pdo_sqlsrv_55_ts.dllextension=php_sqlsrv_55_ts.dll
  5. Start Apache.启动阿帕奇。

Meanwhile, you can use phpinfo() to check the setting of Loaded Configuration File and extension_dir to make sure whether you have configured the correct settings in the definite files and the DLL files in the right folder.同时,您可以使用phpinfo()检查Loaded Configuration Fileextension_dir的设置,以确保您在确定文件和正确文件夹中的 DLL 文件中配置了正确的设置。

I refer to the practice of Jordi's message in this post: Fatal error: Call to undefined function sqlsrv_connect() in C:\\xampp\\htdocs我参考了Jordi在这篇帖子里的做法: Fatal error: Call to undefined function sqlsrv_connect() in C:\\xampp\\htdocs

xampp3.2.1 + php 5.5 + sql server 2014 Express, x64. xampp3.2.1 + php 5.5 + sql server 2014 Express,x64。

My situation is, transplant xampp folder to a brand new computer.我的情况是,将xampp文件夹移植到一台全新的电脑上。

  1. Done all things need to do.需要做的事情都做完了。 (Download SQLSRV 5.6 (or 5.3 or..), check php.ini path, ...) (下载 SQLSRV 5.6(或 5.3 或..),检查 php.ini 路径,...)
  2. Download and install OBDC Driver 13 (x64) (or maybe you can try OBDC Driver 11 (x64))下载并安装OBDC 驱动程序 13 (x64)(或者您可以尝试OBDC 驱动程序 11 (x64))
  3. Download and install SQL Server® 2014 Service Pack 3 (x64), need to restart the computer.下载并安装SQL Server® 2014 Service Pack 3 (x64),需要重启电脑。
  4. Download and install Visual C++ Redistributable VS2012 Update4 ( x86 )下载并安装 Visual C++ Redistributable VS2012 Update4 ( x86 )
  5. Restart Apache重启阿帕奇

Then it can work!!!!!然后就可以工作了!!!!!

I have been searching for a solution to this problem for several days and hope to help more people.我这几天一直在寻找这个问题的解决方案,希望能帮助到更多的人。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 致命错误:调用C:\\ wamp \\ www \\ last \\ connect.php中未定义的函数sqlsrv_connect() - Fatal error: Call to undefined function sqlsrv_connect() in C:\wamp\www\last\connect.php PHP 5.6:致命错误:调用未定义函数sqlsrv_connect() - PHP 5.6 : Fatal error: Call to undefined function sqlsrv_connect() 致命错误:在PHP 5.6.25中调用未定义函数sqlsrv_connect() - Fatal error: Call to undefined function sqlsrv_connect() in php 5.6.25 php:致命错误:调用未定义的函数 sqlsrv_connect() - php :Fatal error: Call to undefined function sqlsrv_connect() 使用 WAMP 调用未定义的函数 sqlsrv_connect() - Call to undefined function sqlsrv_connect() with WAMP 致命错误:未捕获错误:调用未定义函数sqlsrv_connect() - Fatal error: Uncaught Error: Call to undefined function sqlsrv_connect() 致命错误:调用未定义函数sqlsrv_connect()High Sierra - Fatal error: Call to undefined function sqlsrv_connect() High Sierra 致命错误:调用未定义的 function sqlsrv_connect() - Fatal error: Call to undefined function sqlsrv_connect() 在第7行的C:\\ wamp \\ www \\ Webs \\ client.php中调用未定义的函数sqlsrv_connect() - Call to undefined function sqlsrv_connect() in C:\wamp\www\Webs\client.php on line 7 致命错误:在xampp中调用未定义的函数mssql_connect()或sqlsrv_connect() - Fatal error: Call to undefined function mssql_connect() or sqlsrv_connect() in xampp
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM