Make sure the two 64-bit thread-safe DLLs for PHP 8.1 (php_sqlsrv_81_ts_x64.dll and php_pdo_sqlsrv_81_ts_x64.dll) are in your ext directory, install Microsoft ODBC Driver 18 for SQL Server and the Visual C++ 2019-2022 runtime, append "extension=sqlsrv" and "extension=pdo_sqlsrv" to php.ini, restart Apache, and check with php -m or phpinfo() that both modules did load; if not, one of those three prereqs does not match your PHP build.