Concurrency on Azure Functions (PHP) with custom handlers

Published Oct 13 2021 08:20 PM 933 Views
Microsoft

PHP is not among supported languages in Azure Functions, but one can easily implement that with the help of Azure Functions custom handlers. There are several posts over the Internet guiding you how to set up a PHP Function with custom handlers, but one needs to pay attention to the concurrency here, or he/she may easily ends up with HTTP 500.121(Timeout).

 

Performance bottleneck

I created one PHP function app following the guidance from Internet, below is the host.json file. The HTTP trigger function is quite simple, it will only sleep 50 seconds once it is triggered before return. When I send 10 requests almost at the same time, the response time of each requests is increasing, until it reaches 230s(the maximum time IIS server on Azure App Service allowed) and returns HTTP 500.121(Timeout).

 

 

{
  "version": "2.0",
  "logging": {
    "applicationInsights": {
      "samplingSettings": {
        "isEnabled": true,
        "excludedTypes": "Request"
      }
    }
  },
  "extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    "version": "[2.*, 3.0.0)"
  },
  "customHandler": {
    "description": {
      "defaultExecutablePath": "php",
      "workingDirectory": "",
      "arguments": [
        "-S",
        "127.0.0.1:%FUNCTIONS_CUSTOMHANDLER_PORT%",
        "router.php"
      ],
      "enableForwardingHttpRequest": true
    }
  }
}

 

 

Requests response time:

PreciseTimeStamp

Cs_method

Cs_uri_stem

S_port

Sc_status

Sc_substatus

Sc_win32_status

Time_taken(ms)

2021-09-27 06:28:45.1512587

GET

/api/function1

443

200

0

0

50027

2021-09-27 06:28:45.1722946

GET

/api/function1

443

200

0

0

73530

2021-09-27 06:29:45.1965994

GET

/api/function1

443

200

0

0

123586

2021-09-27 06:30:45.2202146

GET

/api/function1

443

200

0

0

173613

2021-09-27 06:31:45.2311004

GET

/api/function1

443

200

0

0

223630

2021-09-27 06:31:45.2390925

GET

/api/function1

443

500

121

0

230002

2021-09-27 06:32:45.3702086

GET

/api/function1

443

500

121

0

230001

2021-09-27 06:33:45.4016691

GET

/api/function1

443

500

121

0

230003

2021-09-27 06:34:45.4178058

GET

/api/function1

443

500

121

0

230005

 

Root Cause

If you get back and check my host.json again, you will notice that I am launching a PHP built-in web server with the help of Azure Functions custom handlers. The web server runs only one single-threaded process, so PHP applications will stall if a request is blocked.

 

 

php -S 127.0.0.1:%FUNCTIONS_CUSTOMHANDLER_PORT% router.php

 

 

One doc you may reference: 

https://www.php.net/manual/en/features.commandline.webserver.php

 

What I can do

  • If one insists on using Azure Functions in his/her design, then he/she may leverage environmental variable ‘PHP_CLI_SERVER_WORKERS’ and set up a large number to achieve concurrency. This feature is only provided by PHP7.4 on linux. But PHP7.4 on linux is not available on current linux plan, one needs to run his/her function app in a custom linux container which has built that has PHP installed. Please note, even though it can achieve certain concurrency with multiple PHP processes, but it still not recommended to use in production environment due to limited performance.

Attach the Dockerfile below to your reference.

 

 

# To enable ssh & remote debugging on app service change the base image to the one below
FROM mcr.microsoft.com/azure-functions/dotnet:3.0-appservice 
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
    AzureFunctionsJobHost__Logging__Console__IsEnabled=true

#COPY --from=installer-env ["/home/site/wwwroot", "/home/site/wwwroot"]

RUN apt -y install lsb-release apt-transport-https ca-certificates 
RUN wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
RUN echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/php.list
RUN apt update && apt install php7.4 -y


COPY . /home/site/wwwroot

 

 

  • The best option is to switch to PHP web app instead of Azure Functions with custom handler. In that way, the PHP module launched by Apache/Nginx server could handle the API requests concurrently.

 

%3CLINGO-SUB%20id%3D%22lingo-sub-2836495%22%20slang%3D%22en-US%22%3EConcurrency%20on%20Azure%20Functions%20(PHP)%20with%20custom%20handlers%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2836495%22%20slang%3D%22en-US%22%3E%3CP%3EPHP%20is%20not%20among%20supported%20languages%20in%20Azure%20Functions%2C%20but%20one%20can%20easily%20implement%20that%20with%20the%20help%20of%20Azure%20Functions%20custom%20handlers.%20There%20are%20several%20posts%20over%20the%20Internet%20guiding%20you%20how%20to%20set%20up%20a%20PHP%20Function%20with%20custom%20handlers%2C%20but%20one%20needs%20to%20pay%20attention%20to%20the%20concurrency%20here%2C%20or%20he%2Fshe%20may%20easily%20ends%20up%20with%20HTTP%20500.121(Timeout).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%225%22%3EPerformance%20bottleneck%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3EI%20created%20one%20PHP%20function%20app%20following%20the%20guidance%20from%20Internet%2C%20below%20is%20the%20host.json%20file.%20The%20HTTP%20trigger%20function%20is%20quite%20simple%2C%20it%20will%20only%20sleep%2050%20seconds%20once%20it%20is%20triggered%20before%20return.%20When%20I%20send%2010%20requests%20almost%20at%20the%20same%20time%2C%20the%20response%20time%20of%20each%20requests%20is%20increasing%2C%20until%20it%20reaches%20230s(the%20maximum%20time%20IIS%20server%20on%20Azure%20App%20Service%20allowed)%20and%20returns%20HTTP%20500.121(Timeout).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3E%7B%0A%20%20%22version%22%3A%20%222.0%22%2C%0A%20%20%22logging%22%3A%20%7B%0A%20%20%20%20%22applicationInsights%22%3A%20%7B%0A%20%20%20%20%20%20%22samplingSettings%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22isEnabled%22%3A%20true%2C%0A%20%20%20%20%20%20%20%20%22excludedTypes%22%3A%20%22Request%22%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%20%20%7D%2C%0A%20%20%22extensionBundle%22%3A%20%7B%0A%20%20%20%20%22id%22%3A%20%22Microsoft.Azure.Functions.ExtensionBundle%22%2C%0A%20%20%20%20%22version%22%3A%20%22%5B2.*%2C%203.0.0)%22%0A%20%20%7D%2C%0A%20%20%22customHandler%22%3A%20%7B%0A%20%20%20%20%22description%22%3A%20%7B%0A%20%20%20%20%20%20%22defaultExecutablePath%22%3A%20%22php%22%2C%0A%20%20%20%20%20%20%22workingDirectory%22%3A%20%22%22%2C%0A%20%20%20%20%20%20%22arguments%22%3A%20%5B%0A%20%20%20%20%20%20%20%20%22-S%22%2C%0A%20%20%20%20%20%20%20%20%22127.0.0.1%3A%25FUNCTIONS_CUSTOMHANDLER_PORT%25%22%2C%0A%20%20%20%20%20%20%20%20%22router.php%22%0A%20%20%20%20%20%20%5D%2C%0A%20%20%20%20%20%20%22enableForwardingHttpRequest%22%3A%20true%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ERequests%20response%20time%3A%3C%2FP%3E%0A%3CTABLE%20width%3D%22946px%22%3E%0A%3CTBODY%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22197.536px%22%3E%3CP%3EPreciseTimeStamp%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%2297.9286px%22%3E%3CP%3ECs_method%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22121.92px%22%3E%3CP%3ECs_uri_stem%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%2269.8929px%22%3E%3CP%3ES_port%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%2281.9464px%22%3E%3CP%3ESc_status%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22109.92px%22%3E%3CP%3ESc_substatus%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22134.911px%22%3E%3CP%3ESc_win32_status%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22130.946px%22%3E%3CP%3ETime_taken(ms)%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22197.536px%22%3E%3CP%3E2021-09-27%2006%3A28%3A45.1512587%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%2297.9286px%22%3E%3CP%3EGET%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22121.92px%22%3E%3CP%3E%2Fapi%2Ffunction1%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%2269.8929px%22%3E%3CP%3E443%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%2281.9464px%22%3E%3CP%3E200%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22109.92px%22%3E%3CP%3E0%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22134.911px%22%3E%3CP%3E0%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22130.946px%22%3E%3CP%3E50027%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22197.536px%22%3E%3CP%3E2021-09-27%2006%3A28%3A45.1722946%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%2297.9286px%22%3E%3CP%3EGET%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22121.92px%22%3E%3CP%3E%2Fapi%2Ffunction1%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%2269.8929px%22%3E%3CP%3E443%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%2281.9464px%22%3E%3CP%3E200%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22109.92px%22%3E%3CP%3E0%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22134.911px%22%3E%3CP%3E0%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22130.946px%22%3E%3CP%3E73530%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22197.536px%22%3E%3CP%3E2021-09-27%2006%3A29%3A45.1965994%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%2297.9286px%22%3E%3CP%3EGET%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22121.92px%22%3E%3CP%3E%2Fapi%2Ffunction1%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%2269.8929px%22%3E%3CP%3E443%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%2281.9464px%22%3E%3CP%3E200%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22109.92px%22%3E%3CP%3E0%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22134.911px%22%3E%3CP%3E0%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22130.946px%22%3E%3CP%3E123586%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22197.536px%22%3E%3CP%3E2021-09-27%2006%3A30%3A45.2202146%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%2297.9286px%22%3E%3CP%3EGET%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22121.92px%22%3E%3CP%3E%2Fapi%2Ffunction1%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%2269.8929px%22%3E%3CP%3E443%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%2281.9464px%22%3E%3CP%3E200%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22109.92px%22%3E%3CP%3E0%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22134.911px%22%3E%3CP%3E0%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22130.946px%22%3E%3CP%3E173613%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22197.536px%22%3E%3CP%3E2021-09-27%2006%3A31%3A45.2311004%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%2297.9286px%22%3E%3CP%3EGET%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22121.92px%22%3E%3CP%3E%2Fapi%2Ffunction1%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%2269.8929px%22%3E%3CP%3E443%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%2281.9464px%22%3E%3CP%3E200%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22109.92px%22%3E%3CP%3E0%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22134.911px%22%3E%3CP%3E0%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22130.946px%22%3E%3CP%3E223630%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22197.536px%22%3E%3CP%3E2021-09-27%2006%3A31%3A45.2390925%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%2297.9286px%22%3E%3CP%3EGET%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22121.92px%22%3E%3CP%3E%2Fapi%2Ffunction1%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%2269.8929px%22%3E%3CP%3E443%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%2281.9464px%22%3E%3CP%3E500%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22109.92px%22%3E%3CP%3E121%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22134.911px%22%3E%3CP%3E0%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22130.946px%22%3E%3CP%3E230002%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22197.536px%22%3E%3CP%3E2021-09-27%2006%3A32%3A45.3702086%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%2297.9286px%22%3E%3CP%3EGET%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22121.92px%22%3E%3CP%3E%2Fapi%2Ffunction1%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%2269.8929px%22%3E%3CP%3E443%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%2281.9464px%22%3E%3CP%3E500%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22109.92px%22%3E%3CP%3E121%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22134.911px%22%3E%3CP%3E0%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22130.946px%22%3E%3CP%3E230001%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22197.536px%22%3E%3CP%3E2021-09-27%2006%3A33%3A45.4016691%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%2297.9286px%22%3E%3CP%3EGET%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22121.92px%22%3E%3CP%3E%2Fapi%2Ffunction1%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%2269.8929px%22%3E%3CP%3E443%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%2281.9464px%22%3E%3CP%3E500%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22109.92px%22%3E%3CP%3E121%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22134.911px%22%3E%3CP%3E0%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22130.946px%22%3E%3CP%3E230003%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22197.536px%22%3E%3CP%3E2021-09-27%2006%3A34%3A45.4178058%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%2297.9286px%22%3E%3CP%3EGET%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22121.92px%22%3E%3CP%3E%2Fapi%2Ffunction1%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%2269.8929px%22%3E%3CP%3E443%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%2281.9464px%22%3E%3CP%3E500%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22109.92px%22%3E%3CP%3E121%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22134.911px%22%3E%3CP%3E0%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22130.946px%22%3E%3CP%3E230005%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3C%2FTBODY%3E%0A%3C%2FTABLE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%225%22%3ERoot%20Cause%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3EIf%20you%20get%20back%20and%20check%20my%20host.json%20again%2C%20you%20will%20notice%20that%20I%20am%20launching%20a%20PHP%20built-in%20web%20server%20with%20the%20help%20of%20Azure%20Functions%20custom%20handlers.%26nbsp%3BThe%20web%20server%20runs%20only%20one%20single-threaded%20process%2C%20so%20PHP%20applications%20will%20stall%20if%20a%20request%20is%20blocked.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3Ephp%20-S%20127.0.0.1%3A%25FUNCTIONS_CUSTOMHANDLER_PORT%25%20router.php%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOne%20doc%20you%20may%20reference%3A%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fwww.php.net%2Fmanual%2Fen%2Ffeatures.commandline.webserver.php%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Fwww.php.net%2Fmanual%2Fen%2Ffeatures.commandline.webserver.php%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%225%22%3EWhat%20I%20can%20do%3C%2FFONT%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EIf%20one%20insists%20on%20using%20Azure%20Functions%20in%20his%2Fher%20design%2C%20then%20he%2Fshe%20may%20leverage%20environmental%20variable%20%E2%80%98PHP_CLI_SERVER_WORKERS%E2%80%99%20and%20set%20up%20a%20large%20number%20to%20achieve%20concurrency.%20This%20feature%20is%20only%20provided%20by%26nbsp%3BPHP7.4%20on%20linux.%20But%20%3CSTRONG%3EPHP7.4%3C%2FSTRONG%3E%20on%20%3CSTRONG%3Elinux%3C%2FSTRONG%3E%20is%20not%20available%20on%20current%20linux%20plan%2C%20one%20needs%20to%20run%20his%2Fher%20function%20app%20in%20a%20custom%20linux%20container%20which%20has%20built%20that%20has%20PHP%20installed.%20Please%20note%2C%20even%20though%20it%20can%20achieve%20certain%20concurrency%20with%20multiple%20PHP%20processes%2C%20but%20it%20still%20not%20recommended%20to%20use%20in%20production%20environment%20due%20to%20limited%20performance.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EAttach%20the%20Dockerfile%20below%20to%20your%20reference.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3E%23%20To%20enable%20ssh%20%26amp%3B%20remote%20debugging%20on%20app%20service%20change%20the%20base%20image%20to%20the%20one%20below%0AFROM%20mcr.microsoft.com%2Fazure-functions%2Fdotnet%3A3.0-appservice%20%0AENV%20AzureWebJobsScriptRoot%3D%2Fhome%2Fsite%2Fwwwroot%20%5C%0A%20%20%20%20AzureFunctionsJobHost__Logging__Console__IsEnabled%3Dtrue%0A%0A%23COPY%20--from%3Dinstaller-env%20%5B%22%2Fhome%2Fsite%2Fwwwroot%22%2C%20%22%2Fhome%2Fsite%2Fwwwroot%22%5D%0A%0ARUN%20apt%20-y%20install%20lsb-release%20apt-transport-https%20ca-certificates%20%0ARUN%20wget%20-O%20%2Fetc%2Fapt%2Ftrusted.gpg.d%2Fphp.gpg%20https%3A%2F%2Fpackages.sury.org%2Fphp%2Fapt.gpg%0ARUN%20echo%20%22deb%20https%3A%2F%2Fpackages.sury.org%2Fphp%2F%20%24(lsb_release%20-sc)%20main%22%20%7C%20tee%20%2Fetc%2Fapt%2Fsources.list.d%2Fphp.list%0ARUN%20apt%20update%20%26amp%3B%26amp%3B%20apt%20install%20php7.4%20-y%0A%0A%0ACOPY%20.%20%2Fhome%2Fsite%2Fwwwroot%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EThe%20best%20option%20is%20to%20switch%20to%20PHP%20web%20app%20instead%20of%20Azure%20Functions%20with%20custom%20handler.%20In%20that%20way%2C%20the%20PHP%20module%20launched%20by%20Apache%2FNginx%20server%20could%20handle%20the%20API%20requests%20concurrently.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2836495%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20Functions%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Ephp%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Co-Authors
Version history
Last update:
‎Oct 13 2021 08:17 PM
Updated by: