php - Debugging the famous - FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream -
so has many articles mentioning error code:
fastcgi sent in stderr: "primary script unknown" while reading response header upstream...
that means error message more or less useless.
the message telling fastcgi handler doesn't whatever sent reason. problem have no idea reason is.
so i'm re-stating question -- how debug error code?
consider situation have simple site, phpinfo.php file. additionally, there simple nginx config, follows:
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 see output/log fastcgi_params got sent script?
how can see actual error message? in case, i'm using php-fpm. has no info in log error. logs not append rows error. there verbose mode php-fpm?
/var/log/php-fpm/error.log /var/log/php-fpm/www-error.log
i've tried set in php-fpm.conf file
log_level = notice
and in php-fpm.d/www.conf file:
catch_workers_output = yes
to answer question:
- in php-fpm.d/www.conf file:
set access.log entry:
access.log = /var/log/$pool.access.log
restart php-fpm service.
try access page
cat /var/log/www.access.log, 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 see "get /" without correct php file name. it's nginx conf problem.
if see "get /app.php" 404, means nginx correctly passing script file name php-fpm failed access file (user "php-fpm:php-fpm" don't have access file, trapped me 3 hours)
hope answer helps.
Comments
Post a Comment