Skip to content

Commit 5eec149

Browse files
committed
change way to get environment variable
By default, on debian the configuration /etc/php/XX/apache2/php.ini indicates : ; This directive determines which super global arrays are registered when PHP ; starts up. G,P,C,E & S are abbreviations for the following respective super ; globals: GET, POST, COOKIE, ENV and SERVER. There is a performance penalty ; paid for the registration of these arrays and because ENV is not as commonly ; used as the others, ENV is not recommended on productions servers. You ; can still get access to the environment variables through getenv() should you ; need to. ; Default Value: "EGPCS" ; Development Value: "GPCS" ; Production Value: "GPCS"; ; https://php.net/variables-order variables_order = "GPCS" This means that the global environment variables are not passed to php with production value. Using php function getenv, this permits to use SetEnv instruction in apache2 virtualhost configuration without changing php configuration. The mecanism is the same with php_fpm (common usage with nginx).
1 parent 1ce0ef3 commit 5eec149

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

server.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// Set data directory to data if no one logged in
1313
// Otherwise to data/<username>
1414
$dir = "data";
15-
if (isset($_ENV["TODO_PER_USER_FOLDERS"]) && $_ENV["TODO_PER_USER_FOLDERS"] == 'TRUE') {
15+
if ( getenv("TODO_PER_USER_FOLDERS") == 'TRUE') {
1616
$dir = "data/".$_SERVER['PHP_AUTH_USER'];
1717
if (!file_exists($dir)) {
1818
mkdir($dir, 0777);

0 commit comments

Comments
 (0)