Review App Service PHP runtime support

Use a supported PHP release, test app compatibility, and apply security updates.

Description

Choose a PHP release that App Service offers and that still receives PHP security updates. Check that your framework and libraries support it.

Potential impact

A runtime past its support period may keep known vulnerabilities. An incompatible upgrade can stop the app from starting or serving requests.

Remediation

Set site_config.application_stack.php_version on the Linux Web App. Start the app and test its dependencies and key requests before rollout. Review the support dates regularly so you can upgrade before support ends.

Examples

The first excerpt uses the retired Windows PHP configuration with PHP 7.3. App Service’s built-in PHP runtime now runs on Linux. In the second excerpt, supply the Linux plan ID in service_plan_id and the chosen release in php_version. Migrate the app and its deployment configuration to Linux as well.

Before

hcl
resource "azurerm_app_service" "example" {
  name                = "example-app-service"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
  app_service_plan_id = azurerm_app_service_plan.example.id

  site_config {
    dotnet_framework_version = "v4.0"
    scm_type                 = "LocalGit"
    php_version              = "7.3"
  }
}

After

hcl
resource "azurerm_linux_web_app" "example" {
  name                = "example-app-service"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
  service_plan_id     = var.service_plan_id

  site_config {
    application_stack {
      php_version = var.php_version
    }
  }
}

References