php 致命错误:调用 xampp 中未定义的函数 mssql_connect() 或 sqlsrv_connect()

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/36543053/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 00:50:44  来源:igfitidea点击:

Fatal error: Call to undefined function mssql_connect() or sqlsrv_connect() in xampp

phpsql-serversqlsrv

提问by Hemant

I did all the changes given herebut I still not connect SQL server on my php 5.6 version.

我做了这里给出的所有更改但我仍然没有在我的 php 5.6 版本上连接 SQL 服务器。

I tried with mssql_connect()and sqlsrv_connect()both.

我试过mssql_connect()sqlsrv_connect()两者。

I changed

我变了

; On windows: extension_dir = "ext"

; On windows: extension_dir = "ext"

to:

到:

; On windows: extension_dir = "D:\xampp\php\ext"

; On windows: extension_dir = "D:\xampp\php\ext"

I have installed .dlls too. But result is still:

我也安装了.dlls。但结果仍然是:

Fatal error: Call to undefined function sqlsrv_connect()

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

or

或者

Fatal error: Call to undefined function mssql_connect()

致命错误:调用未定义的函数 mssql_connect()

can anyone help me??

谁能帮我??

回答by Tommy

mssql_connect() is no longer supported by PHP since PHP 7.0 and was depreciated in 5.3.

mssql_connect() 自 PHP 7.0 起不再受 PHP 支持,并在 5.3 中折旧。

Create a phpinfo.php file:

创建一个 phpinfo.php 文件:

<?php

// Show all information, defaults to INFO_ALL
phpinfo();

?>

Open the page, and on the first page that's opened, third from the bottom, check if the registered streams contains 'sqlsrv':

打开页面,在打开的第一页,倒数第三个,检查注册的流是否包含“sqlsrv”:

Registered PHP Streams  php, file, glob, data, http, ftp, zip, compress.zlib, phar, sqlsrv

If it doesn't then you have to enable the module. Try uncomment this code that you changed: From:

如果没有,那么您必须启用该模块。尝试取消注释您更改的此代码:来自:

; On windows: extension_dir = "D:\xampp\php\ext" "

To:

到:

On windows: extension_dir = "D:\xampp\php\ext"

And let us know the outcome.

并让我们知道结果。