Failed starting php7.0-fpm service

My Trellis playbook just failed at the [nginx : Add Nginx PPA] task because the connection timed out. I then re-ran the playbook and Ansible failed as follows:

TASK [php : Start php7.0-fpm service] ******************************************
task path: /Users/siroossaeed/Projects/ansible/trellis-craft/roles/php/tasks/main.yml:39
System info:
  Ansible; Darwin
  Trellis at "Fix #639 - WP 4.6 compatibility: update WP-CLI to 0.24.1"
Job for php7.0-fpm.service failed because the control process exited with
error code. See "systemctl status php7.0-fpm.service" and "journalctl -xe"
for details.

fatal: []: FAILED! => {"changed": false, "failed": true, "invocation": {"module_args": {"arguments": "", "enabled": true, "name": "php7.0-fpm", "pattern": null, "runlevel": "default", "sleep": null, "state": "started"}, "module_name": "service"}}

The contents of the php7.0-fpm log on the server were as follows:

[21-Aug-2016 13:11:53] ERROR: [pool wordpress] the chdir path '/srv/www/' does not exist or is not a directory
[21-Aug-2016 13:11:53] ERROR: failed to post process the configuration
[21-Aug-2016 13:11:53] ERROR: FPM initialization failed

This seems to be happening because the /etc/php/7.0/fpm/pool.d/wordpress.conf file is now on the server, however, the /srv/www/ directory hasn’t yet been created. Would it not be a good idea to ensure that the aforementioned directory is present before copying across the template?


Yeah that’s a good point. Maybe we can easily move where that file is created.

Currently it’s here:

It would make more sense to move it into the wordpress-setup role.

Did you get it working manually? Or still broken?

Yeah, I got it working just fine. I simply created the directory manually, then restarted the playbook.

Indeed, I think it would make more sense to move that task into the wordpress-setup role, especially as the site-specific nginx config is already in there.

1 Like

Thank you for your debugging on this, saved me hours of work.

As per your advice logging into the server and creating running $ sudo mkdir /srv/www/ allowed the playbook to run.