A regex can match a redirect source while leaving $1 untouched. Learn how custom PHP redirect handlers should perform capture substitution, validate destinations, and test the final response.
Category Archives: PHP
How to Trace a Slow PHP Request to the Actual SQL Query
Learn how to correlate PHP-FPM access and slow logs with a database slow-query log to find the SQL behind a slow request.
How to Roll Out Migrations Across Separate Tenant Databases
A separate database per tenant improves isolation, but schema changes must be applied to every tenant deliberately and safely.
How to Add a PHP Enum Cast Without Breaking Existing Logic
A safe pattern for adding Laravel enum casts: inspect the existing enum, update model consumers, and verify hydration and serialization.
Why Arabic Text Needs More Than an Arabic Font in Generated Images
Arabic text in generated images needs both a compatible font and proper shaping and right-to-left handling. Here is how to diagnose and fix each layer.
How to Wrap Mixed CJK and English Text in Generated Images
The main lesson is simple: mixed Japanese, Chinese, Korean, and English text needs more than ordinary word wrapping. A reliable image renderer must choose a font with the right glyphs, preserve Latin words, allow CJK text to break between characters, and invalidate old cached images after the logic changes. Why normal wrapping fails English text Continue reading “How to Wrap Mixed CJK and English Text in Generated Images”
Why PHP Can Keep Running Old Code After Deployment
A deployment can update PHP files while OPcache keeps serving older compiled code. Learn how to identify and fix the mismatch safely.
How to Reduce Peak Memory in PHP GD Image Generation
What I learned about preventing PHP GD memory errors by releasing intermediate images as soon as they are no longer needed.
How to Fix Composer’s “Could Not Find a Version Matching Your Minimum-Stability” Error
Learn why Composer rejects development-only packages in stable projects and how to fix the problem safely with version constraints or semantic version tags.
How to Troubleshoot a Laravel Passport OAuth Authorization 500 Error
Diagnose and fix a Laravel Passport OAuth authorization endpoint that returns HTTP 500 by checking signing keys, permissions, migrations, caches, and logs.
