Heroku PHP Worker
With the following code you can have a PHP worker on Heroku that auto restarts after a crash:
worker.php file
<?php
while (true) {
echo 'Hello world at ' . time() . PHP_EOL;
sleep(1);
}
Procfile
worker: while true; do cd /app/www/ && /app/bin/php worker.php; sleep 1; done
I've also created a gist for this: https://gist.github.com/Sitebase/4065664
Written by Wim Mostmans
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Php
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#