Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I write a script to create new vhost on Nginx. That script creates Ningx vhost config file, vhost user and dirs, php-fpm pool file.

At the end of the script, I would like to check if config is ok before restart php-fpm. For Apache, I do apachectl graceful, but is it possible to do something similar with php5-fpm -t?

share|improve this question

From the manpage:

  -t             Test FPM configuration file and  exit  If  called  twice
                 (-tt), the configuration is dumped before exiting.

php5-fpm -t should exit with code 0 if the config is valid, and a non-zero exit code if not. Your script should do something like this then:

if ! php5-fpm -t; then
    echo "php5-fpm configuration is invalid"
    exit 1

However, I made some changes to my configuration which weren't picked up as invalid, so YMMV.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.