spatie / async

Easily run code asynchronously
https://spatie.be/en/opensource/php
MIT License
2.65k stars 179 forks source link

Can I use it in PHP-FPM? #139

Closed hkui closed 2 years ago

spacemudd commented 3 years ago

You need the CLI to run it (so, either you use Queue manager or use something like Artisan CLI commands)

DoobleD commented 3 years ago

Hi @spacemudd. Any chance you could elaborate on that? I'm interested in using spatie/async with php-fpm as well, but not sure how to do that since pcntl is disabled forphp-fpm.

spacemudd commented 3 years ago

Hi @DoobleD. You need to enable pcntl. I've been using Laravel Queue Manager that runs php processes in the background where spatie/async works. However, its performance was great for small pure php scripts. I've since changed back to regular queues (Laravel queues, or something like RabbitMQ for other apps)

DoobleD commented 3 years ago

Thanks for the insight @spacemudd, much appreciated. I've ended up creating and starting multiple Symfony processes from fpm, each one running a Symfony command script.

Probably not the best solution, but does the job relatively easily. I don't feel too comfortable enabling pcntl for fpm. I'll have a look at queues when the need will arise again.

spatie-bot commented 2 years ago

Dear contributor,

because this issue seems to be inactive for quite some time now, I've automatically closed it. If you feel this issue deserves some attention from my human colleagues feel free to reopen it.