Live Blog

Debugging REST API admin-ajax.php (MySQL Queries and PHP functions)

Introduction

When there are admin-ajax.php queries that take a substantial amount of time, there is no easy way to debug these requests.

Debugging admin-ajax.php Options

Query Monitor

You’d think that installing the Query Monitor plugin would work, however this isn’t yet functional.

WIP: Implement client side rendering by johnbillion · Pull Request #483 · johnbillion/query-monitor · GitHub
This starts us down the path of switching over Query Monitor’s output to client-side rendered React components. This has numerous benefits including: Better performance (no need to render a big pi…
github.com

Newrelic

You can always install Newrelic, since it’s a PHP module it will capture all PHP executions.

Xdebug

Same as newrelic, you can use xdebug as it’s a PHP module.

apt-get install php8.0-xdebug
# check if file exists
vi /etc/php/8.0/fpm/conf.d/20-xdebug.ini
# add
xdebug.mode = debug, profile
xdebug.start_with_request = trigger
# restart service
service php8.0-fpm restart

Conclusion

This page is a placeholder until I can document it further. Comment if you have better ideas.

0 Shares: