Skip to content
A simple demo of running a scheduled PHP process on Heroku
Latest commit b06b575 Feb 3, 2013 @ryanbrainard Update
Failed to load latest commit information. Update Feb 3, 2013
index.php ! Feb 3, 2013
script.php add script Feb 3, 2013

A simple demo of running a scheduled PHP process on Heroku.

  1. Clone this repo

    $ git clone
  2. Go in the dir

    $ cd php-scheduler-demo
  3. Create the Heroku app with the buildpack set to a fork of the PHP buildpack that support the PHP CLI

    $ heroku create --buildpack
  4. Push the code to Heroku

    $ git push heroku master
  5. Test the script by running it in a one-off worker dyno just to see it work before scheduling it

    $ heroku run php www/script.php
    Running `php www/script.php` attached to terminal... up, run.6599
    Current time: 1359943709 
  6. Add the Scheduler Add-on

    $ heroku addons:add scheduler:standard 
  7. Open the scheduler configuration page

    $ heroku addons:open scheduler
  8. Add the script as a job. Same as one-off step above, but without the heroku run

    • Add job...
    • $ bin/php www/script.php
  9. View the scheduled job running in the logs

    $ heroku logs
    2013-02-04T01:55:13+00:00 heroku[api]: Starting process with command `bin/php www/script.php` by
    2013-02-04T01:55:16+00:00 heroku[scheduler.4997]: Starting process with command `bin/php www/script.php`
    2013-02-04T01:55:16+00:00 app[scheduler.4997]: Current time: 1359942916
    2013-02-04T01:55:18+00:00 heroku[scheduler.4997]: Process exited with status 0
    2013-02-04T01:55:18+00:00 heroku[scheduler.4997]: State changed from starting to complete
Something went wrong with that request. Please try again.