PHP-FPM issue with Workflows



While I don’t think workflows is directly responsible for this, while trying to implement workflows in our build process, the steps we used to use for regular 2.0 builds are failing in workflows builds.

I have these steps get Nginx and PHP-FPM up and running:

      - run:
          name: Start PHP-FPM
          shell: /bin/bash
          command: service php-fpm restart
      - run:
          name: Start Nginx
          shell: /bin/bash
          command: service nginx restart

And can confirm that both are running with netstat

#!/bin/bash -eo pipefail
netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0     *                   LISTEN      82/beanstalkd       
tcp        0      0    *                   LISTEN      277/php-fpm         
tcp        0      0     *                   LISTEN      -                   
tcp        0      0      *                   LISTEN      -                   
tcp        0      0      *                   LISTEN      -                   
tcp        0      0        *                   LISTEN      305/nginx           
tcp        0      0    *                   LISTEN      -                   
tcp        0      0  *                   LISTEN      -                   
tcp        0      0 :::3306                     :::*                        LISTEN      -                   
tcp        0      0 :::11211                    :::*                        LISTEN      -                   
tcp        0      0 :::6379                     :::*                        LISTEN      -  

And yet when it’s time to run the acceptance tests, every request gets a 404 File not found response, and the nginx error log shows

2017/06/19 19:42:37 [error] 355#0: *549 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client:, server: localhost, request: "POST //v2/word-search/videos.json HTTP/1.1", upstream: "fastcgi://", host: "localhost"

I’ve checked the php-fpm error log and all it shows is that php-fpm is running and ready to go. I’d SSH in and see what’s going on, but rebuilding with SSH fails because of the attaching workspace command not being available.


“Primary script unknown” is usually caused by a wrong nginx config.

Can you post your nginx config and more of your circle.yml?

Specifically looking for fastcgi_param SCRIPT_FILENAME settings


I can post it, issue is I haven’t changed the configs and they have been (and currently are) working with normal 2.0 builds. Suddenly broke during the change to a workflow setup though. I had to switch gears at work and haven’t had time to mess with this, but I’m gonna try restarting my workflow work and see if I somehow missed a step I’m not thinking of. And if it still doesn’t work, drop all the config files here and hope for the best.


This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.