Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Winning at PHP in Production in 2025

Winning at PHP in Production in 2025

The basics high level things you should be doing in 2025 to run a PHP application in production to avoid outages, 503s and carelessly leave performance on the table.

Talk was presented at Shopware Unconference 2025 in Cologne.

Benjamin Eberlei

April 26, 2025
Tweet

More Decks by Benjamin Eberlei

Other Decks in Technology

Transcript

  1. Canonical Application Log Lines • https:/ /stripe.com/blog/canonical-log-l ines • key=value

    pairs in a text log • “Nginx/Apache log for Application”
  2. PHP-FPM • Prefer pool “static” • Calculate max_children based on

    available memory • https:/ /tideways.com/tools/fpm-configu ration-calculator
  3. CPU, I/O or Memory bound? • Watch Scheduler Statistics •

    https:/ /docs.kernel.org/scheduler/sche d-stats.html • If difference is 0 after request, no scheduling took place.
  4. Sessions • Default Filesystem handler does not scale beyond one

    application server • Be aware of Session locking
  5. Sessions • Default Filesystem handler does not scale beyond one

    application server • Locking of sessions
  6. File Storage • Avoid Network File System (NFS) for the

    whole application • only to share assets/files if you must
  7. Timeouts Reduce the connect timeouts of everything, defaults break your

    neck • default_socket_timeout ✅ • Redis default 5 seconds • cURL indefinitely waiting ◦ A
  8. Background Jobs • Use Symfony Messenger • Supervisord • Canonical

    log lines (again!) • Health Checks & Restart automatically
  9. High Availability PHP • Load Balancing in front of app

    servers • Web servers only run php-fpm • Independent worker and cron servers • Databases and caches have their servers • each system redundant or clustered if you want to avoid single point of failure