Symfony 3.4 - "Unable to write in the cache directory (var/cache/prod)" error occurs randomly every few days/hours
05:10 11 Nov 2025

I'm using Symfony 3.4.36 and experiencing a recurring cache issue where randomly every few days or hours, the application stops working with this error on screen:
Unable to write in the cache directory (var/cache/prod)

Current Behavior:

  1. The application works fine for several days

  2. Suddenly displays the cache write error

  3. When I rename var/cache/prod to prod2 and refresh, Symfony generates a new prod folder

  4. Application works again temporarily, but the issue recurs

Environment Details:

  • Shared hosting environment

  • Cache folder permissions: drwxr-xr-x 9 agenc agenc 4096 Nov 10 14:15 prod (after the prod folder has been generated automatically as mentioned in step 3)

The issue is completely random - sometimes it happens after days, sometimes after hours. The temporary fix works but doesn't provide a permanent solution.
Has anyone experienced similar random cache write issues in Symfony? What could be causing the cache directory to suddenly become unwritable, and what permanent solutions should I investigate?

symfony caching file-permissions production-environment symfony3