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

locojohn nginx-forum на nginx.us
Пт Июл 15 22:59:28 UTC 2011


> >    geo $y {
> >      default "${precision}+1";
> >    }
>    
> -   with fastcgi_param PHP_VALUE "precision=$x";
> +   with fastcgi_param PHP_VALUE "precision=$y";

I do not think PHP-FPM can perform inline mathematical evaluation within
passed arguments to PHP_VALUE/PHP_ADMIN_VALUE.   But it works for me
when it comes to generic substitution of existing and defined in the
master php.ini file configuration variables, with their actual values. 
In my experience,  Maxim's suggestion works fine, and I could so far
reference any variable I wanted in the PHP configuration file.  This is
very useful, for example, if you want to set security limits with
open_basedir, but you also want to make sure that uploads work, but you
don't want to hardcode the temporary upload folder into open_basedir,
but rather read the current value from php.ini by adding
${upload_tmp_dir} to open_basedir value in the nginx configuration using
fastcgi_pass PHP_ADMIN_VALUE:

geo $upload_tmp_dir {
  default "${upload_tmp_dir}";
}
...
fastcgi_pass PHP_ADMIN_VALUE
"open_basedir=$document_root:$upload_tmp_dir";
  
Anyway, it works for me.

Andrejs

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




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