简体   繁体   中英

Laravel run artisan queue:work from inside php in background

We have laravel 5.6 and a lot of queues.

On production I have Supervisor that handles these queues.

On localhost I use the "sync" option to process all queues synchroniously / directly.

I wonder if it is possible to have a different behaviour on localhost:

I want to dispatch the job and then run the following command via php exec directly after that:

exec('php ../artisan queue:work --sleep=3 --tries=1 --memory=768 --timeout=3600 --env=local --once &');

This should run the queue worker in the background once.

But nothing happens. Does artisan even work in such a scenario?

可以在Windows下使用

popen( 'start C:\php\php.exe -c "C:\php\php.ini" '.base_path().'/artisan queue:work --env=local --once', 'r' );

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM