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:
-
The output of phpinfo() for php8.1:
Here are the things:
- PHP 7.4 and 8.1 installed on my machine.
- The sqlsrv drivers works fine for php7.4 version
- When trying to install/enable for php8.1 it does not work at all.
What I am missing here?
CodePudding user response:
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