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.
source
share