Skip to content

Commit 53f8988

Browse files
committed
Refresh article
1 parent 7e58246 commit 53f8988

File tree

1 file changed

+70
-75
lines changed

1 file changed

+70
-75
lines changed
Lines changed: 70 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
2-
title: 'Quickstart: Create a PHP web app'
2+
title: 'Quickstart: Create a PHP Web App'
33
description: Deploy your first PHP Hello World to Azure App Service in minutes. You deploy using Git, which is one of many ways to deploy to App Service.
44
ms.assetid: 6feac128-c728-4491-8b79-962da9a40788
55
ms.topic: quickstart
66
author: msangapu-msft
77
ms.author: msangapu
8-
ms.date: 01/26/2024
8+
ms.date: 04/21/2025
99
ms.devlang: php
1010
ms.custom: mode-other, devdivchpfy22, devx-track-azurecli, linux-related-content
1111
zone_pivot_groups: app-service-platform-windows-linux
@@ -18,24 +18,24 @@ zone_pivot_groups: app-service-platform-windows-linux
1818
::: zone-end
1919

2020
::: zone pivot="platform-linux"
21-
[Azure App Service](overview.md) provides a highly scalable, self-patching web hosting service. This quickstart shows how to deploy a PHP app to Azure App Service on Linux.
21+
[Azure App Service](overview.md) provides a highly scalable, self-patching service for web hosting. This quickstart shows how to deploy a PHP app to Azure App Service on Linux.
2222

23-
![Screenshot of the sample app running in Azure.](media/quickstart-php/hello-world-in-browser.png)
23+
:::image type="content" source="media/quickstart-php/hello-world-in-browser.png" alt-text="Screenshot of the sample app running in Azure.":::
2424

25-
You can follow the steps here using a Mac, Windows, or Linux machine. Once the prerequisites are installed, it takes about five minutes to complete the steps.
25+
You can follow the steps here using a Mac, Windows, or Linux machine. Once the prerequisites are installed, it takes about ten minutes to complete the steps.
2626

27-
To complete this quickstart, you need:
27+
## Prerequisites
2828

2929
* An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/).
3030
* [Git](https://git-scm.com/)
31-
* [PHP](https://php.net/manual/install.php)
31+
* [PHP](https://php.net/downloads.php)
3232
* [Azure CLI](/cli/azure/install-azure-cli) to run commands in any shell to create and configure Azure resources.
3333

34-
## 1 - Get the sample repository
34+
## Download the sample repository
3535

3636
### [Azure CLI](#tab/cli)
3737

38-
You can create the web app using the [Azure CLI](/cli/azure/get-started-with-azure-cli) in Cloud Shell, and you use Git to deploy sample PHP code to the web app.
38+
You can create the web app by using the [Azure CLI](/cli/azure/get-started-with-azure-cli), and you use Git to deploy sample PHP code to the web app.
3939

4040
1. In a terminal window, run the following commands to clone the sample application to your local machine and navigate to the project root.
4141

@@ -49,11 +49,11 @@ You can create the web app using the [Azure CLI](/cli/azure/get-started-with-azu
4949
```bash
5050
php -S localhost:8080
5151
```
52-
52+
5353
1. Browse to the sample application at `http://localhost:8080` in a web browser.
54-
55-
![Screenshot of the sample app running locally.](media/quickstart-php/localhost-hello-world-in-browser.png)
56-
54+
55+
:::image type="content" source="media/quickstart-php/localhost-hello-world-in-browser.png" alt-text="Screenshot of the sample app running locally.":::
56+
5757
1. In your terminal window, press **Ctrl+C** to exit the web server.
5858

5959
### [Portal](#tab/portal)
@@ -62,24 +62,24 @@ You can create the web app using the [Azure CLI](/cli/azure/get-started-with-azu
6262

6363
1. In the upper right corner, select **Fork**.
6464

65-
![Screenshot of the Azure-Samples/php-docs-hello-world repo in GitHub, with the Fork option highlighted.](media/quickstart-php/fork-php-docs-hello-world-repo.png)
65+
:::image type="content" source="media/quickstart-php/fork-php-docs-hello-world-repo.png" alt-text="Screenshot of the Azure Samples repo in GitHub, with the Fork option highlighted.":::
6666

6767
1. On the **Create a new fork** screen, confirm the **Owner** and **Repository name** fields. Select **Create fork**.
6868

69-
![Screenshot of the Create a new fork page in GitHub for creating a new fork of Azure-Samples/php-docs-hello-world.](media/quickstart-php/fork-details-php-docs-hello-world-repo.png)
69+
:::image type="content" source="media/quickstart-php/fork-details-php-docs-hello-world-repo.png" alt-text="Screenshot of the Create a new fork page in GitHub for creating a new fork of Azure Samples.":::
7070

7171
>[!NOTE]
72-
> This should take you to the new fork. Your fork URL will look something like this: `https://github.com/YOUR_GITHUB_ACCOUNT_NAME/php-docs-hello-world`
72+
> This should take you to the new fork. Your fork URL looks something like this: `https://github.com/YOUR_GITHUB_ACCOUNT_NAME/php-docs-hello-world`
7373

7474
---
7575

76-
## 2 - Deploy your application code to Azure
76+
## Deploy your application code to Azure
7777

7878
### [Azure CLI](#tab/cli)
7979

8080
Azure CLI has a command [`az webapp up`](/cli/azure/webapp#az-webapp-up) that creates the necessary resources and deploys your application in a single step.
8181

82-
In the terminal, deploy the code in your local folder using the [`az webapp up`](/cli/azure/webapp#az-webapp-up) command:
82+
In the terminal, deploy the code in your local folder using the `az webapp up` command:
8383

8484
```azurecli
8585
az webapp up --runtime "PHP:8.2" --os-type=linux
@@ -89,62 +89,62 @@ az webapp up --runtime "PHP:8.2" --os-type=linux
8989
- The `--runtime "PHP:8.2"` argument creates the web app with PHP version 8.2.
9090
- The `--os-type=linux` argument creates the web app on App Service on Linux.
9191
- You can optionally specify a name with the argument `--name <app-name>`. If you don't provide one, then a name is automatically generated.
92-
- You can optionally include the argument `--location <location-name>` where `<location_name>` is an available Azure region. You can retrieve a list of allowable regions for your Azure account by running the [`az account list-locations`](/cli/azure/appservice#az_appservice_list_locations) command.
93-
- If you see the error, "Could not auto-detect the runtime stack of your app," make sure you're running the command in the code directory (See [Troubleshooting auto-detect issues with az webapp up](https://github.com/Azure/app-service-linux-docs/blob/master/AzWebAppUP/runtime_detection.md)).
92+
- You can optionally include the argument `--location <location-name>` where `<location_name>` is an available Azure region. You can retrieve a list of allowable regions for your Azure account by running the [`az account list-locations`](/cli/azure/appservice#az-appservice-list-locations) command.
93+
- If you see the error **Could not auto-detect the runtime stack of your app**, make sure you're running the command in the code directory. To learn more, see [Troubleshooting auto-detect issues with az webapp up](https://github.com/Azure/app-service-linux-docs/blob/master/AzWebAppUP/runtime_detection.md).
9494
95-
The command can take a few minutes to complete. While it's running, it provides messages about creating the resource group, the App Service plan, and the app resource, configuring logging, and doing ZIP deployment. It then gives the message, "You can launch the app at http://&lt;app-name&gt;.azurewebsites.net", which is the app's URL on Azure.
95+
The command can take a few minutes to complete. While it's running, it provides messages about creating the resource group, the App Service plan, and the app resource, configuring logging, and doing ZIP deployment. It then provides the app's URL on Azure.
9696
97-
<pre>
98-
The webapp '&lt;app-name>' doesn't exist
99-
Creating Resource group '&lt;group-name>' ...
97+
```
98+
The webapp '<app-name>' doesn't exist
99+
Creating Resource group '<group-name>' ...
100100
Resource group creation complete
101-
Creating AppServicePlan '&lt;app-service-plan-name>' ...
102-
Creating webapp '&lt;app-name>' ...
101+
Creating AppServicePlan '<app-service-plan-name>' ...
102+
Creating webapp '<app-name>' ...
103103
Configuring default logging for the app, if not already enabled
104-
Creating zip with contents of dir /home/msangapu/myPhpApp ...
104+
Creating zip with contents of <directory-location> ...
105105
Getting scm site credentials for zip deployment
106106
Starting zip deployment. This operation can take a while to complete ...
107107
Deployment endpoint responded with status code 202
108-
You can launch the app at http://&lt;app-name>.azurewebsites.net
108+
You can launch the app at http://<app-name>.azurewebsites.net
109109
{
110-
"URL": "http://&lt;app-name>.azurewebsites.net",
111-
"appserviceplan": "&lt;app-service-plan-name>",
110+
"URL": "http://<app-name>.azurewebsites.net",
111+
"appserviceplan": "<app-service-plan-name>",
112112
"location": "centralus",
113-
"name": "&lt;app-name>",
113+
"name": "<app-name>",
114114
"os": "linux",
115-
"resourcegroup": "&lt;group-name>",
115+
"resourcegroup": "<group-name>",
116116
"runtime_version": "php|8.2",
117117
"runtime_version_detected": "0.0",
118118
"sku": "FREE",
119-
"src_path": "//home//msangapu//myPhpApp"
119+
"src_path": "<directory-path>"
120120
}
121-
</pre>
121+
```
122122
123123
[!include [az webapp up command note](../../includes/app-service-web-az-webapp-up-note.md)]
124124
125-
Browse to the deployed application in your web browser at the URL `http://<app-name>.azurewebsites.net`.
125+
Browse to the deployed application in your web browser at the URL that's provided in the terminal.
126126
127127
### [Portal](#tab/portal)
128128
129-
1. Sign into the Azure portal.
130-
129+
1. Sign in to [the Azure portal](https://portal.azure.com).
130+
131131
1. At the top of the portal, type **app services** in the search box. Under **Services**, select **App Services**.
132132
133-
![Screenshot of the Azure portal with 'app services' typed in the search text box. In the results, the App Services option under Services is highlighted.](media/quickstart-php/azure-portal-search-for-app-services.png)
133+
:::image type="content" source="media/quickstart-php/azure-portal-search-for-app-services.png" alt-text="Screenshot of the Azure portal with app services typed in the search text box.":::
134134
135-
1. In the **App Services** page, select **+ Create**.
135+
1. In the **App Services** page, select **+ Create** and choose **Web App**.
136136
137137
1. In the **Basics** tab:
138138
139139
- Under **Resource group**, select **Create new**. Type *myResourceGroup* for the name.
140140
- Under **Name**, type a globally unique name for your web app.
141-
- Under **Publish**, select *Code*.
142-
- Under **Runtime stack** select *PHP 8.2*.
143-
- Under **Operating System**, select *Linux*.
141+
- Under **Publish**, select **Code**.
142+
- Under **Runtime stack** select **PHP 8.2**.
143+
- Under **Operating System**, select **Linux**.
144144
- Under **Region**, select an Azure region close to you.
145145
- Under **App Service Plan**, create an app service plan named *myAppServicePlan*.
146146
- Under **Pricing plan**, select **Free F1**.
147-
147+
148148
:::image type="content" source="./media/quickstart-php/app-service-details-php.png" lightbox="./media/quickstart-php/app-service-details-php.png" alt-text="Screenshot of new App Service app configuration for PHP in the Azure portal.":::
149149
150150
1. Select the **Deployment** tab at the top of the page.
@@ -155,10 +155,10 @@ Browse to the deployed application in your web browser at the URL `http://<app-n
155155
156156
- For **Organization** select the organization where you forked the demo project.
157157
- For **Repository** select the *php-docs-hello-world* project.
158-
- For **Branch** select *master*.
158+
- For **Branch** select *main*.
159159
160160
:::image type="content" source="media/quickstart-php/app-service-deploy-php.png" lightbox="media/quickstart-php/app-service-deploy-php.png" border="true" alt-text="Screenshot of the deployment options for a PHP app.":::
161-
161+
162162
> [!NOTE]
163163
> By default, the creation wizard [disables basic authentication](configure-basic-auth-disable.md) and GitHub Actions deployment is created [using a user-assigned identity](deploy-continuous-deployment.md#what-does-the-user-assigned-identity-option-do-for-github-actions). If you get a permissions error during resource creation, your Azure account might not have [enough permissions](deploy-continuous-deployment.md#why-do-i-see-the-error-you-do-not-have-sufficient-permissions-on-this-app-to-assign-role-based-access-to-a-managed-identity-and-configure-federated-credentials). You can [configure GitHub Actions deployment later](deploy-continuous-deployment.md) with an identity generated for you by an Azure administrator, or you can also enable basic authentication instead.
164164
@@ -168,21 +168,21 @@ Browse to the deployed application in your web browser at the URL `http://<app-n
168168
169169
1. After deployment is completed, select **Go to resource**.
170170
171-
1. Browse to the deployed application in your web browser at the URL `http://<app-name>.azurewebsites.net`.
171+
1. Browse to the deployed application in your web browser at the URL provided.
172172
173173
---
174174
175175
The PHP sample code is running in an Azure App Service.
176176
177-
![Screenshot of the sample app running in Azure, showing 'Hello World!'.](media/quickstart-php/php-8-hello-world-in-browser.png)
177+
:::image type="content" source="media/quickstart-php/php-8-hello-world-in-browser.png" alt-text="Screenshot of the sample app running in Azure, showing Hello World.":::
178178
179179
**Congratulations!** You deployed your first PHP app to App Service using the Azure portal.
180180
181-
## 3 - Update and redeploy the app
181+
## Update and redeploy the app
182182
183183
### [Azure CLI](#tab/cli)
184184
185-
1. Using a local text editor, open the `index.php` file within the PHP app, and make a small change to the text within the string next to `echo`:
185+
1. Locate the directory *php-docs-hello-world* and open the *index.php* file using a local text editor. Make a small change to the text within the string next to `echo`:
186186
187187
```php
188188
echo "Hello Azure!";
@@ -196,20 +196,20 @@ The PHP sample code is running in an Azure App Service.
196196
197197
1. Once deployment is completed, return to the browser window that opened during the **Browse to the app** step, and refresh the page.
198198
199-
![Screenshot of the updated sample app running in Azure.](media/quickstart-php/hello-azure-in-browser.png)
199+
:::image type="content" source="media/quickstart-php/hello-azure-in-browser.png" alt-text="Screenshot of the updated sample app running in Azure.":::
200200
201201
### [Portal](#tab/portal)
202202
203203
1. Browse to your GitHub fork of php-docs-hello-world.
204204
205205
1. On your repo page, press `.` to start Visual Studio Code within your browser.
206206
207-
![Screenshot of the forked php-docs-hello-world repo in GitHub with instructions to press the period key on this screen.](media/quickstart-php/forked-github-repo-press-period.png)
207+
:::image type="content" source="media/quickstart-php/forked-github-repo-press-period.png" alt-text="Screenshot of the forked php-docs-hello-world repo in GitHub with instructions to press the period key on this screen.":::
208208
209209
> [!NOTE]
210-
> The URL will change from GitHub.com to GitHub.dev. This feature only works with repos that have files. This does not work on empty repos.
210+
> The URL changes from GitHub.com to GitHub.dev. This feature only works with repos that have files. This doesn't work on empty repos.
211211
212-
1. Edit **index.php** so that it shows "Hello Azure!" instead of "Hello World!"
212+
1. Edit *index.php* so that it shows *Hello Azure!* instead of *Hello World!*
213213
214214
```php
215215
<?php
@@ -219,37 +219,37 @@ The PHP sample code is running in an Azure App Service.
219219
220220
1. From the **Source Control** menu, select the **Stage Changes** button to stage the change.
221221
222-
![Screenshot of Visual Studio Code in the browser, highlighting the Source Control navigation in the sidebar, then highlighting the Stage Changes button in the Source Control panel.](media/quickstart-php/visual-studio-code-in-browser-stage-changes.png)
222+
:::image type="content" source="media/quickstart-php/visual-studio-code-in-browser-stage-changes.png" alt-text="Screenshot of Visual Studio Code in the browser, highlighting the Source Control navigation in the sidebar, then highlighting the Stage Changes button in the Source Control panel.":::
223223
224-
1. Enter a commit message such as `Hello Azure`. Then, select **Commit and Push**.
225-
226-
![Screenshot of Visual Studio Code in the browser, Source Control panel with a commit message of 'Hello Azure' and the Commit and Push button highlighted.](media/quickstart-php/visual-studio-code-in-browser-commit-push.png)
224+
1. Enter a commit message such as *Hello Azure*. Then, select **Commit and Push**.
227225
228-
1. Once deployment is completed, return to the browser window that opened during the **Browse to the app** step, and refresh the page.
226+
:::image type="content" source="media/quickstart-php/visual-studio-code-in-browser-commit-push.png" alt-text="Screenshot of Visual Studio Code in the browser, Source Control panel with a commit message of Hello Azure.":::
229227
230-
![Screenshot of the updated sample app running in Azure, showing 'Hello Azure!'.](media/quickstart-php/php-8-hello-azure-in-browser.png)
228+
1. After deployment is complete, return to the browser window that opened during the **Browse to the app** step, and refresh the page.
229+
230+
:::image type="content" source="media/quickstart-php/php-8-hello-azure-in-browser.png" alt-text="Screenshot of the updated sample app running in Azure, showing Hello Azure.":::
231231
232232
---
233233
234-
## 4 - Manage your new Azure app
234+
## Manage your new Azure app
235235
236236
1. Go to the Azure portal to manage the web app you created. Search for and select **App Services**.
237237
238-
![Screenshot of the Azure portal with 'app services' typed in the search text box. In the results, the App Services option under Services is highlighted.](media/quickstart-php/azure-portal-search-for-app-services.png)
238+
:::image type="content" source="media/quickstart-php/azure-portal-search-for-app-services.png" alt-text="Screenshot of the Azure portal with app services typed in the search text box.":::
239239
240-
1. Select the name of your Azure app.
240+
1. Select your Azure app to open it.
241241
242-
![Screenshot of the App Services list in Azure. The name of the demo app service is highlighted.](media/quickstart-php/app-service-list.png)
242+
:::image type="content" source="media/quickstart-php/app-service-list.png" alt-text="Screenshot of the App Services list in Azure. The name of the demo app service is highlighted.":::
243243
244244
Your web app's **Overview** page should be displayed. Here, you can perform basic management tasks like **Browse**, **Stop**, **Restart**, and **Delete**.
245245
246-
![Screenshot of the App Service overview page in Azure portal. In the action bar, the Browse, Stop, Swap (disabled), Restart, and Delete button group is highlighted.](media/quickstart-php/app-service-detail.png)
246+
:::image type="content" source="media/quickstart-php/app-service-detail.png" alt-text="Screenshot of the App Service overview page in Azure portal. In the action bar, the Browse, Stop, Swap, Restart, and Delete button group is highlighted.":::
247247
248248
The web app menu provides different options for configuring your app.
249249
250-
## 5 - Clean up resources
250+
## Clean up resources
251251
252-
When you're finished with the sample app, you can remove all of the resources for the app from Azure. It helps you avoid extra charges and keeps your Azure subscription uncluttered. Removing the resource group also removes all resources in the resource group and is the fastest way to remove all Azure resources for your app.
252+
When you're finished with the sample app, you can remove all of the resources for the app from Azure so you can avoid extra charges and keep your Azure subscription uncluttered. Removing the resource group also removes all resources in the resource group and is the fastest way to remove all Azure resources for your app.
253253
254254
### [Azure CLI](#tab/cli)
255255
@@ -271,13 +271,8 @@ This command takes a minute to run.
271271
272272
::: zone-end
273273
274-
## Next steps
275-
276-
> [!div class="nextstepaction"]
277-
> [PHP with MySQL](tutorial-php-mysql-app.md)
278-
279-
> [!div class="nextstepaction"]
280-
> [Configure PHP app](configure-language-php.md)
274+
## Related content
281275
282-
> [!div class="nextstepaction"]
283-
> [Secure with custom domain and certificate](tutorial-secure-domain-certificate.md)
276+
* [Deploy a PHP, MySQL, and Redis app to Azure App Service](tutorial-php-mysql-app.md)
277+
* [Configure a PHP app for Azure App Service](configure-language-php.md)
278+
* [Secure your app with a custom domain and a managed certificate](tutorial-secure-domain-certificate.md)

0 commit comments

Comments
 (0)