简体   繁体   中英

Fatal error: Call to undefined function sqlsrv_connect() in php 5.6.25

OS : Windows 8.1

Web Server : WAMPSERVER 3.0.6

PHP Version : 5.6.25

Goal : To establish MYSQL Database connection using PHP

What has been done:

  • Downloaded SQLSRV Drivers ( SQLSRV32.EXE )
  • Copied files php_pdo_sqlsrv_56_ts.dll and php_sqlsrv_56_ts.dll to the directory "C:\\wamp64\\bin\\php\\php5.6.25\\ext"
  • extension_dir = "c:/wamp64/bin/php/php5.6.25/ext/"
  • Added the following lines to the dynamic extensions part in the php.ini file:

    • extension=php_pdo_sqlsrv_56_ts.dll
    • extension=php_sqlsrv_56_ts.dll
  • Restarted Web Server

But: phpinfo() is not listed in sqlsrv()

Code:

$myServer = "(local)";
$myUser = "sa";
$myPass = "pass";
$myDB = "example_db";
$connectionInfo = array("Database"=>$myDB, "UID" => $myUser, "PWD" => $myPass);
$conn = sqlsrv_connect($myServer, $connectionInfo);

Error:

Fatal error: Call to undefined function sqlsrv_connect() in
C:\wamp64\www\optimum_p\common\dbconnect.php on line 6 

As per OP's comment :

The problem was WAMP, to fix the problem:

  1. uninstall WAMP
  2. install XAMPP

Problem solved.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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