Custom settings with PHP

kyleb nginx-forum at nginx.us
Sat Nov 14 19:59:25 MSK 2009


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: http://forum.nginx.org/read.php?2,22556,22861#msg-22861






More information about the nginx mailing list