PHP APM with Docker
  • 1 Minute to read
  • Dark
  • PDF

PHP APM with Docker

  • Dark
  • PDF

Article summary

This document details how to install the PHP APM Profiler in your PHP application running on Docker or Docker Swarm.


Follow the Retrace Docker Install Guide.

PHP Docker Setup

Dockerfile Configuration

Adjust your Dockerfile to include the PHP Profiler:

RUN mkdir -p /stackify-php-apm && \
    cd /stackify-php-apm && \
    wget;  tar -zxvf stackify-php-apm-latest.tar.gz; rm stackify-php-apm-latest.tar.gz && \

RUN echo "[stackify]" >> [php_dir]/php.ini && \
   echo "" >> [php_dir]/php.ini && \
   echo "stackify.application_name=PHP Application" >>  [php_dir]/php.ini && \
   echo "stackify.environment_name=Production" >>  [php_dir]/php.ini

Adjust [php_dir] to point to your PHP configuration path.

Running your Application

Start your application with the stackify shared volume.

docker run -v stackify:/usr/local/stackify [your-application-image] 


Start up your PHP application container and make requests. You can then verify results in the Retrace dashboard.

Additional Guides

Was this article helpful?