PHP

· Lars Nielsen

Why I Didn't Use Symfony Messenger for a Shared Crawl Queue

In July my search engine needed a queue that several servers could share: crawlers on one machine putting fetched pages in, indexers on others taking them out. The project already depended on Symfony Messenger, and a Messenger transport DSN pointing at the database was even configured on one of the servers. Reusing it looked like the obvious move.

Read article Why I Didn't Use Symfony Messenger for a Shared Crawl Queue
· Lars Nielsen

Keyset Pagination Fixed a PHP Out-of-Memory Crash Loop That Docker Never Saw

In August, two background workers in my search engine had been crashing with PHP out-of-memory errors for about 20 hours before anyone noticed. Nothing looked wrong from the outside: docker ps showed the containers up, with a restart count of zero. What gave it away was that the whole fleet looked unusually loaded.

Read article Keyset Pagination Fixed a PHP Out-of-Memory Crash Loop That Docker Never Saw
· Lars Nielsen

MySQL LEAST() Compared My Numbers as Strings: PDO Parameters and a Backoff Cap That Didn't Cap

My search engine's crawler backed off from hosts that kept failing: each consecutive failure doubled the wait before the next attempt, up to a cap of one day. During one long working session in July, one test of that logic failed in every run, and it kept being written off as a "pre-existing, unrelated" failure.

Read article MySQL LEAST() Compared My Numbers as Strings: PDO Parameters and a Backoff Cap That Didn't Cap
· Lars Nielsen

Environment Variables Not Reaching PHP in GitHub Actions: setup-php, variables_order and php -S

When I moved CaRMen's Playwright tests into GitHub Actions, every login test failed. Partway through each test, the login page redirected to the first-run installer, as if the database were empty. It wasn't. The PHP backend wasn't looking at the database the job had set up at all, because it never saw the environment variables that pointed to it.

Read article Environment Variables Not Reaching PHP in GitHub Actions: setup-php, variables_order and php -S
· Lars Nielsen

Four Rounds of Hand-Editing a MySQL Migration Before SQLite Would Run It

The very first Doctrine migration in CaRMen's history — the one that creates the user and messenger_messages tables — was auto-generated against MySQL and never meant to run anywhere else. For a stretch of 2025 it had to run against SQLite too, because the test suite used SQLite while the actual migrations were written for MySQL.

Read article Four Rounds of Hand-Editing a MySQL Migration Before SQLite Would Run It
Subscribe to PHP