Welcome! Log In Create A New Profile

Advanced

php-fpm, fastcgi_param, path_info specific

Posted by GRATS 
php-fpm, fastcgi_param, path_info specific
October 11, 2012 01:44AM
Hello, I read on a tutorial this:


location ~ \.php$ {
fastcgi_index index.php;
try_files $uri =404;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_pass unix:/tmp/phpfpm.sock;
}


I just want to have an understanding, however something seems wrong from my understanding

fastcgi_index index.php; This is the index that is passed to the php handler (php-fpm for me)

try_files $uri =404; This is for 404 errors, so people can't upload a .gif file with code in it and do example.com/example.gif/anything.php and nginx says oh that anything.php doesn't work but we will execute this code in the example.gif and then it does bad stuff to your server.. so this try files kind of makes that more secure


and this one I wasn't sure about:
fastcgi_param PATH_INFO $fastcgi_script_name;

That seems to cause errors, I am assuming (because this is how it acts) that the path_info is related to the $SERVER document root thing used in PHP, and it SHOULD be this:
fastcgi_param PATH_INFO $fastcgi_path_info;
instead of _script_name;

http://wiki.nginx.org/HttpFastcgiModule#fastcgi_split_path_info

I read that setup from here with the _path_info;

All of this is one big question, I'm just staying what I think I know, if anything isn't correct I am really wondering on the PATH_INFO thing because the one I got doesn't work and it is causing errors on some things (installation of all forum software for one..) and it was related to the php $server document root being.. executed? wrong, it grabs the entire URL including /index.php for the "root" so it thinks

example.com = example.com/index.php
and for a link to "about.php" from that URL it would go to:

example.com/index.php/about.php

kind of weird
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 252
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready