Nginx – PHP-FPM – FastCGI sent in stderr: “Primary script unknown” while reading response header from upstream

Published on Author gryzli

Getting  “Primary script unknown” in a Nginx + PHP-FPM setup.

I’ve seen this error on a multiple Nginx / PHP-FPM based servers.

This error is mostly conducted by a bad configured SCRIPT_FILENAME  and in most cases adding default SCRIPT_FILENAME directive in the PHP handling section, will fix the things up.

Here is some example PHP handling section

location ~* \.php$ {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;