PDO-SQlSRV drivers is not found after update of php 7.4 to 8.1 on Azure App service

Mohammad Zaeri Amirani 31 Reputation points
2022-10-26T07:00:58.937+00:00

Hi,
After upgrading laravel app from 8 to 9, everything worked ok on local debian server, but when deployed on Azure, could see that there is no more connection to Azure db, and could see further that it is due to missing pdp sqlsrv drivers .They are not installed.
They were in version 8 and therefore everything was OK on Azure also until version 9. to upgrade to Laravel9, was need to change php 7.4 to 8.1 both on our local server and Azure App.

Output from php after update:
root@9dcf7762daa9:/home# php -i | grep sqlsrv
Cannot load Zend OPcache - it was already loaded
root@9dcf7762daa9:/home# odbcinst -j
unixODBC 2.3.7
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
FILE DATA SOURCES..: /etc/ODBCDataSources
USER DATA SOURCES..: /root/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8
root@9dcf7762daa9:/home# php -v
Cannot load Zend OPcache - it was already loaded
PHP 8.1.6 (cli) (built: Aug 17 2022 07:43:32) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.6, Copyright (c) Zend Technologies
with Zend OPcache v8.1.6, Copyright (c), by Zend Technologies
root@9dcf7762daa9:/home#

many thanks in advance

Azure SQL Database
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,010 questions
{count} votes

Accepted answer
  1. VenkateshDodda-MSFT 18,956 Reputation points Microsoft Employee
    2022-10-26T07:55:01.353+00:00

    @Mohammad Zaeri Amirani Thank you for reaching out Apologize for the inconvenience caused on this.

    i have deployed web app with php8.1 running on linux operating system. You can run the below cmdlet in the SSH console to check the list of extensions installed by default.

     php -m | grep pdo   
    

    Post running the above cmdlet we have observed that pdo_sqlsrv extension is missing and I have shared this feedback to the internal team as well, will post back as soon as I hear from them.

    Follow below steps to manually install the pdo_sqlsrv extension in your web app

    1. Add a bin directory to the root directory of your app and put the .so extension files in it
    2. Download the Debian11-8.1.tar file from here extract the .tar file and copy the .so file to the bin folder.
    3. Create a directory in /home/site called ini, then create an .ini file in the /home/site/ini directory (for example, settings.ini) with the directives you want to customize. and add the below line of code into that .ini file. extension=<path_of_the_.sofile>/php_pdo_sqlsrv_81_nts.so
    4. Add the application settings PHP_INI_SCAN_DIR under configuration tab from the portal PHP_INI_SCAN_DIR="/usr/local/etc/php/conf.d:/home/site/ini"
    5. Once the above steps were completed, Stop and start the web app.

    You can follow these documentation steps to enable php extension in your linux webapps.

    Feel free to reach back to me if you have any further queries on this.


0 additional answers

Sort by: Most helpful