DEV Community

Cover image for Update the version of PHP via the Azure Cloud Shell
Foteini Savvidou
Foteini Savvidou

Posted on

Update the version of PHP via the Azure Cloud Shell

Originally published at www.foteinisavvidou.codes

In the previous tutorial, you created and configured a WordPress website hosted on Microsoft Azure. In part 2, you will learn how to show and update the PHP version using the Azure Cloud Shell.

To complete the exercise, you will need:

  • An Azure subscription.
  • A WordPress website running on Azure.

What is PHP?

PHP is a widely-used open source scripting language that can be used to create interactive websites. PHP is especially suited for web development and can be embedded into HTML.

WordPress is written using PHP as the scripting language. Many WordPress users may see the “WordPress PHP Update Required” notification in their dashboard. In order to see all the recommendations from WordPress, navigate to Tools > Site Health.

Show PHP version

  1. Sign in to Azure Portal and select the Cloud Shell from the top navigation menu. Azure Cloud Shell
  2. If this is the first launch of Cloud Shell, you should first choose your preferred shell experience and create a storage account.
    • Select PowerShell
    • Then select a subscription, a region and create a new resource group (or use an existing one), storage account and Microsoft Azure Files share.
    • Click Create storage.
  3. To show the current version of PHP, use the command:
az webapp config show --resource-group <resource-group-name> --name <app-name> --query phpVersion
Enter fullscreen mode Exit fullscreen mode

You can also see the supported PHP versions using the following command:

az webapp list-runtimes | grep php
Enter fullscreen mode Exit fullscreen mode

Update PHP version

Keeping PHP up-to-date is important since your website will be faster and more secure.

The latest supported PHP version is 7.4. Use the following command to set the version of PHP to 7.4:

az webapp config set --name <app-name> --resource-group <resource-group-name> --php-version 7.4
Enter fullscreen mode Exit fullscreen mode

Sign in to your website to confirm the changes.

If you want to learn more about how to configure your PHP web apps, you can read the article Configure a PHP app for Azure App Service on Microsoft Docs.

Next steps

In the following tutorials, you will learn how to connect to your Azure web app via FTP and add a custom domain and an SSL certificate to your website. Stay tuned!

Top comments (0)