Blog Post

Apps on Azure Blog
2 MIN READ

How to use PHP8 for App Service Windows

KevinLi's avatar
KevinLi
Former Employee
Jan 13, 2023

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.

 

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

 

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(it has been deprecated, use 8.2.9 as of Aug 11 2023), 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

 

 

 

 

 

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.

 

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();

 

 

 

 

 

I hope you enjoy it.

 

Updated Aug 11, 2023
Version 3.0

2 Comments

  • KevinLi's avatar
    KevinLi
    Former Employee

    setecg Yes, with PHP runtime stack, the selected PHP version probably will have higher priority to be leveraged.

  • setecg's avatar
    setecg
    Copper Contributor

    Didn't work for me.

     

    After following all steps, phpinfo() shows previous version (7.4.30) instead of custom 8.9.2.

     

    I think I have to change the "Runtime Stack" from PHP 7 to another one (not PHP) because if you select PHP, then it will override your custom PHP installation?