Skip to content

Instantly share code, notes, and snippets.

@ipalaus
Forked from antonioribeiro/gist:24a19f22cffd0beaa7e3
Last active August 29, 2015 14:06
Show Gist options
  • Save ipalaus/14d234cc529a08d3137b to your computer and use it in GitHub Desktop.
Save ipalaus/14d234cc529a08d3137b to your computer and use it in GitHub Desktop.

After an apt-get upgrade on my Forge box, both php and nginx got upgraded, and while browsing my sites, PHP FPM was being hit by nginx, but it returned nothing, zilch, nada.

Nothing on laravel.log.

Something in the nginx log:

10.10.10.10 - - [23/Sep/2014:11:52:09 -0300] "GET / HTTP/1.1" 200 31 "-" "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36"

Enabling xdebug.auto_trace, in /etc/php5/fpm/php.in, gave me

TRACE START [2014-09-23 14:52:09]
    0.0000      15456
TRACE END   [2014-09-23 14:52:09]

Enabling /status in /etc/php5/fpm/pool.d/www.conf:

pm.status_path = /status

And adding this location block to my site:

location ~ ^/(status|ping)$ {
   access_log off;
   allow 127.0.0.1;
   allow 186.228.132.40;
   deny all;
   include fastcgi_params;
   fastcgi_pass unix:/var/run/php5-fpm.sock;
}

I still got nothing from mysite.com/status. So I installed cgi-fcgi, a nice and handy tool:

sudo apt-get --yes install libfcgi0ldbl

Ran it directly to the site source

SCRIPT_NAME=/ SCRIPT_FILENAME=~/mysite.com/public/index.php QUERY_STRING= REQUEST_METHOD=GET cgi-fcgi -bind -connect /var/run/php5-fpm.sock

BANG! The site login page script exploded in my terminal. So I did the same with mysite.com/status:

SCRIPT_NAME=/status SCRIPT_FILENAME=/status QUERY_STRING= REQUEST_METHOD=GET cgi-fcgi -bind -connect /var/run/php5-fpm.sock

And it looked like PHP FPM was really working fine:

pool:                 www
process manager:      dynamic
start time:           23/Sep/2014:11:42:26 -0300
start since:          1230
accepted conn:        8
listen queue:         0
max listen queue:     0
listen queue len:     0
idle processes:       1
active processes:     1
total processes:      2
max active processes: 1
max children reached: 0
slow requests:        0

Xdebug created a huge file too.

Being sure the problem was in NGINX, I googled "nginx 1.6.2 php fpm" and found the fix, adding this line to my nginx site conf solved it:

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment