PHP unable to identify sqlsrv_connect() function while trying to connect SQL Server
Solution 1:
You have PHP Fatal error: Uncaught Error: Call to undefined function sqlsrv_connect()
because sqlsrv
module wasn't loaded. The module wasn't loaded because it is compiled with module API=20200930
while your PHP compiled with module API=20210902
as your error message clearly says. PHP expects modules to be compiled with the same API version as the PHP itself. You need to either get PHP the same version as the module was compiled for or get a module compiled for your PHP version.
Solution 2:
I think https://github.com/microsoft/msphpsql/releases/download/v5.10.0-beta2/Windows-8.1.zip is what you need.
try these in your php.ini
extension=php_pdo_sqlsrv_81_ts.dll
extension=php_sqlsrv_81_ts.dll