---
title: "PHP APM with Kubernetes"
slug: "php-apm-with-kubernetes"
description: "Learn how to install PHP APM Profiler on Kubernetes for efficient application monitoring. Verify results on Retrace dashboard."
updated: 2019-05-21T14:02:29Z
published: 2019-05-21T14:02:29Z
---

> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stackify.com/llms.txt
> Use this file to discover all available pages before exploring further.

# PHP APM with Kubernetes

This document details how to install the **PHP APM Profiler** in your **PHP** application running on **Kubernetes**.

## Prerequisite

Follow the [Retrace Kubernetes Install](https://docs.stackify.com/docs/retrace-kubernetes-install) Guide.

## PHP Kubernetes Setup

#### Dockerfile Configuration

Adjust your **Dockerfile** to include the PHP Profiler.

```
RUN mkdir -p /stackify-php-apm && \
    cd /stackify-php-apm && \
    wget https://download.stackify.com/stackify-php-apm/stackify-php-apm-latest.tar.gz;  tar -zxvf stackify-php-apm-latest.tar.gz; rm stackify-php-apm-latest.tar.gz && \
    ./install.sh

RUN echo "[stackify]" >> [php_dir]/php.ini && \
   echo "extension=stackify.so" >> [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.

#### Pod Configuration

Application containers are required to have the **stackify** volume mount configured in [Retrace Kubernetes Install](https://docs.stackify.com/docs/retrace-kubernetes-install).

Example Application Pod YAML:

```
apiVersion: v1
kind: ReplicationController
metadata:
  name: pod-name
spec:
  replicas: 1
  selector:
    app: app-name
  template:
    metadata:
      name: template-name
      labels:
        app: app-name
    spec:
      containers:
      - name: container-name
        image: application-image
        volumeMounts:
          - mountPath: /usr/local/stackify
            name: stackify
      volumes:
        - name: stackify
          hostPath: 
            path: /var/stackify
            type: DirectoryOrCreate
```

## Verify

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

## Additional Guides

- [Troubleshooting](https://docs.stackify.com/docs/php-apm-troubleshooting-guide)
- [Log / Deployment Tracking](https://docs.stackify.com/docs/php-getting-started)
