Skip to content

Instantly share code, notes, and snippets.

@patrick-lienau
Last active July 24, 2024 14:45
Show Gist options
  • Save patrick-lienau/d835428ab41f65321752c86cbb290fda to your computer and use it in GitHub Desktop.
Save patrick-lienau/d835428ab41f65321752c86cbb290fda to your computer and use it in GitHub Desktop.
Flame graph profiling for wordpress in lando

image

This assunmes you're running wp in lando with php >= 8

in ./lando.local.yml

services:
  appserver:
    build_as_root:
      - pecl install xhprof && echo "extension=xhprof.so" > $PHP_INI_DIR/conf.d/xhprof.ini

in ./.vscode/php.ini

extension=xhprof.so
xhprof.sampling_interval=1000

Then run lando rebuild -y

at the top of ./web/wp-config.php

ini_set('xhprof.sampling_interval', 1000);
xhprof_sample_enable();

intall Query Monitor plugin

https://wordpress.org/plugins/query-monitor/

install Flamegraph Query Monitor extension

https://github.com/humanmade/query-monitor-flamegraph (I don't think this is on the store, I had to download zip & paste it in ./web/wp-contents/plugins)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment