How to debug FastCGI sent in stderr: Primary script unknown while reading response header from upstream and find the actual error message?
To answer your question:
- in php-fpm.d/www.conf file:
set the access.log entry:
access.log = /var/log/$pool.access.log
restart php-fpm service.
try to access your page
cat /var/log/www.access.log, you will see access logs like:
- - 10/Nov/2016:19:02:11 +0000 "GET /app.php" 404
- - 10/Nov/2016:19:02:37 +0000 "GET /app.php" 404
To resolve "Primary script unknown" problem:
if you see "GET /" without a correct php file name, then it's your nginx conf problem.
if you see "GET /app.php" with 404, it means nginx is correctly passing the script file name but php-fpm failed to access this file (user "php-fpm:php-fpm" don't have access to your file, which trapped me for 3 hours)
Hope my answer helps.
error 28105#0: *1 FastCGI sent in stderr: Primary script unknown while reading response header from upstream
Also, need to share files to the php:fpm
docker container too. The answer is to run docker php:fpm
image with volume too:
docker run -it -p 127.168.66.66:9000:9000 -v /var/www/html/:/var/www/html/ php:fpm
1 FastCGI sent in stderr: Primary script unknown
Ok, so 3 things I found after a day of struggling
- For some reason I had already something running on port 9000 so I
changed to 9001 - My default site was intercepting my new one, once again I don't
under stand why since it shouldn't, but I just unlinked it - Nginx doesn't automatically do the sym link for sites-available to
site-enabled.
Hope this saves someone some trouble!
Here is a more detailed link in server fault: https://serverfault.com/questions/517190/nginx-1-fastcgi-sent-in-stderr-primary-script-unknown/517207#517207
Related Topics
Asynchronous Processing or Message Queues in PHP (Cakephp)
What Rss Parser Should I Use in PHP
Curl_Exec Printing Results When I Don't Want To
Empty Values Passed to Zend Framework 2 Validators
How to Properly Display Chinese Characters in PHP
PHP Regex to Remove Http:// from String
Php_Network_Getaddresses: Getaddrinfo Failed: Name or Service Not Known
Php, Failed Connecting to Database
PHP - Getsqlvaluestring Function
How to Post Soap Request from PHP
Windows 7 PHP + Symfony2 Terribly Slow
How to Post a Large Amount of Data Within PHP Curl Without Memory Overhead
Decoding Numeric HTML Entities via PHP
Creating a Very Simple 1 Username/Password Login in PHP
Google-Like Search Engine in PHP/Mysql
Set Application_Env via Virtual Host Config and Read This in PHP