Long-running PHP process on nginx

I recent had to allow a PHP script to run for several minutes under Nginx (more specifically, as part of a Laravel app on a DigitalOcean server), after encountering the error “504 Gateway Timeout”. First, to tell Nginx to allow the script to run for a longer period of time, I set the FastCGI read timeout to ten minutes in 
/etc/nginx/sites-available/default :

Second, to increase the amount of time that this particular PHP routine could spend running, I increased the execution time limit programmatically before each processing block:

With this configuration, other PHP scripts are still capped at the default timeout value set in 
php.ini, and no individual block of processing is allowed to run away with the full ten-minute time limit.

Abstract app controllers and the CakePHP ACL plugin

I’m working on a CakePHP-based app that has multiple abstract base controller classes that inherit from AppController. The majority of the concrete controllers inherit from one of these abstract classes. I recently added the CakePHP/Acl plugin to the app, and was presented with the error

when I tried to use the  bin/cake acl_extras aco_sync command to generate ACOs for the app controllers.

It turned out that the plugin was attempting to instantiate one of every controller class except AppController, which of course would fail for the abstract ones. The fix was straightforward: exclude every class that is not instantiable from the list of controllers to add as ACOs. I submitted a PR over the weekend to fix the bug, and it got merged yesterday. So the current version on GitHub no longer has the problem—hopefully a new version will be pushed to Packagist soon.