I am trying to enable sqlsrv drivers for php8.1 on Ubuntu 20.0. It is not showing the extension in phpinfo()
.
When trying to check the sqlsrv module with commmand php -m
, the output is like this:
I have followed official documentation below:
extension=pdo_sqlsrv.so
, extension=sqlsrv.so
) in /etc/php/8.1/apache2/php.iniI am not sure what went wrong, any suggestion is appreciated.
The output of phpinfo() for php7.4:
The output of phpinfo() for php8.1:
Here are the things:
What I am missing here?
You can try this:
1. switch to php8.1
2. sudo pecl uninstall -r sqlsrv
3. sudo pecl uninstall -r pdo_sqlsrv
4. sudo pecl -d php_suffix=7.2 install sqlsrv
5. sudo pecl -d php_suffix=7.2 install pdo_sqlsrv
6. sudo service apache2 restart
Note that -r, --register-only
do not remove files but only register the packages as not installed.
Checkout this resource for more info. https://github.com/microsoft/msphpsql/issues/1145#issuecomment-649682231