FreeKB - PHP Resolve "FastCGI sent in stderr Primary script unknown while reading response header from upstream"
PHP - Resolve "FastCGI sent in stderr Primary script unknown while reading response header from upstream"

Let's say you have a web server that is configured with PHP and SSL, and you get something like this when attempting to get a PHP page over HTTPS.

 

Let's say the web servers log has something like this. This suggests some issue with FastCGI.

2021/07/03 04:04:58 [error] 54817#54817: *2 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 10.14.55.2, server: www.example.com, request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://unix:/run/php-fpm/www.sock:", host: "www.example.com", referrer: "http://www.example.com/index.php"

 

The web servers configuration file should have FastCGI directives. Here is an example of the FastCGI directives in an Nginx web servers configuration file.

location ~ \.php$ {
    try_files $uri =404;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    include fastcgi_params;
}

 

Notice here that FastCGI is using port 9000. If you have a firewall in place, ensure port 9000 is allowed in the firewall.

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter 7b63c in the box below so that we can be sure you are a human.




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |