Suggestion: Stop out of date PHP service on deploy and start correct one

Common error I get on first deploy after updating Trellis

php7.1-fpm.service is not active, cannot reload.
fatal: [45.32.191.188]: FAILED! => {"changed": true, "cmd": "sudo service php7.1-fpm reload", "delta": "0:00:00.026758", "end": "2017-06-18 23:45:08.105427", "failed": true, "rc": 1, "start": "2017-06-18 23:45:08.078669", "stderr": "php7.1-fpm.service is not active, cannot reload.", "stdout": "", "stdout_lines": [], "warnings": []}

The problem is the server used to have php7.0-fpm and the new version of Trellis wants php7.1-fpm.

I’ve fixed this by:

  • SSH’ing into the server
  • sudo service php7.0-fpm stop
  • sudo service php7.1-fpm start
  • Re-deploy

I’m wondering if this can’t be part of the deploy script to:

  • Stop php* (any incorrect version of PHP)
  • Start the correct version if it’s not running already
  • OR reload the correct version it if it is running

But I’m not really that sure on how all this works so maybe I’m missing something!

2 Likes

This only happens once per “older” (pre 7.1) server right? I guess it’s possible to have a solution like this, but depends on what’s going on exactly.

That’s correct. Once fixed it’s no longer a problem … but it’s a slightly annoying one for each upgrade.