Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change way to get environment variable #25

Merged
merged 1 commit into from
Mar 14, 2024
Merged

Conversation

mduret
Copy link
Contributor

@mduret mduret commented Feb 27, 2024

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).

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).
@chr15m chr15m merged commit df69424 into AppMini:master Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants