title: FastCGI sent in stderr primary script unknown while reading response header from upstream
body: <p>I have in <code>nginx.conf</code></p>
  
  <pre><code>upstream php-fpm7.0
  {
      server unix:/run/php-fpm/php7.sock;
  }
  </code></pre>
  
  <p>I have in <code>conf.d/default.conf</code></p>
  
  <pre><code>location ~ \.php$ {
      include php-fpm;
  }
  </code></pre>
  
  <p>I have in <code>php-fpm</code></p>
  
  <pre><code>fastcgi_pass    php-fpm7.0;
  include fastcgi_params;
  fastcgi_param   SCRIPT_FILENAME         $document_root$fastcgi_script_name;
  set             $path_info              $fastcgi_path_info;
  fastcgi_param   PATH_INFO               $path_info;
  # Additional variables
  fastcgi_index   index.php;
  </code></pre>
  
  <p>But i get error 404.
  When i comment </p>
  
  <pre><code>#location ~ \.php$ {
  #    include php-fpm;
  #}
  </code></pre>
  
  <p>files are available</p>
  
  <p>Error even if</p>
  
  <pre><code>location ~ \.php$ {
      fastcgi_pass unix:/run/php-fpm/php7.sock;
      fastcgi_index index.php;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      include fastcgi_params;
  }
  </code></pre>
  
  <blockquote>
    <p>FastCGI sent in stderr: "Primary script unknown" while reading
    response header from upstream</p>
  </blockquote>
  
  <p>The same error if not using socket:</p>
  
  <pre><code>fastcgi_pass 127.0.0.1:9000;
  </code></pre>
  
  <p>Centos 7</p>
  
  <p>Update 1.</p>
  
  <p>After i used:</p>
  
  <pre><code>fastcgi_param SCRIPT_FILENAME $document_root/index.php;
  fastcgi_param SCRIPT $fastcgi_script_name;
  fastcgi_param FOLDER $document_root;
  fastcgi_param FOLDER_SCRIPT $document_root$fastcgi_script_name;
  </code></pre>
  
  <p>I got <code>$_SERVER['SCRIPT']</code> <code>/index.php</code> 
  and <code>$_SERVER['FOLDER']</code> <code>/home/www/m-a-x/www</code>
  and <code>$_SERVER['FOLDER_SCRIPT']</code> <code>/home/www/m-a-x/www/index.php</code></p>
  
  <p>When i back </p>
  
  <pre><code>    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  </code></pre>
  
  <p>all works.
  Mystery.</p>