Running CakePHP Shells in the Background

Is it possible for CakePHP to perform the cakephp shell task in the background for i.e. long reports. I also want to update the current status back to the user through updating the table during the report generation and queries using Ajax.

+3
source share
2 answers

Yes, you can run shells in the background using regular system calls like

/path/to/cake/console/cake -app /path/to/app/ <shell> <task>

The tricky part is to start asynchronously with PHP; the best option would be to queue jobs and run the shell as a cron job so often that it then processes the queue. Then you can also update the status of the job in the queue and poll this information through AJAX.

+3
source

Source: https://habr.com/ru/post/1712442/


All Articles