Menu

Why your Laravel deploy still serves the old code (and how to fix OPcache)
📰

Why your Laravel deploy still serves the old code (and how to fix OPcache)

DEV Community: laravel·Amjad Iqbal·12 days ago
#4RdvuJqG
#devtolaravel#devto#dev#kiln#opcache
Reading 0:00
15s threshold

You ship a release. The files on the server are new. The site still behaves like the old version.

What is going on

The recommended production setting is opcache.validate_timestamps=0. PHP then never checks whether a file changed, so it keeps serving the compiled bytecode of the previous release until the process pool restarts.

The obvious fix, resetting OPcache from an Artisan command, does not work. The CLI and the FPM worker pool do not share the same OPcache, so the command resets a cache that your visitors never touch.

The fix

I built Kiln, a small package that adds four commands: kiln:clear, kiln:warm, kiln:status and kiln:config.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.