Re: интерпретация переменных внутри PHP VALUE и PHP ADMIN VALUE для PHP-FPM

locojohn nginx-forum на nginx.us
Ср Июл 13 16:12:23 UTC 2011


António P. P. Almeida Wrote:
-------------------------------------------------------
> 
> location /fastcgi-test {
>   fastcgi_pass phpcgi;
> }

how is phpcgi server node configured exactly?   

> I'm having problems understanding how a PARAM type
> message can be sent
> from the upstream (fpm in this case) to the server
> so that we can use
> it's value on the config. I'm mostly ignorant
> regarding the details of
> FCGI implementations, particularly Nginx FCGI
> module, but I'm under
> the (perhaps erroneous) impression that the
> parameters are sent from
> the server to the upstream and are not sent back
> from the upstream to
> the server. Is it so?

PHP-FPM is a high performance interface to load php scripts in FastCGI
environment, aimed at busy sites with multiple virtual hosts;  it
provides a number of useful options which are not available in other
FastCGI implementations.   One of the extra options is actually support
for PHP_VALUE and PHP_ADMIN_VALUE special environment variables that
instruct PHP-FPM to alter PHP configuration before passing control to
the PHP script.  

PHP-FPM receives control from the server (upon fastcgi_pass call),
prepares PHP runtime environment and loads the PHP script referenced by
the SCRIPT_FILENAME environment variable.  As to parsing special
PHP_VALUE and PHP_ADMIN_VALUE environment variables, PHP-FPM allows
references to existing PHP configuration settings, that will be
substituted by the appropriate values, in the form of ${option_name}. 
When it detects such variable reference in the PHP_VALUE or
PHP_ADMIN_VALUE environment string, it substitutes the ${option_name}
construct with the actual master (current) value of the specified PHP
variable (usually taken from php.ini). 

As to the geo setting example provided, I think there was a mistake, and
this is why your script might have failed.  Try:

geo $x {
   default "include_path=${include_path}:/my/other/include/path";
}

fastcgi_pass $x;

or

geo $x {
   default "${include_path}:/my/other/include/path";
}

fastcgi_pass "include_path=$x";

> As I understand it for the expansion of
> include_path to work there has to
> be another variable that contains its value as
> string so that it can be concatenated. Is it not?

Indeed, the variable is usually defined in the master php.ini file, or
other php.ini files that are loaded by default.   Although, it was a bit
difficult to explain, I hope it still makes some sense!

Andrejs

Posted at Nginx Forum: http://forum.nginx.org/read.php?21,212288,212340#msg-212340




Подробная информация о списке рассылки nginx-ru