How to install the APM Insight PHP Agent in an Azure Web App?

How to install the APM Insight PHP Agent in an Azure Web App?

Follow these steps to install and configure the APM Insight PHP Agent in an Azure Web App.

Step 1: Create a deployment script

  1. Navigate to the directory /home/apm/ (create it if it doesn’t exist).
  2. Create a new shell script named apm-phpagent-deploy.sh in this location.
  3. Add the following contents to the script:
  1. #!/bin/sh

  2. apt update && apt install -y wget unzip procps 

  3. APM_LICENSE_KEY=YourAppManagerLicensekey
  4. APM_HOST=YourAppManagerHostname
  5. APM_PORT=YourAppManagerSSLPort
  6. ZPA_APPLICATION_NAME=YourApplicationName


  7. wget -O InstallDataExporter.sh https://www.manageengine.com/products/applications_manager/54974026/InstallDataExporter.sh
  8. sh InstallDataExporter.sh

  9. wget -O InstallAgentPHP.sh https://www.manageengine.com/products/applications_manager/54974026/InstallAgentPHP.sh
  10. sh InstallAgentPHP.sh

Note:
Replace YourAppManagerLicensekey with your Applications Manager license key.
Replace YourAppManagerHostname with your Applications Manager Hostname which open/allowed for communication.
Replace YourAppManagerSSLPort with your Applications Manager SSL port number which open/allowed for communication.
Replace YourApplicationName with your application name.

Step 2: Modify the Startup command

  1. Open the Azure Portal.
  2. Navigate to your Web App.
  3. Go to Settings -> Configuration.
  4. Under the General Settings tab, locate the Startup Command field.
  5. Enter the following command: /home/apm/apm-phpagent-deploy.sh


  1. Click Save.

Step 3: Restart the Web App

After updating the startup command:
  1. In the Azure Portal, navigate to your Web App.
  2. Click Restart.
  3. Then, Go to your Applications Manager -> APM tab and check if the application appears.