Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

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

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

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

I changed

; On windows: extension_dir = "ext"

to:

; On windows: extension_dir = "D:xamppphpext"

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

Fatal error: Call to undefined function sqlsrv_connect()

or

Fatal error: Call to undefined function mssql_connect()

can anyone help me??

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

Create a phpinfo.php file:

<?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':

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:xamppphpext" "

To:

On windows: extension_dir = "D:xamppphpext"

And let us know the outcome.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...