Speak now
Please Wait Image Converting Into Text...
Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Challenge yourself and boost your learning! Start the quiz now to earn credits.
Unlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
General Tech Bugs & Fixes 2 years ago
Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
Turn Your Knowledge into Earnings.
I'm trying to set up a freshly installed Ubuntu (12.04) server, but I can't get PHP files running through php-fpm. No matter what I do, I always get a "Access denied." page (plain text, not html or anything).
Installed packages:
nginx nginx-common nginx-full php5 php5-cli php5-common php5-fpm
Configuration details:
PHP-FPM:
user = www-data group = www-data listen = /var/run/php5-fpm.sock
Nginx:
user www-data; worker_processes 3; events { worker_connections 1024; }
Default/test domain:
server { listen 80; server_name localhost; root /extra/htdocs/default; index index.html index.php access_log /extra/logs/default/access.log; error_log /extra/logs/default/error.log; location / { try_files $uri $uri/ /index.html; } location ~ \.php { fastcgi_split_path_info ^(.+\.php)(/.+)$; include fastcgi_params; fastcgi_index index.php; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } }
/extra/htdocs/default/index.php:
phpinfo();
Everything else is default. Both the Nginx and php-fpm logs show no errors. Yet when I load http:///index.php I get the "Access denied" page.
http:///index.php
Troubleshooting:
/extra
www-data
.php .html
I'm really getting tired of this, I've installed this setup twice already (albeit on OSX machines), and everything worked flawlessly. Is there anything I'm overlooking?
The log contents:
The Nginx error log is empty.
Nginx access log (removed ip):
- - [17/Jul/2012:11:21:25 +0200] "GET /favicon.ico HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.57 Safari/536.11" - - [17/Jul/2012:11:21:28 +0200] "GET /index.php HTTP/1.1" 403 46 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.57 Safari/536.11" - - [17/Jul/2012:11:21:34 +0200] "-" 400 0 "-" "-"
php-fpm log:
[17-Jul-2012 10:44:14] NOTICE: fpm is running, pid 4969 [17-Jul-2012 10:44:14] NOTICE: ready to handle connections
Finally fixed it.
The culprit was this line in my config:
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
If I commented this line, everything worked fine. However I saw this in almost every post I read about Nginx configs, so it bothered me. When looking at my configs for the millionth time, I saw that cgi.fix_pathinfo (in php.ini) was set to 0, where it should have been 1. The default value PHP uses is also 1, so I must have changed this in my debugging hours, because I remember reading about this value, and thought it was set correct.
cgi.fix_pathinfo
php.ini
Anyway, maybe it helps anyone Googling for this issue.
No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.
General Tech 10 Answers
General Tech 7 Answers
General Tech 3 Answers
General Tech 9 Answers
General Tech 2 Answers
Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.