Use the Conformity Knowledge Base AI to help improve your Cloud Posture

Check for Latest Version of PHP

Trend Micro Cloud One™ – Conformity is a continuous assurance tool that provides peace of mind for your cloud infrastructure, delivering over 750 automated best practice checks.

Risk Level: Low (generally tolerable level of risk)
Rule ID: AppService-002

Ensure that all Microsoft Azure App Service web applications developed with PHP are using the latest available version of PHP in order to take advantage of the most recent security fixes, performance improvements and new functionalities and features.

This rule resolution is part of the Conformity Security & Compliance tool for Azure.

Security
Reliability
Performance
efficiency

Periodically, newer versions of PHP are released to fix security flaws, add performance enhancements or just to include additional functionality. Therefore, using the latest software version is highly recommended in order to apply the necessary security patches and take advantage of the new enhancements and capabilities.


Audit

To determine if your Azure App Service web applications are using the latest version of PHP, perform the following actions:

Using Azure Console

01 Sign in to Azure Management Console.

02 Navigate to App Services blade at https://portal.azure.com/#blade/HubsExtension/BrowseResourceBlade/resourceType/Microsoft.Web%2Fsites.

03 Click on the name of the App Service web application that you want to examine.

04 In the navigation menu, under Settings, select Configuration to access the configuration settings defined for the selected application.

05 On the Configuration panel, select General settings tab to access the application general settings.

06 In the Stack settings section, check the Stack setting value to determine the type of the software stack used by the selected web application. If Stack is set to PHP, check the stack software version available in the PHP version dropdown list. If PHP version does not show the latest version available in the list (for example, 7.3), the selected Azure App Service PHP web application is not configured to use the latest version of PHP software.

07 Repeat steps no. 3 – 6 for each Azure App Service web application available within the current subscription.

08 Repeat steps no. 3 – 7 for other subscriptions created in your Microsoft Azure cloud account.

Using Azure CLI

01 Run webapp list-runtimes command (Windows/macOS/Linux) using custom query filters to list the PHP versions currently supported by Microsoft Azure App Service:

az webapp list-runtimes | grep php

02 The command output should return the supported versions of the PHP software:

"php|5.6",
"php|7.0",
"php|7.1",
"php|7.2",
"php|7.3"

03 Run webapp list command (Windows/macOS/Linux) using custom query filters to list the IDs of all App Service web applications deployed in the current Azure subscription:

az webapp list
	--query '[*].id'

04 The command output should return the requested Azure App Service application IDs:

[
"/subscriptions/1234abcd-1234-abcd-1234-abcd1234abcd/resourceGroups/cloud-shell-storage-westeurope/providers/Microsoft.Web/sites/cc-laravel-webapp",
"/subscriptions/1234abcd-1234-abcd-1234-abcd1234abcd/resourceGroups/cloud-shell-storage-westeurope/providers/Microsoft.Web/sites/cc-mobile-webapp",
"/subscriptions/1234abcd-1234-abcd-1234-abcd1234abcd/resourceGroups/cloud-shell-storage-westeurope/providers/Microsoft.Web/sites/cc-project5-webapp"
]

05 Run webapp config show command (Windows/macOS/Linux) using the ID of the application that you want to examine as identifier parameter and custom query filters to describe the PHP version configured for the selected Azure App Service web application:

az webapp config show
	--ids "/subscriptions/1234abcd-1234-abcd-1234-abcd1234abcd/resourceGroups/cloud-shell-storage-westeurope/providers/Microsoft.Web/sites/cc-laravel-webapp"
	--query '{"phpVersion":phpVersion}'

06 The command output should return the PHP software version currently in use:

{
  "phpVersion": "7.1"
}

If the value returned by the webapp config show command output for "phpVersion" configuration attribute is null or an empty string (i.e. ""), the verified web application is not using a PHP software stack. Otherwise, check the returned attribute value and compare it with each version returned at step no. 2. If "phpVersion" value is different than the latest version of the PHP software returned at step no. 2, the selected Azure App Service web application is not using the latest version of PHP.

07 Repeat steps no. 3 – 6 for each Azure App Service web application provisioned in the current subscription.

08 Repeat steps no. 3 – 7 for each subscription created in your Microsoft Azure cloud account.

Remediation / Resolution

To reconfigure your Microsoft Azure App Service PHP web applications in order to enable the latest supported version of PHP, perform the following actions:

Using Azure Console

01 Sign in to Azure Management Console.

02 Navigate to App Services blade at https://portal.azure.com/#blade/HubsExtension/BrowseResourceBlade/resourceType/Microsoft.Web%2Fsites.

03 Click on the name of the web application that you want to reconfigure (see Audit section part I to identify the right application).

04 In the navigation menu, under Settings, select Configuration to access the configuration settings defined for the selected application.

05 On the Configuration panel, select General settings tab to access the web application general settings.

06 In the Stack settings section, select the latest version of the PHP software available in the PHP version dropdown list.

07 Click Save to apply the configuration changes. Once these changes become active, the Azure Management Console should display the following confirmation message: "Successfully updated web app settings".

08 Repeat steps no. 3 – 7 for each Azure App Service PHP web application available within the current subscription.

09 Repeat steps no. 3 – 8 for each subscription created in your Microsoft Azure cloud account.

Using Azure CLI

01 Run webapp list-runtimes command (Windows/macOS/Linux) using custom query filters to list the PHP software versions currently supported by Microsoft Azure App Service:

az webapp list-runtimes | grep php

02 The command output should return the PHP versions supported by Azure App Service:

"php|5.6",
"php|7.0",
"php|7.1",
"php|7.2",
"php|7.3"

03 Run webapp config set command (Windows/macOS/Linux) using the ID of the Azure App Service PHP web application that you want to reconfigure as identifier parameter (see Audit section part I to identify the right application) to enable the latest version of PHP software, as described at step no. 2, for the selected web application:

az webapp config set
	--ids "/subscriptions/1234abcd-1234-abcd-1234-abcd1234abcd/resourceGroups/cloud-shell-storage-westeurope/providers/Microsoft.Web/sites/cc-laravel-webapp"
	--php-version "7.3"

04 The command output should return the metadata available for the reconfigured Azure App Service web application:

{
  "alwaysOn": false,
  "apiDefinition": null,
  "appSettings": null,
  "autoHealEnabled": false,
  "connectionStrings": null,
  "location": "West Europe",
  "logsDirectorySizeLimit": 35,
  "managedPipelineMode": "Integrated",
  "managedServiceIdentityId": null,
  "minTlsVersion": "1.2",
  "name": "cc-laravel-app",
  "netFrameworkVersion": "v4.0",
  "nodeVersion": "",
  "numberOfWorkers": 1,
 
  ...
 
  "phpVersion": "7.3",
  "publishingUsername": "$cc-laravel-app",
  "push": null,
  "pythonVersion": "",
  "remoteDebuggingEnabled": false,
  "remoteDebuggingVersion": "VS2017",
  "requestTracingEnabled": false,
  "requestTracingExpirationTime": null,
  "reservedInstanceCount": 0,
  "resourceGroup": "cloud-shell-storage-westeurope",
  "webSocketsEnabled": false,
  "windowsFxVersion": null,
  "xManagedServiceIdentityId": null
}

05 Repeat step no. 3 and 4 for each Azure App Service PHP web application deployed in the current subscription.

06 Repeat steps no. 3 – 5 for each subscription created in your Microsoft Azure cloud account.

References

Publication date Oct 2, 2019

Unlock the Remediation Steps


Free 30-day Trial

Automatically audit your configurations with Conformity
and gain access to our cloud security platform.

Confirmity Cloud Platform

No thanks, back to article

You are auditing:

Check for Latest Version of PHP

Risk Level: Low