简体   繁体   English

"如何使用xampp将sql server与php连接起来?"

[英]How to connect sql server with php using xampp?

I am trying to connect my SQL server with PHP using Xampp.我正在尝试使用 Xampp 将我的 SQL 服务器与 PHP 连接起来。 I have already uploaded dll files in the ext folder but I am unable to connect it.我已经在 ext 文件夹中上传了 dll 文件,但我无法连接它。 My PHP version is 7.2.6.我的 PHP 版本是 7.2.6。 Uploaded dll files are - php_pdo_sqlsrv_72_ts.dll, php_sqlsrv_72_ts.dll.上传的 dll 文件是 - php_pdo_sqlsrv_72_ts.dll、php_sqlsrv_72_ts.dll。 I have written this code to connect my SQL database with PHP-我已经编写了这段代码来连接我的 SQL 数据库和 PHP-

 <?php $serverName = "INDO-SERV\\SQLEXPRESS,1443"; $uid = "sa"; $pwd = "XXXXXX"; $databaseName = "web"; $connectionInfo = array("UID" => $uid, "PWD" => $pwd, "Database"=>$databaseName); $conn = sqlsrv_connect( $serverName, $connectionInfo); if( $conn ) { echo "Connection established.\\n"; } else { echo "Connection could not be established.\\n"; die( print_r( sqlsrv_errors(), true)); } sqlsrv_close( $conn); ?><\/code><\/pre>

I am getting this error when I had tried this-当我尝试这个时,我收到了这个错误 -

Fatal error: Uncaught Error: Call to undefined function sqlsrv_connect() in C:\\xampp\\htdocs\\biometric\\db.php:7 Stack trace: #0 {main} thrown in C:\\xampp\\htdocs\\biometric\\db.php on line 7.致命错误:未捕获的错误:调用 C:\\xampp\\htdocs\\biometric\\db.php:7 中未定义的函数 sqlsrv_connect() 堆栈跟踪:#0 {main} 在 C:\\xampp\\htdocs\\biometric\\db.php 中抛出在第 7 行。

<\/blockquote>

Anyone has an idea where I am doing wrong or how to connect with the database.任何人都知道我在哪里做错了或如何连接数据库。

"

I am trying to connect my SQL server with PHP using Xampp.我正在尝试使用Xampp将SQL Server与PHP连接起来。 I have already uploaded dll files in the ext folder but I am unable to connect it.我已经在ext文件夹中上传了dll文件,但无法连接它。 My PHP version is 7.2.6.我的PHP版本是7.2.6。 Uploaded dll files are - php_pdo_sqlsrv_72_ts.dll, php_sqlsrv_72_ts.dll.上载的dll文件为-php_pdo_sqlsrv_72_ts.dll,php_sqlsrv_72_ts.dll。 I have written this code to connect my SQL database with PHP-我已经编写了这段代码以将我的SQL数据库与PHP-

 <?php $serverName = "INDO-SERV\\SQLEXPRESS,1443"; $uid = "sa"; $pwd = "XXXXXX"; $databaseName = "web"; $connectionInfo = array("UID" => $uid, "PWD" => $pwd, "Database"=>$databaseName); $conn = sqlsrv_connect( $serverName, $connectionInfo); if( $conn ) { echo "Connection established.\\n"; } else { echo "Connection could not be established.\\n"; die( print_r( sqlsrv_errors(), true)); } sqlsrv_close( $conn); ?>

I am getting this error when I had tried this-我尝试过这个时遇到了这个错误-

Fatal error: Uncaught Error: Call to undefined function sqlsrv_connect() in C:\\xampp\\htdocs\\biometric\\db.php:7 Stack trace: #0 {main} thrown in C:\\xampp\\htdocs\\biometric\\db.php on line 7.致命错误:未捕获错误:调用C:\\ xampp \\ htdocs \\ biometric \\ db.php:7中未定义的函数sqlsrv_connect():堆栈跟踪:#0 {main}引发C:\\ xampp \\ htdocs \\ biometric \\ db.php在第7行。

Anyone has an idea where I am doing wrong or how to connect with the database.任何人都知道我做错了什么或如何连接数据库。

I am trying to connect my SQL server with PHP using Xampp.我正在尝试使用Xampp将SQL Server与PHP连接起来。 I have already uploaded dll files in the ext folder but I am unable to connect it.我已经在ext文件夹中上传了dll文件,但无法连接它。 My PHP version is 7.2.6.我的PHP版本是7.2.6。 Uploaded dll files are - php_pdo_sqlsrv_72_ts.dll, php_sqlsrv_72_ts.dll.上载的dll文件为-php_pdo_sqlsrv_72_ts.dll,php_sqlsrv_72_ts.dll。 I have written this code to connect my SQL database with PHP-我已经编写了这段代码以将我的SQL数据库与PHP-

 <?php $serverName = "INDO-SERV\\SQLEXPRESS,1443"; $uid = "sa"; $pwd = "XXXXXX"; $databaseName = "web"; $connectionInfo = array("UID" => $uid, "PWD" => $pwd, "Database"=>$databaseName); $conn = sqlsrv_connect( $serverName, $connectionInfo); if( $conn ) { echo "Connection established.\\n"; } else { echo "Connection could not be established.\\n"; die( print_r( sqlsrv_errors(), true)); } sqlsrv_close( $conn); ?>

I am getting this error when I had tried this-我尝试过这个时遇到了这个错误-

Fatal error: Uncaught Error: Call to undefined function sqlsrv_connect() in C:\\xampp\\htdocs\\biometric\\db.php:7 Stack trace: #0 {main} thrown in C:\\xampp\\htdocs\\biometric\\db.php on line 7.致命错误:未捕获错误:调用C:\\ xampp \\ htdocs \\ biometric \\ db.php:7中未定义的函数sqlsrv_connect():堆栈跟踪:#0 {main}引发C:\\ xampp \\ htdocs \\ biometric \\ db.php在第7行。

Anyone has an idea where I am doing wrong or how to connect with the database.任何人都知道我做错了什么或如何连接数据库。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM