Custom settings with PHP

Michael Shadle mike503 at
Sat Nov 14 20:32:21 MSK 2009

You can add or override fastcgi params you just have to understand the  
behavior of the array.

Also afaik _ENV is only for cli. Use _SERVER instead. Also php 5.3 has  
overrides built in now on the user level and you cam use htscanner.  
Because some settings you won't be able to change via ini_set either.

Sent from my iPhone

On Nov 14, 2009, at 8:59 AM, "kyleb" <nginx-forum at> wrote:

> On Fri, 13 Nov 2009 14:22:55 +0100, Life Hunter wrote:
>> I have setup PHP with spawn-fcgi, PHP work well, but how to pass  
>> custom
>> settings to PHP per virtualhost ?
>> Like this, for example (.htaccess get from RoundCube webmail) :
>> "php_value upload_max_filesize 5M"
> This works just fine:
> location /somewhere {
> fastcgi_param     ENV_NAME     "Value for Somewhere";
> }
> location /else {
> fastcgi_param     ENV_NAME     "Value for somewhere else.";
> }
> If you are setting something that php doesn't read from its  
> environment, just use ini_set() with $_SERVER or $_ENV.  If the  
> value you want isn't PHP_INI_ALL, there might be another way to get  
> it in; too bad php-cgi environment usage seems undocumented in the  
> manual.
> I see no reason why this shouldn't work with a server block, too,  
> for virtual host.  Try also nginx's max request size parameters for  
> your use case.
> N.b., most/all fastcgi settings don't in if () {} blocks.  That  
> would be a feature request on my part, particularly to set different  
> timeouts for GET and POST requests.
> Posted at Nginx Forum:,22556,22861#msg-22861

More information about the nginx mailing list