There are many articles in SO that mention this error code:
FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream...
This probably means that this error message is more or less useless.
The message states that the FastCGI handler does not like what was sent for some reason. The problem is that sometimes we donβt know what the reason is.
So, I am asking the question again: how to debug this error code?
Consider a situation where we have a very simple site, only with the phpinfo.php file. In addition, there is a very simple nginx configuration:
server { server_name testsite.local; root /var/local/mysite/; location / { index index.html index.htm index.php; } location ~ \.php$ { include /etc/nginx/fastcgi_params; fastcgi_pass fastcgi_backend; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } }
How can we see output / log exactly what fastcgi_params was sent to the script?
How can we see the actual error message? In my case, I am using php-fpm. He has no log information about this error. Logs do not add any lines for this error. Is there any verbose mode for php-fpm?
/var/log/php-fpm/error.log /var/log/php-fpm/www-error.log
I tried to install this in php-fpm.conf file
log_level = notice
and this is in the php-fpm.d / www.conf file:
catch_workers_output = yes
php nginx
010110110101
source share