To monitor PHP applications deployed in AWS Elastic Beanstalk using Applications Manager, it is necessary to install both the APM Insight PHP Agent and the Applications Manager Data Exporter during the deployment process. This can be automated by adding a custom configuration script inside the .ebextensions directory of your application bundle.
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/apm-php-agent.sh":
mode: "000755"
owner: root
group: root
content: |
#!/bin/sh
export $(cat /opt/elasticbeanstalk/deployment/env | xargs)
wget -O InstallDataExporter.zip https://www.manageengine.com/products/applications_manager/54974026/InstallDataExporter.zip && unzip InstallDataExporter.zip
sh InstallDataExporter.sh
wget -O InstallAgentPHP.zip https://www.manageengine.com/products/applications_manager/54974026/InstallAgentPHP.zip && unzip InstallAgentPHP.zip
sh InstallAgentPHP.sh
commands:
apm_php_agent:
command: "sh /opt/elasticbeanstalk/hooks/appdeploy/post/apm-php-agent.sh" 
It allows us to track crucial metrics such as response times, resource utilization, error rates, and transaction performance. The real-time monitoring alerts promptly notify us of any issues or anomalies, enabling us to take immediate action.
Reviewer Role: Research and Development