KCachegrind
A Docker image for the KCachegrind profiling tool with browser accessibility, which can be used in conjunction with Xdebug to view PHP profiling data.
Setup
docker-compose-kcachegrind.yml
version: "3.9"
services:
nginx-xdebug:
image: wodby/nginx:1.19
environment:
NGINX_VHOST_PRESET: php
NGINX_BACKEND_HOST: xdebug
NGINX_SERVER_ROOT: /var/www/html/public
ports:
- 8000:80
volumes:
- app:/var/www/html
depends_on:
- xdebug
xdebug:
image: wodby/php:8.1-dev
environment:
PHP_DEBUG: true
PHP_XDEBUG: true
PHP_XDEBUG_MODE: profile
expose:
- 9000:9000
volumes:
- app:/var/www/html
- xdebug:/mnt/files/xdebug
kcachegrind:
image: ghcr.io/nedix/kcachegrind-docker
ports:
- 8001:8080
volumes:
- app:/var/www/html
- xdebug:/data/xdebug
depends_on:
- xdebug
networks:
default:
driver: bridge
volumes:
app:
driver: local
driver_opts:
device: ${PWD}
o: bind
type: none
xdebug:
driver: local
Usage
Step 1.
Start the containers:
docker compose -f docker-compose.yml -f docker-compose-kcachegrind.yml up -d
Step 2.
Navigate to your page on localhost:8000 to capture the profiling data.
Step 3.
Find KCachegrind on localhost:8001.