Does Supervisord process need restart after changes to Laravel file?
Stefan Bogdanescu
Founder & Senior Architect · 2026-06-29
Does Supervisord Process Need Restart After Changes to Laravel Files? The Truth About Daemon Workers
As a developer managing long-running processes like queue workers, understanding how your application framework interacts with the running process is crucial. When dealing with tools like Supervisord to manage these background tasks, it’s easy to assume that file changes should be instantly reflected. However, the reality of how PHP daemons and frameworks operate requires a nuanced understanding.
This post dives into whether you need to manually restart your Supervisord process every time you modify a Laravel file, and explores better strategies for keeping your queue workers up-to-date.
The Mechanics of Daemon Processes and Framework Loading
Let’s look at the scenario you described: running a queue worker using a command like php artisan queue:work --daemon. This mode is designed for efficiency; it keeps the PHP process alive to handle multiple jobs without the overhead of constantly booting up the entire Laravel framework for every single job.
The core issue lies in how the application loads its state. When a daemon worker starts, it reads the files on disk to initialize the environment and load the necessary classes. If you modify a file (e.g., changing an echo statement or altering a configuration value) while the worker is actively running, the memory space allocated to that running process still holds the old version of those definitions until it is explicitly instructed to reload them.
The Laravel documentation hints at this: "Daemon queue workers do not restart the framework before processing each job." This confirms that the running instance of the application holds a snapshot of the code loaded at startup. A simple file change on the filesystem does not automatically trigger a memory refresh within that persistent process.
Why Restarting is Currently Necessary
Your observation that you need to run supervisorctl stop webhooks followed by start webhooks before changes are picked up is technically correct for this setup. This manual cycle forces the Supervisord process to terminate the old PHP worker and start a brand new one, which re-reads all the application files from scratch, ensuring the latest code is loaded into memory.
While this method works reliably, it introduces operational overhead. In a high-traffic environment, constantly stopping and starting queue workers merely for code updates is inefficient and can lead to brief service interruptions. We want solutions that favor zero-downtime deployments.
Better Practices: Achieving Zero-Downtime Updates
Instead of relying on manual restarts as the primary deployment mechanism, we should look toward practices that integrate code deployment seamlessly into our process management. Here are a few superior approaches:
1. Leverage Composer and Autoloading
Laravel heavily relies on Composer for managing dependencies and autoloading. When you update your application files, ensure that these changes trigger a fresh Composer dump-autoload. This ensures that the PHP autoloader correctly maps all new classes and namespaces before any worker attempts to execute code.
2. Use Deployment Pipelines
For true zero-downtime deployment, the standard practice involves deploying the new code before restarting the workers. A robust CI/CD pipeline should handle this:
- Deploy: Push the new files to the server.
- Update Dependencies: Run
composer installorcomposer update. - Signal Restart: Only after verifying the deployment is complete, issue the command to gracefully stop and restart the Supervisord process for your queue rather than manually intervening during runtime.
3. Consider Process Managers Designed for Reloading
While Supervisord is excellent for managing long-running processes, for applications that require frequent hot-reloading (like development environments), tools built specifically for application reloading might be more suitable. However, for production queue workers where stability and integrity are paramount, the controlled restart via a deployment script remains the safest approach. As you build out your services on Laravel, focusing on robust dependency management, as encouraged by Laravel principles, will save you headaches down the line.
Conclusion
To directly answer your question: Yes, in your current setup with Supervisord managing long-running daemon queue workers, a restart is currently required to ensure that changes made to the source files are reflected in the worker's memory space.
However, this manual intervention should be minimized. By shifting focus from reactive restarting to proactive deployment strategies—leveraging Composer and structured CI/CD pipelines—you can achieve the stability and efficiency required for professional Laravel applications without sacrificing the reliability of your background processing tasks.