升級到 php 8.1 (Linux PHP) 後,Azure webapp 似乎沒有 MS SQL 的驅動程式。 php 7.4 沒問題。
依照本指南 (https://learn.microsoft.com/en-us/azure/app-service/deploy-local-git?tabs=cli),建置和設定 Azure 應用程式服務的步驟為: 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 請依照本指南改為 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' 在我的本機伺服器上: php artisan key:generate --show az webapp config appsettings set --name Glados9L --resource-group rg-blueprism-tst --settings APP_KEY="最後一個指令的輸出" APP_DEBUG="true" git 遠端新增glados9l https://MyUser@MyApp.scm.azurewebsites.net/MyApp.git git推送glados9l主要 ………… 遠端:223 秒內完成。 偏僻的: 偏僻的: Removing existing manifest file 偏僻的: Creating a manifest file... 偏僻的: Manifest file created. 偏僻的: Copying .ostype to manifest output directory. 偏僻的: 偏僻的: Done in 457 sec(s). 偏僻的: Running post deployment command(s)... 偏僻的: 偏僻的: Generating summary of Oryx build 偏僻的: Parsing the build logs 偏僻的: Found 0 issue(s) 偏僻的: 偏僻的: Build Summary : 偏僻的: =============== 偏僻的: Errors (0) 偏僻的: Warnings (0) 偏僻的: 偏僻的: Triggering recycle (preview mode disabled). 偏僻的: Deployment successful. deployer = deploymentPath = 偏僻的: Deployment Logs : 'https://glados9l.scm.azurewebsites.net/newui/jsonviewer?view_url=/api/deployments/ef2b3e8ce9341d66fa5e64826721e09085dbe214/log' 至 https://myplan.scm.azurewebsites.net/Glados9L.git
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#
根據此拉取請求,PHP 8.1 映像中缺少 pdo_sqlsrv 是一個已知問題,他們很快就會添加這個驅動程式。
目前,您可以按照 這篇文章