在免费的Heroku上运行连续的PHP应用程序

问题描述:

It is possible to run continuous PHP applications on free Heroku? I run the PHP irc bot via browser by this code:

<?php
exec("(cd php-irc;/app/php/bin/php ./bot.php bot.conf &) > /dev/null 2>/dev/null &");
?>

Bot turns off after about an hour :(

As suggested jszobody I use background jobs. I executed

heroku config:add LD_LIBRARY_PATH=/app/php/ext:/app/apache/lib

and created Procfile with contents:

web: sh boot.sh
worker: cd ~/php-irc/ && php bot.php bot.conf

and executed:

heroku ps:scale web=0 worker=1

Seems it works without problems. Thanks!