After you install the Application Real-Time Monitoring Service (ARMS) agent for a PHP application, ARMS starts to monitor the PHP application. You can view the monitoring data of the PHP application, such as the application topology, traces, abnormal transactions, slow transactions, and SQL analysis. This topic describes how to install the ARMS agent for PHP applications that are deployed on multiple servers in standalone mode.

Notice The PHP application monitoring feature is under maintenance. You cannot obtain the ARMS agent for PHP from the ARMS console. If you want to use ARMS to monitor PHP applications, you can join the DingTalk Q&A group for PHP application monitoring (group ID: 23328286) to learn how to add PHP applications for monitoring.

Install the ARMS agent

  1. Install the ARMS agent. For more information, see Install the ARMS agent for a PHP application.
  2. Edit the configuration file of Apache or NGINX.
    • For PHP applications that are deployed on multiple Apache servers in standalone mode, add php_value arms.app_name "<yourAppNewName>" to each VirtualHost. Replace <yourAppNewName> with the name of your PHP application. The following code provides an example:
      <VirtualHost *:80>
          ServerName www.example.com
          DocumentRoot /home/www/html
          php_value arms.app_name "example"
          <Directory "/home/www/html">
                Options FollowSymLinks
                AllowOverride All
                Require all granted
          </Directory>
      </VirtualHost>
      <VirtualHost *:80>
          ServerName www.test.com
          DocumentRoot /home/www/test
          php_value arms.app_name "test"
          <Directory "/home/www/test">
                Options FollowSymLinks
                AllowOverride All
                Require all denied
                Require all granted
          </Directory>
      </VirtualHost>
    • For PHP applications that are deployed on multiple NGINX servers in standalone mode, add fastcgi_param PHP_VALUE "arms.app_name=<yourAppNewName>" to the PHP-FPM configuration file of each server. Replace <yourAppNewName> with the name of your PHP application. The following code provides an example:
      server {
              listen       80;
              server_name  localhost;
              location / {
                          try_files $uri $uri/ /index.php?$query_string;
                  }
              error_page   500 502 503 504  /50x.html;
              location = /50x.html {
                  root   /usr/share/nginx/html;
              }
              location ~ \.php$ {
                  fastcgi_pass   localhost:9000;
                  fastcgi_index  index.php;
                  fastcgi_param  PHP_VALUE "arms.app_name=example"
                  fastcgi_param  SCRIPT_FILENAME  /var/www/html/$fastcgi_script_name;
                  include        fastcgi_params;
              }
          }
       server {
              listen       80;
              server_name  www.example.com;
              location / {
                          try_files $uri $uri/ /index.php?$query_string;
                  }
              error_page   500 502 503 504  /50x.html;
              location = /50x.html {
                  root   /usr/share/nginx/html;
              }
              location ~ \.php$ {
                  fastcgi_pass   localhost:9000;
                  fastcgi_index  index.php;
                  fastcgi_param  PHP_VALUE "arms.app_name=test"
                  fastcgi_param  SCRIPT_FILENAME  /var/www/test/$fastcgi_script_name;
                  include        fastcgi_params;
              }
          }
    Wait for about 1 minute. In the ARMS console, choose Application Monitoring > Applications. If your application is displayed with the name of custom <yourAppName>, the probe is installed.

Uninstall the ARMS agent

  1. Delete the content that you added to the php.ini file in Step 7 in Install the ARMS agent for a PHP application or delete the arms.ini file.
  2. Delete the content that you added to the Apache or NGINX configuration file in Step 2 of this topic.
  3. Restart the service.
    • If you are using an NGINX server, restart the PHP-FPM service.
    • If you are using an Apache server, restart the Apache2 service.
  4. Run the following commands to stop and uninstall the Hercules service:
    sudo ./hercules service stop
    sudo ./hercules service uninstall
  5. Run the following command to delete the directory of the ARMS agent:
    sudo rm -rf /usr/local/arms/arms-php-agent
    You have uninstalled the ARMS agent for the PHP application.