After PHP 8.1 upgrade, sqlsrv pdo driver cannot be found
P粉649990163
P粉649990163 2023-12-19 13:46:28
0
1
794

After upgrading to php 8.1 (Linux PHP), the Azure webapp does not seem to have a driver for MS SQL. PHP 7.4 no problem.

Following this guide (https://learn.microsoft.com/en-us/azure/app-service/deploy-local-git?tabs=cli), the steps to build and configure Azure App Service are: az appservice plan create -g rg-MyResourceG -n MyPlan --is-linux az webapp create -g rg-MyResource --plan MyPlan --name MyApp --% --runtime "PHP|7.4" --deployment-local-git Follow this guide to change to PHP 8.1: https://github.com/Azure/app-service-linux-docs/blob/master/Runtime_Support/php_support.md az webapp config appsettings set --name MyApp --resource-group MyResourceG --settings DEPLOYMENT_BRANCH='main' On my local server: php artisan key:generate --show az webapp config appsettings set --name Glados9L --resource-group rg-blueprism-tst --settings APP_KEY="Output of the last command" APP_DEBUG="true" git remotely add glados9l https://MyUser@MyApp.scm.azurewebsites.net/MyApp.git git push glados9l main ………… Remote: Completed in 223 seconds. secluded: Out of the way: Removing existing manifest file Out of the way: Creating a manifest file... Remote: Manifest file created. Remote: Copying .ostype to manifest output directory. secluded: Remote: Done in 457 sec(s). Remote: Running post deployment command(s)... secluded: Out of the way: Generating summary of Oryx build Remote: Parsing the build logs Remote: Found 0 issue(s) secluded: Remote: Build Summary: Remote: =============== Remote: Errors (0) Remote: Warnings (0) secluded: Remote: Triggering recycle (preview mode disabled). Remote: Deployment successful. deployer = deploymentPath = Remote: Deployment Logs: 'https://glados9l.scm.azurewebsites.net/newui/jsonviewer?view_url=/api/deployments/ef2b3e8ce9341d66fa5e64826721e09085dbe214/log' To https://myplan.scm.azurewebsites.net/Glados9L.git

  • [New branch] main -> main
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#


P粉649990163
P粉649990163

reply all(1)
P粉738821035

According to this pull request, the lack of pdo_sqlsrv in PHP 8.1 images is a known issue and they will add this driver soon.

Currently, you can follow this article

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template