Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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
@michaelatef

hello , that's good

can you help me please with same command , but do restart to php-fpm and nginx into same line

as

  • * * * * /usr/bin/curl --head -sf http://localhost/test.php -o /dev/null || /usr/sbin/service php5-fpm restart /usr/sbin/service nginx restart

but it not work with me
i try

  • * * * * /usr/bin/curl --head -sf http://localhost/test.php -o /dev/null || /usr/sbin/service php5-fpm restart && /usr/sbin/service nginx restart

it's not work too

please help

@dougalcampbell

Try:

* * * * /usr/bin/curl --head -sf http://localhost/test.php -o /dev/null || (/usr/sbin/service php5-fpm restart && /usr/sbin/service nginx restart)

And double-check to make sure the paths are correct for your system.

@michaelatef

thanks so much i found some way helps

with

  • * * * * /usr/bin/curl --head -sf http://localhost/test.php -o /dev/null || /restart.sh

and insert my restart command into restart.sh

it's work fine

thanks so much for your answer

MichaeL

@daankortenbach

Thanks, I needed this :)

PS: Your comment has 4 time arguments... shouldn't there be 5?

@PavelPetrov-WebBambooLtd

Thanks a lot! Great way to monitor your php-fpm for the occasional Internal Error 500 hell and keep it up until you find the problem :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.