Custom settings with PHP

António P. P. Almeida appa at
Tue Jul 12 18:59:47 MSD 2011

On 12 Jul 2011 15h40 WEST, nginx-forum at wrote:

>> Hmm, never tried that, using a variable. Don't
>> know if the $ needs to
>> be escaped.
>> You'll have to try it. 
> Of course I tried both:
> fastcgi_param PHP_VALUE
> "include_path=${include_path}:/my/other/path";
> and
> fastcgi_param PHP_VALUE
> "include_path=\${include_path}:/my/other/path";

> and neither works, hence I wrote here.

From here it's implied that you
cannot use variables in the headers. PHP variables that is. You can
use Nginx variables.

Best solution I think is to create a new parameter $my_include_path.
Set it on fastcgi_params and then do a:

fastcgi_param PHP_VALUE my_include_path=/my/include/path;

ini_set('include_path', ini_get('include_path') . ':' . $my_include_path);

on your script.

--- appa

More information about the nginx mailing list