A Challenge to integrate APM with Laravel inside container

We had a need to integrate APM to php project. I have tried many ways and debug a lot but couldn’t get success.

My system using docker and container to setup a php, nginx server. We are using php 8.2, ubuntu 22.04 and required libraries.

We have added below solutions into my docker file.

So there are three ways we can integrate as I know.

  1. Using directly Debian (.deb) package.

dpkg -i <package-file>.deb

Error : PHP Startup: Unable to load dynamic library ‘/opt/elastic/apm-agent-php/extensions/elastic_apm-20220829.so….

  1. Using git and phpize.
    1. RUN apt install -y php-dev

RUN mkdir -p /home/apm-agent && \

cd /home/apm-agent && \

git clone https://github.com/elastic/apm-agent-php.git apm && \

ls -la apm && ls -la apm/agent/native/ext && \

cd apm/agent/native/ext && \

phpize && ./configure –enable-elastic_apm && \

make clean && make && make install

RUN COPY ./elastic_apm.ini /etc/php/8.2/cli/conf.d/elastic_apm.ini

Error :  No rule to make target ‘/home/apm-agent/apm/agent/native/ext/AST_debug.c’, needed by ‘AST_debug.lo’.  Stop

  1. Using git and make, docker way

Error :/bin/bash: line 1: docker: command not found,

Solution : Install docker but couldn’t get success

Conclusion : couldn’t get success.

A Failure …