To install APM Insight PHP agent in Linux operating system, follow the below given instructions:
For Linux :
$ cd /opt
$ wget https://www.manageengine.com/products/applications_manager/54974026/agent_php.zip
$ unzip agent_php.zip
For ARM :
$ cd /opt
$ wget https://www.manageengine.com/products/applications_manager/54974026/agent_php_arm.zip
$ unzip agent_php_arm.zip
For ALPINE :
$ cd /opt
$ wget https://www.manageengine.com/products/applications_manager/54974026/agent_php_alpine.zip
$ unzip agent_php_alpine.zip
$ cd zpa/bin
$ sudo sh configure.sh [LICENSE KEY] [HOSTNAME] [APPLICATION NAME]
where,
[LICENSE KEY]
- License key from Applications Manager. (mandatory)
[HOSTNAME]
- Hostname of the Applications Manager. (mandatory)
[APPLICATION NAME]
- Monitor name to be shown in the Applications Manager console. By default, it is set to PHP-Application. (optional)
For PHP agent versions below 2.9.3:
apm.host=[HOST-NAME]
apm.port=[HOST-PORT]
use.https=[true/false]
For PHP agent versions 2.9.3 and above:
apm.host=[HOST-NAME]
apm.port=[HOST-PORT]
apm.protocol.https=[true/false]
For PHP agent versions below 2.9.3:
apm.host=localhost
apm.port=8443
use.https=true
For PHP agent versions 2.9.3 and above:
apm.host=localhost
apm.port=8443
apm.protocol.https=true
After including the required keys, save and close the file.
$ sh run.sh restart
#For Apache servers,
$ sudo service apache2 restart
#For FPM servers,
$ sudo service php-fpm restart
After the installation, go to the terminal and execute the following command:
$ php -m | grep zpa
The output should contain zpa.
Note:
The agent does not restart automatically during server reboots. To start, stop or restart the agent, use the following commands:
$ cd /opt/zpa/bin
#Start the agent
$ sh run.sh start
#Stop the agent
$ sh run.sh stop
#Restart the agent
$ sh run.sh restart
#For systemd supported OS, use the following command to restart:
$ service zpdpsvc restart
If PHP is installed using third-party managed services, like cPanel/WHM, or if the PHP path is not set properly during the installation, you might get the following message: PHP is not found in PATH. Kindly install PHP or add PHP installation directory to PATH!
In these cases, you can retry the installation after setting the correct PHP directory in the PATH variable, or you can proceed to configure the agent manually, using these steps:
wget https://www.manageengine.com/products/applications_manager/54974026/agent_php.zip
wget https://www.manageengine.com/products/applications_manager/54974026/agent_php_arm.zip
wget https://www.manageengine.com/products/applications_manager/54974026/agent_php_alpine.zip
sudo unzip -d /opt/ agent_php.zip
php -i | grep "PHP API"
# Example output
PHP API => 20131226
php -i | grep "Scan this dir"
# Example output
# Scan this dir for additional .ini files => /opt/cpanel/ea-php56/root/etc/php.d/
cp /opt/zpa/bin/zpa.ini /opt/cpanel/ea-php56/root/etc/php.d/zpa.ini
extension=zpa.so
php -i | grep "extension_dir"
# Example output
# extension_dir => /opt/cpanel/ea-php56/root/usr/lib64/php/modules
cp /usr/lib/php/zpa20131226.so /opt/cpanel/ea-php56/root/usr/lib64/php/modules/zpa.so
# For Apache2 (Debian) sudo service apache2 restart
# For Apache2 (RHEL/CentOS) sudo service httpd restart
# For nginx/fpm based servers. sudo service php-fpm restart
php -i | grep zpa
#Example output
#zpa
#zpa.version => 3.0.2
#zpa.date => 7 May 2021
#zpa.capture_clirequest => 1 => 1
#zpa.capture_httphost => 0 => 0
#zpa.capture_phpself => 0 => 0
################### APM Insight Agent Configuration File ###################
#
license.key=<Enter_license_key_here>
#
cd /opt/zpa/bin
sudo sh run.sh start
# To verify the status
# ps -ef | grep zpdp
While creating container images, add these commands to the Docker files used for image creation as follows:
For Linux:
RUN cd /opt/ && wget
https://www.manageengine.com/products/applications_manager/54974026/agent_php.zip
RUN unzip agent_php.zip
RUN cd /opt/zpa/bin && sh configure.sh<licensekey><hostname><app_name>
RUN sh run.sh start
For ARM:
RUN cd /opt/ && wget
https://www.manageengine.com/products/applications_manager/54974026/agent_php_arm.zip
RUN unzip agent_php_arm.zip
RUN cd /opt/zpa/bin && sh configure.sh<licensekey><hostname><app_name>
RUN sh run.sh start
For ALPINE:
RUN cd /opt/ && wget
https://www.manageengine.com/products/applications_manager/54974026/agent_php_alpine.zip
RUN unzip agent_php_alpine.zip
RUN cd /opt/zpa/bin && sh configure.sh<licensekey><hostname><app_name>
RUN sh run.sh start
Whenever the container is started, make sure zpdpsvc is restarted using the following command (under /opt/zpa/bin directory)
sh run.sh start
To automatically restart APM Insight PHP agent during system reboots, use the below given steps:
For systemd servers:
The agent will automatically start during server reboots for systemd supported Linux flavors.
For non systemd servers:
cd /opt/zpa/bin
sh run.sh restart