How can I fix a 504 timeout issue in Azure App Service while deploying a CakePHP 2 application?

salman 20 Reputation points
2025-04-18T09:57:29.8566667+00:00

Hi,

I previously deployed a CakePHP 2 application on Azure App Service, and it was working fine. Recently, we made some changes to the bootstrap.php and AmsController.php files to integrate Azure Blob Storage and Key Vault keys.

After redeploying and reloading the application, it started hanging during load and returned a 504 Gateway Timeout error. The application log file is not being updated, but the Azure log stream shows the following log output (attached below).

we reverted that 2 files (bootstrap.php and AmsController.php) still facing same issue.

Azure App service - Web

OS - Linux

Could you please help us identify the issue and suggest a fix?

AzureLog.txt

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,789 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Alekhya Vaddepally 1,340 Reputation points Microsoft External Staff Moderator
    2025-04-18T13:34:21.8866667+00:00

    Hi salman,

    1. From the SSH terminal, run the entry point manually and check the Errors. If there is a syntax or a runtime error, it will appear here.
    2. If the process is hanging, it means that there is something blocked in the bootstrap (or CAKEPHP dispatcher).
    3. if you rolled the bootstrap back, integration can still be referred to elsewhere, or:
    4. Cashed configurations/Auth tokens can be invalid.
    5. The app may still try to reach those services during the load.
    6. Try to check:
      Any key related to environmental variables - azure_*, blob_*, keyvault_*, etc. Network Settings - If your app is in service VNET, make sure that DNS resolution and firewall rules are not blocking Azure service traffic. Try to remove those services from your environment temporarily to separate this issue.
    7. This is a great way of troubleshooting without affecting your main slot: Go to app service → add the deployment slot → slot.
    8. Clone your current configuration and deploy a barebones version of your app (no Azure service, no heavy boot logic). See what the new slot works, If it loads fine, the problem is in the current environment or code of your app.
    9. Make sure logging is enabled so you can catch PHP errors:
      App Service → Logs
      • Application Logging (Filesystem): On
      • Web Server Logging: On
      • Detailed Error Messages: On

    Check output via Log Stream or directly from /home/LogFiles.

    if you have any further concerns or queries, please feel free to reach out to us.

    0 comments No comments

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.