Every time I make some change in Laravel, I need to do php artisan swoole:http stop and after that php artisan swoole:http start. It doesnt see my changes until I do that. Is there any other way to reloading server, or what..Also, when I do docker-compose up -d it starts running, but in app I am getting Connection is refused.. I am new with Docker and Swoole. Can someone explain to me how to use it? Thank you
CodePudding user response:
As more of a general statement and background: this is how most programming languages work, the code is compiled into an executable and any time you need to make changes, you would have to recompile and re-execute the program.
PHP is an interpreted language so the compilation normally happens as you execute the script which means it can respond to filesystem changes without you having to manually restart or recompile. This may be convenient but it also can be very poor performing.
Various optimizations can be made to change how/when the code is compiled to improve performance (opcache, swoole, etc). When you're running with these optimizations, you will have to follow their guidelines on what needs to be done when you make changes (recompile, restart, or clear caches).
CodePudding user response:
I assume you're using octane but in general.
it loads the application into memory and then serves the application from memory. if you're doing local development there is a watcher you can add that will auto-reload when it detects changes.
https://laravel.com/docs/9.x/octane#watching-for-file-changes