PHP 7.3 End of Support and Azure WebApps
If you run WebApps in Azure you may have recently received a notification that PHP 7.3 will shortly become unsupported. This post shows how to find and update those apps.
Alert
This is the notification received from Microsoft.
You’re receiving this email because you may be using a PHP 7.3 app on App Service. Because PHP 7.3 extended support on Linux and Windows will end on 6 December 2021, any applications hosted on Azure App Service that are still using it won’t be supported after 6 December 2021. Your applications will continue to run unchanged but won’t receive any patches after 6 December 2021, since PHP will no longer be providing them.
…
To minimize risk and potential security vulnerabilities, follow the steps to update your applications to PHP 7.4 before 6 December 2021.
Discovery
PowerShell can be used to find the affected App Services. This snippet will interrogate all the objects in the current subscription (use Set-AzContext
to change this location) and produce a table of the WebApps configured to use PHP7.3
1ForEach ($WebApp in Get-AzWebApp){
2 Get-AzWebApp -Name $WebApp.Name -ResourceGroupName $webapp.ResourceGroup | `
3 Select-Object Name, ResourceGroup, `
4 @{N="LinuxFxVersion";E={$_.SiteConfig.LinuxFxVersion}}, `
5 @{N="PHPVersion";E={$_.SiteConfig.PhpVersion}} | `
6 Where-Object {($_.LinuxFxVersion -eq "PHP|7.3") -or ($_.PHPVersion -eq "7.3")} | `
7 Select-Object Name, ResourceGroup, @{N="PHPVersion";E={$_.LinuxFxVersion.replace("PHP|","")+$_.PHPVersion}}}
Sample Output:
1Name ResourceGroup PHPVersion
2---- ------------- ----------
3myweb-app-01 rsg-a 7.3
4myweb-app-02 rsg-b 7.3
5myweb-app-03 rsg-c 7.3
The code needs to look at two properties of the WebApp’s SiteConfig
: LinuxFxVersion
and PHPVersion
as the Linux and Windows-based Application Services store this version information in different places in the PowerShell object. The final Select-Object
merges these into a single column in the output.
Remediation
Once the affected WebApps have been determined, upgrading them to the latest version can commence. This is very straightforward in the Portal:
- Open the
Configuration
blade for the WebApp. - Select the
General Settings
tab. - Using the version drop-downs, select the version to upgrade to. (note that the Windows-based WebApp only has a single “PHP version” drop down)
- Remember to click the
Save
button.
Or alternatively PowerShell can be called upon to do the upgrade on a Windows-based WebApp:
1Set-AzWebApp -ResourceGroupName "rsg-b" -Name "myweb-app-02" -PhpVersion "7.4"
The Azure CLI can be used to upgrade Linux-based WebApps
1az webapp config set --resource-group "rsg-a" --name "myweb-app-01" --linux-fx-version "PHP|7.4"
Further Information
- Microsoft PHP on App Service details
- PHP Supported Versions
- Microsoft Notification about End of Support for PHP 7.3