Record of some of the computer tech I deal with so that it's documented at least somewhere.

Monday, 29 October 2007

setting php variables in lighthttpd.conf

I didn't find a way to do this directly from lighttpd.conf
so ....

in php.ini
include_path = ".:/var/www/php"
display_errors = Off
auto_prepend_file = set_directives.inc


in lighttpd.conf
setenv.add-environment = (
"PHP_DIRECTIVES" => "php[include_path]=:/var/www/php-dev:/var/www/php&php[display_errors]=On"
)



in /var/www/php/set_directives.inc
<?
parse_str($_ENV['PHP_DIRECTIVES']);
foreach($php as $d=>$v)
ini_set($d, $v);
unset($php);
?>


Ok, you have a restricted set to choose from http://uk3.php.net/manual/en/ini.php

But it's better than nowt, if you find out how to do it properly, let me know, ta :)

No comments: