# \[apm-agent-php\] Crash PHP application after enable APM agent

**URL:** <https://discuss.elastic.co/t/apm-agent-php-crash-php-application-after-enable-apm-agent/284543>\
**Category:** APM\
**Tags:** docker, php\
**Created:** [September 18, 2021, 12:59pm UTC](https://discuss.elastic.co/t/apm-agent-php-crash-php-application-after-enable-apm-agent/284543 "2021-09-18T12:59:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![quan.vo.zalora](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/quan.vo.zalora/32/94747_2.png) [@quan.vo.zalora](https://discuss.elastic.co/u/quan.vo.zalora)\
**Post date:** [September 18, 2021, 12:59pm UTC](https://discuss.elastic.co/t/apm-agent-php-crash-php-application-after-enable-apm-agent/284543/1 "2021-09-18T12:59:35Z")

</div>

I'm installing `apm-agent-php` by adding a script to my Dockerfile

```auto
RUN apk --no-cache add curl-dev gcc g++ make autoconf && \
  mkdir -p /etc/apm-agent && \
  curl -L "https://github.com/elastic/apm-agent-php/archive/refs/tags/v1.2.tar.gz" > /tmp/apm-agent.tar.gz && \
  tar -zxvf /tmp/apm-agent.tar.gz -C /etc/apm-agent --strip-components 1 && \
  cd /etc/apm-agent/src/ext && \
  phpize && \
  CFLAGS="-std=gnu99" ./configure --enable-elastic_apm && \
  make && \
  make install && \
  rm /tmp/apm-agent.tar.gz

```

Then enable in `php.ini` file

```auto
extension="elastic_apm.so"
elastic_apm.bootstrap_php_part_file=/etc/apm-agent/src/bootstrap_php_part.php
elastic_apm.environment= __elastic_apm_env__
elastic_apm.enabled= __elastic_apm_enabled__
elastic_apm.server_url= __elastic_apm_server_url__
elastic_apm.service_name= __elastic_apm_service_name__
elastic_apm.secret_token= __elastic_apm_secret__
elastic_apm.transaction_sample_rate=0.1
elastic_apm.transaction_max_spans=100
elastic_apm.server_timeout=50ms

```

After starting container, the agent can send data to APM server successfully, but after 5-6 times reload, server is crashed with error

```auto
 child 17 exited on signal 11 (SIGSEGV - core dumped) after 33.225786 seconds from start

```

and can not access the website anymore.  
After 1-2min, I can access the website again, but after 4-5 times of reloading, the same issue occurs again.

The issue is not happen if `elastic_apm.enabled=false` (installed but not enable)

Note: Also try with other installing approaches by using APK package but got the same issue

```auto
RUN curl -L https://github.com/elastic/apm-agent-php/releases/download/v1.2/apm-agent-php_1.2_all.apk > /tmp/apm-agent-php.apk && \
  apk add --allow-untrusted /tmp/apm-agent-php.apk && \
  rm /tmp/apm-agent-php.apk

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 9, 2021, 9:00am UTC](https://discuss.elastic.co/t/apm-agent-php-crash-php-application-after-enable-apm-agent/284543/2 "2021-10-09T09:00:26Z")

</div>

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.
