vagzaf Posted August 12, 2021 Share Posted August 12, 2021 Hello all, I am using php 8.0.8 and when i use the sqlsrv_connect( $serverName, $connectionInfo ) function i get "undefined function". I use as an editor the Visual Studio Code. I have modified the php.ini with extension= D:\PROGRAMS\XAMPP\htdocs\php_sqlsrv_80_ts_x64.dll ( i thing this is the mssql server driver) Any help? Quote Link to comment https://forums.phpfreaks.com/topic/313539-mssql-connection/ Share on other sites More sharing options...
kicken Posted August 12, 2021 Share Posted August 12, 2021 Do you get the error actually running the script, or just as a warning in your IDE? Your php_sqlsrv_80_ts_x64.dll probably shouldn't be in your htdocs folder. I'm not familiar with XAMPP's layout but look for the folder where PHP is and an ext subfolder and put it there. Quote Link to comment https://forums.phpfreaks.com/topic/313539-mssql-connection/#findComment-1589067 Share on other sites More sharing options...
vagzaf Posted August 12, 2021 Author Share Posted August 12, 2021 Thank you for your responce It is not a warning, but error in my script. The php_sqlsrv_80_ts_x64.dll is in htdocs folder. I copied the dlls to the ext subfolder but it did not work. Quote Link to comment https://forums.phpfreaks.com/topic/313539-mssql-connection/#findComment-1589068 Share on other sites More sharing options...
Barand Posted August 12, 2021 Share Posted August 12, 2021 phpinfo() will tell you which folder is defined (in php.ini file) as your extensions folder. You will find it in the "Core" section of the output. That is where your extension files need to be. Quote Link to comment https://forums.phpfreaks.com/topic/313539-mssql-connection/#findComment-1589069 Share on other sites More sharing options...
vagzaf Posted August 14, 2021 Author Share Posted August 14, 2021 I have a general question regarding this function and regarding php general If i understand well, sqlsrv_connect() is a php function? The dll is the driver that perform a connection to an SQL server, when the specific function is called. Why when i type this function in a php editor, the php doesn't recognize it as a function? Logically php must understand this function and when i run the script, if the driver is not installed and is not placed in the correct folder, in runtime to get an error. Thank you Quote Link to comment https://forums.phpfreaks.com/topic/313539-mssql-connection/#findComment-1589111 Share on other sites More sharing options...
vagzaf Posted August 14, 2021 Author Share Posted August 14, 2021 Barand the dlls are in the correct dir Quote Link to comment https://forums.phpfreaks.com/topic/313539-mssql-connection/#findComment-1589112 Share on other sites More sharing options...
kicken Posted August 14, 2021 Share Posted August 14, 2021 The driver provides that function. If the driver is not installed and working, then that function does not exist and you'd get a undefined function error when trying to run code that uses it. Even if the driver is installed and working, it's possible your editor may not recognize it. I'm not familiar with Visual Studio Code but it may not know that you've installed that driver and as such doesn't recognize the function. That's why I asked if you were getting the error when actually running your code or just in your IDE. If the error is only in your IDE, but the code works when you actually run it then you'll have to figure out why the IDE is having an issue (or just learn to ignore it). Quote Link to comment https://forums.phpfreaks.com/topic/313539-mssql-connection/#findComment-1589114 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.