Profile Applicability:
- Level 1
Description:
This check ensures that the web app hosted in Azure App Service is using a supported version of PHP. PHP is a widely used scripting language for web development. It is critical to ensure that the version of PHP used by your app is supported by the PHP community and Azure App Service to ensure security updates and compatibility with newer features.
Rationale:
Using outdated or unsupported versions of PHP exposes your application to security vulnerabilities, as older versions do not receive security patches and updates. Running an unsupported PHP version can also result in compatibility issues with modern libraries, frameworks, and plugins. Ensuring the use of a supported PHP version mitigates security risks and ensures compatibility with updated web technologies.
Impact:
Pros:
Ensures that your web app runs on a secure and stable version of PHP.
Helps avoid potential security vulnerabilities associated with deprecated PHP versions.
Improves compatibility with modern frameworks, tools, and plugins that may require the latest PHP versions.
Cons:
Updating PHP versions may require code modifications or testing to ensure compatibility with new features and deprecations.
Some older PHP-based applications may require adjustments to work with newer PHP versions.
Default Value:
By default, Azure App Service supports the latest stable versions of PHP, but the version in use may not always be the latest one.
Pre-requisites:
Ensure that your app is using a compatible PHP version with its code and dependencies.
Ensure the PHP version is configurable within your Azure App Service settings.
Test Plan:
Using Azure Console:
Log in to the Azure portal at https://portal.azure.com.
Go to the App Services blade.
Select the app for which you want to check the PHP version.
Under the Settings section, click on Configuration.
In the General Settings section, check the PHP version.
Verify that the PHP version displayed is one of the currently supported versions (e.g., PHP 7.4 or higher).
Using Azure CLI:
To check the PHP version used by an app, run the following command:
az webapp config show --resource-group <RESOURCE_GROUP_NAME> --name <APP_NAME> --query phpVersion
The output should return the PHP version in use by the app. Verify that the version is supported by the PHP community and Azure App Service.
Implementation Plan:
Using Azure Console:
Log in to the Azure portal at https://portal.azure.com.
Go to App Services.
Select the app for which you want to configure PHP.
Under the Settings section, click on Configuration.
In the General Settings section, select the latest supported PHP version (e.g., PHP 7.4, PHP 8.0).
Click Save to apply the changes.
Using Azure CLI:
To update the PHP version, run the following command:
az webapp config set --resource-group <RESOURCE_GROUP_NAME> --name <APP_NAME> --php-version <PHP_VERSION>
Example:
az webapp config set --resource-group <RESOURCE_GROUP_NAME> --name <APP_NAME> --php-version 7.4
Backout Plan:
Using Azure Console:
Log in to the Azure portal at https://portal.azure.com.
Go to App Services.
Select the app for which you want to revert the PHP version.
Under the Settings section, click on Configuration.
In the General Settings section, change the PHP version to the previous version.
Click Save to apply the changes.
Using Azure CLI:
To revert to a previous PHP version, run the following command:
az webapp config set --resource-group <RESOURCE_GROUP_NAME> --name <APP_NAME> --php-version <PREVIOUS_PHP_VERSION>
Example:
az webapp config set --resource-group <RESOURCE_GROUP_NAME> --name <APP_NAME> --php-version 7.3