Skip to content

Instantly share code, notes, and snippets.

@fer-ri
Forked from dougalcampbell/phpfpm-mon.cron
Created March 3, 2016 23:56
Show Gist options
  • Save fer-ri/db1c20e781fdaee706ef to your computer and use it in GitHub Desktop.
Save fer-ri/db1c20e781fdaee706ef to your computer and use it in GitHub Desktop.
Crontab entry to monitor for php-fpm problems
## Auto-restart PHP when it's returning errors
#
# Make sure that http://localhost/test.php is an actual PHP script. If it starts returning
# 500 errors, restart the PHP-FPM service
* * * * * /usr/bin/curl --head -sf http://localhost/test.php -o /dev/null || /usr/sbin/service php5-fpm restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment