Time for Cron in PHP Fog
One of the features most commonly requested by developers has been support for cron jobs. We’ve been working on providing solutions for this request and wanted to give you all an update. We’re pleased to announce that native cron job support for apps hosted on dedicated clouds will be available beginning this upcoming Monday, May 21st. This new feature will allow users to schedule the execution of PHP scripts within their app’s folder structure. Upon launch, users will be able to quickly schedule jobs to run daily, weekly, monthly, or hourly. Additionally, users will be able to specify their own custom schedule using a subset of the standard cron schedule format. Here’s a screenshot of the “Cron Jobs” tab that will appear in the PHP Fog interface:
In case you haven’t used them, cron jobs are a powerful tool for enabling developers to schedule and perform tasks at specified time periods, from database updating and clean-up to backing up files to making API queries and on and on into infinity.
Previously, PHP Fog users were able to schedule jobs via the third party add-on IronWorker, which runs on a three-tiered freemium pricing model. While our new native cron support will work for many of our users’ needs, IronWorker is still a very solid option, especially for computationally expensive jobs and if the constraints of the native cron support don’t fit their needs.
The native cron support that PHP Fog will offer presents a few limitations that users should be aware of.
First, while cron can normally run any executable, such as shell scripts, we chose to limit our support to PHP scripts only. These can be run either using our new cron job feature or indirectly by triggering from an external site, such as a git repository.
Secondly, at present we offer no direct remote database access. This means that running cron jobs on databases requires running a cron job (per the above) on some other part of your app which in turn controls the database (for example enabling cron-triggered table creation). This means that cron jobs on databases are even more indirect. This is done for security reasons. Indirect cron jobs keep cron scripts themselves from being available within the files specific to your PHP Fog account and are thus isolated from possible security breaches.
And finally, one other limitation is that the custom schedule format does not support the L, W, #, and ? special characters.
We are really excited to be announcing this – and hope that it will solve the cron needs of the majority of our developers.