My experience matches what @scribble notes: you can't set PHP flags directly. However, you can have lighttpd pass environment variables to PHP, which are then accessible via $_SERVER
. This is convenient if you need your application to configure itself dynamically based on the server it's running on. A shared configuration or initialization script can read the value from $_SERVER
and use ini_set
, etc. to configure itself.
Of course, if you only every use a single configuration, you could edit php.ini
or add these changes directly to the application via ini_set
.
Here's an example lighttpd configuration directive that passes MY_VARIABLE
:
fastcgi.server = ( ".php" => ((
"bin-path" => "/usr/local/bin/php-cgi",
"socket" => "/tmp/php-fastcgi-"+var.PID+".socket",
"max-procs" => 2,
"bin-environment" => (
"PHP_FCGI_CHILDREN" => "10",
"PHP_FCGI_MAX_REQUESTS" => "100",
"MY_VARIABLE" => "my-value"
),
"bin-copy-environment" => (
"PATH", "SHELL", "USER"
),
)))