PHP 8.2 XDebug Issue

Working on a SaaS project developed in PHP 8.2 that was put on pause for a months. I copied some of our old PHP 8.0 xdebug settings into our FPM pool without thinking about it while working on some WordPress projects.

We have a dedicated development server where we SSH into with VSCode (sometimes Samba) on the same network. We utilize nginx as the webserver and different PHP versions depending on the project and while we try to mimic a production environment, we have some settings enabled for debugging purposes.

Returned back to testing out the SaaS project for an upcoming meeting and learned that our API calls that used to be complete within 100 milliseconds (give or take), we are now taking up upto 4 minutes for simple database calls. I was extremely confused why these calls would all of a sudden take so long to complete without any codebase changes. The TTFB was taking up the most time with the sending of data only taking milliseconds through Postman.

I went into detective mode with trying to rule out simple issues like restarting our development server, restarting our router, my development machine, checking to see if certain PHP settings like output_buffering would change things.

Finally, began poking around with the FPM pool settings, I reduced the xdebug settings that I previously copied from our PHP 8.0 pool by half. Not sure why these never caused any issues with our PHP 8.0 development. I do realize the values that were set were definitely overkill for debugging.

Below is the previous and new values set in our FPM pool that reduced our time-to-first-byte. It is worth noting that the PHP 8.2 pool configuration did not have any definitions set for XDebug before I modified it weeks ago.

Before

php_admin_value[xdebug.var_display_max_depth] = 20
php_admin_value[xdebug.var_display_max_children] = 256
php_admin_value[xdebug.var_display_max_data] = 2048

After

php_admin_value[xdebug.var_display_max_depth] = 10
php_admin_value[xdebug.var_display_max_children] = 64
php_admin_value[xdebug.var_display_max_data] = 1024

I suspect the new settings are still overkill but they work for now. Might adjust them down the road.

Hopefully this will help anyone having TTFB issues on a PHP project through a local network. Please realize that TTFB issues may have multiple or different causes. It definitely depends on your server configuration, network and routing settings, congestion and your codebase.

Join my Newsletter

Sign up to get the occasional email regarding security updates, tricks and news about the landscape of Web Development.

Back to top of page