# Can't get data from php agent inside a container

**URL:** <https://discuss.elastic.co/t/cant-get-data-from-php-agent-inside-a-container/320202>\
**Category:** APM\
**Tags:** docker, php\
**Created:** [December 1, 2022, 2:13am UTC](https://discuss.elastic.co/t/cant-get-data-from-php-agent-inside-a-container/320202 "2022-12-01T02:13:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ElasticLiver](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elasticliver/32/64869_2.png) [@ElasticLiver](https://discuss.elastic.co/u/ElasticLiver)\
**Post date:** [December 1, 2022, 2:13am UTC](https://discuss.elastic.co/t/cant-get-data-from-php-agent-inside-a-container/320202/1 "2022-12-01T02:13:12Z")

</div>

**Kibana version** : 7.17.5

**Elasticsearch version** : 7.17.5

**APM Server version** : 7.17.5

**APM Agent language and version** : 1.6.2

**Original install method (e.g. download page, yum, deb, from source, etc.) and version**: Curl from "[https://github.com/elastic/apm-agent-php/releases/download/v1.6.2/apm-agent-php\_1.6.2\_all.deb](https://github.com/elastic/apm-agent-php/releases/download/v1.6.2/apm-agent-php_1.6.2_all.deb)

**Fresh install or upgraded from other version?** fresh

**Is there anything special in your setup?** the apm-server is installed as a service in the host, and the agent is installed on docker  
**Description of the problem including expected versus actual behavior. Please include screenshots (if relevant)**: No data has been received from agents yet.

deleted and prune all older images and containers, docker-compose build, and docker-compose up.

message in container build:

```auto
Preparing to unpack /tmp/apm-agent-php.deb ...
Unpacking apm-agent-php (1.6.2) ...
Setting up apm-agent-php (1.6.2) ...
Installing Elastic PHP agent
DEBUG: after-install parameter is 'configure'
Detected PHP version '8.1'
Creating /opt/elastic/apm-agent-php/etc/elastic-apm.ini
; *****DO NOT EDIT THIS FILE*****
; THIS IS AN AUTO-GENERATED FILE by the Elastic PHP agent post-install.sh script
; To overwrite the INI settings for this extension, edit
; the INI file in this directory "/opt/elastic/apm-agent-php/etc/elastic-apm-custom.ini"
[elastic]
extension=/opt/elastic/apm-agent-php/extensions/elastic_apm-20210902.so
elastic_apm.bootstrap_php_part_file=/opt/elastic/apm-agent-php/src/bootstrap_php_part.php
; END OF AUTO-GENERATED by the Elastic PHP agent post-install.sh script
/opt/elastic/apm-agent-php/etc/elastic-apm.ini created
Configuring elastic-apm.ini for supported SAPI's
Found SAPI config directory: /usr/local/etc/php/conf.d
Linking /opt/elastic/apm-agent-php/etc/elastic-apm.ini to /usr/local/etc/php/conf.d/98-elastic-apm.ini
Linking /opt/elastic/apm-agent-php/etc/elastic-apm-custom.ini to /usr/local/etc/php/conf.d/99-elastic-apm-custom.ini
Extension enabled successfully for Elastic PHP agent
Removing intermediate container 468d9bba87ee
 ---> 71b1c79e5d5b

Successfully built 71b1c79e5d5b
Successfully tagged elastic-apm_php:latest

```

APM server shows up in kibana

This is my docker-compose.yml

```auto
version: '3'
services:
  elasticsearch:
    image: 'docker.elastic.co/elasticsearch/elasticsearch:7.17.5'
    container_name: elasticsearch
    environment:
      - bootstrap.memory_lock=true
      - ES_JAVA_OPTS=-Xms512m -Xmx512m
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - './elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml'
      - './volume/elasticsearch:/usr/share/elasticsearch/data'
    ports:
      - '9200:9200'
    networks:
      - elastic
  kibana:
    image: 'docker.elastic.co/kibana/kibana:7.17.5'
    container_name: kibana
    ports:
      - '5601:5601'
    environment:
      ELASTICSEARCH_URL: 'http://elasticsearch:9200'
      ELASTICSEARCH_HOSTS: 'http://elasticsearch:9200'
    networks:
      - elastic
  web:
    image: 'nginx:latest'
    container_name: nginx
    ports:
      - '8089:80'
    volumes:
      - './nginx.conf:/etc/nginx/conf.d/nginx.conf'
      - './app:/app'
  php:
    build:
      context: .
      dockerfile: PHP.Dockerfile
    container_name: php
    volumes:
      - './app:/app'
  mysql:
    image: 'mariadb:latest'
    container_name: mysql
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_PASSWORD: root
      MYSQL_DATABASE: world
    volumes:
      - 'mysqldata:/var/lib/mysql'
      - './world.sql:/docker-entrypoint-initdb.d/world.sql'
    ports:
      - '3306:3306'
volumes:
  mysqldata:

networks:
  elastic:
    driver: bridge

```

And the docker file:

```auto
FROM php:fpm
RUN docker-php-ext-install pdo pdo_mysql
RUN pecl install xdebug && docker-php-ext-enable xdebug

RUN apt-get -y update
RUN apt-get update && apt-get install -y procps
RUN apt-get install -y git libcurl4-openssl-dev
RUN curl -L "https://github.com/elastic/apm-agent-php/releases/download/v1.6.2/apm-agent-php_1.6.2_all.deb" > /tmp/apm-agent-php.deb && \
  dpkg -i /tmp/apm-agent-php.deb && \
  rm /tmp/apm-agent-php.deb

```

---

<div class="post-metadata">

**Author:** ![Peter\_Elastic](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/peter_elastic/32/91235_2.png) [@Peter\_Elastic](https://discuss.elastic.co/u/Peter_Elastic)\
**Post date:** [December 4, 2022, 10:27am UTC](https://discuss.elastic.co/t/cant-get-data-from-php-agent-inside-a-container/320202/2 "2022-12-04T10:27:52Z")

</div>

Hi.

Do you also set some php.ini files to communicate the data to the APM server?

```auto
elastic_apm.server_url="http://link-to-apm-server-or-container.ext:port"
elastic_apm.secret_token="Your uber secret token"
elastic_apm.service_name="Name of Application"
elastic_apm.environment="staging"

```

There is also an APM container needed to receive the data. Do you have to running also?

---

<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:** [December 25, 2022, 6:28am UTC](https://discuss.elastic.co/t/cant-get-data-from-php-agent-inside-a-container/320202/3 "2022-12-25T06:28:46Z")

</div>

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