How to use PHP8 for App Service Windows

This post has been republished via RSS; it originally appeared at: Microsoft Tech Community - Latest Blogs - .

Note that official support for PHP 8 will only be available on Linux, as a result of this App Service will only support PHP 8 on Apps Service Linux instances. For additional information on this topic: PHP on App Servicephp.internals: Microsoft Support of PHP on Windows.

 

This article will demonstrate on how to use PHP 8 for App Service Windows, since there would be no official support from Microsoft for it, please use at your own risk.

 

Generally, we are following this post: How to use a Custom PHP runtime for App Service Windows - (azureossd.github.io) to download a custom PHP runtime and map Handler for it.

 

1. Create a new Web app for Windows using any available Runtime stack for Windows.

KevinLi_0-1672902330705.png

 

2. After the creation complete, go to Kudu site from Azure Portal:

KevinLi_1-1672902424943.png

 

3. Create a new directory and download the PHP runtime(Non Thread Safe Version) from PHP For Windows: Binaries and sources Releases and extract it, in this demo, we use php 8.2.1, the output is as below:

 

 

mkdir php
curl https://windows.php.net/downloads/releases/php-8.2.1-nts-Win32-vs16-x64.zip -o php\php.zip
cd php
unzip php.zip

 

 

KevinLi_2-1672902634839.png

KevinLi_3-1672902775244.png

 

4. Go to Path mappings in configuration. Add a new handler mapping. The extension is "*.php", the Script processor is "C:\home\php\php-cgi.exe". Then save it. All the configuration is done.

KevinLi_4-1672903017834.png

 

5. To verify it, we can create an "index.php" file under C:\home\site\wwwroot with below content. The result would look like as below:

 

<?
phpinfo();

 

 

KevinLi_5-1672903258035.png

 

I hope you enjoy it.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.