Functions custom handler with PHP 8.2

Anonymous
2023-08-22T08:34:37.9233333+00:00

I am currently using Functions with PHP 7.4 as a custom handler, which is the most recent version installed on the system:

"C:\Program Files\PHP\v7.4\php.exe"

I would like to use a more recent version of PHP though. When I decompressed a PHP 8.2.9 zip and uploaded the whole directory, I received HTTP error 500 on the HTTP trigger.

Is it possible for me to use a newer version of PHP?

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,679 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. MuthuKumaranMurugaachari-MSFT 22,421 Reputation points
    2023-08-22T13:51:42.4733333+00:00

    Erol Perry Thanks for posting your question in Microsoft Q&A. Custom handlers apps can be deployed to different Function plans and the support for PHP version depends on the environment where you host. The latest supported PHP version is PHP 8.2 as per az functionapp list-runtimes and it is only available on App Service Linux instances (Windows only support up to PHP 7.4). Also, checkout PHP Support Timeline for the support status.

    To Set PHP version, you can use the following CLI command:

    az functionapp config set --resource-group <resource-group-name> --name <app-name> --linux-fx-version "PHP|8.1"
    
    

    For more flexibility, you may have to consider custom handlers in a container platform like Kubernetes with the latest PHP installed. If you experience 500 error on built-in server, this might be due to concurrency and check out https://techcommunity.microsoft.com/t5/apps-on-azure-blog/concurrency-on-azure-functions-php-with-custom-handlers/ba-p/2836495.

    I hope this helps with your questions and let me know if you have any other.


    If you found the answer to your question helpful, please take a moment to mark it as "Yes" for others to benefit from your experience. Or simply add a comment tagging me and would be happy to answer your questions.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.