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

Consider getenv for MW_ELASTIC_HOST #351

Open
ross-spencer opened this issue Jul 12, 2022 · 0 comments
Open

Consider getenv for MW_ELASTIC_HOST #351

ross-spencer opened this issue Jul 12, 2022 · 0 comments

Comments

@ross-spencer
Copy link

In php.ini $_ENV isn't recommended for production servers.

From an example php.ini:

; 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";
; http://php.net/variables-order
variables_order = "GPCS"

$_ENV is used here:

Using a default production php.ini, e.g. from /usr/local/etc/php, e.g. to override file upload images for the local media extension, this will cause errors when trying to switch from CirrusSearch to elastic, i.e. PHP Notice: Undefined index: MW_ELASTIC_HOST in /var/www/html/LocalSettings.d/WikibaseCirrusSearch.php on line 7.

A workaround I guess is to add E to variables_order in php.ini (or perhaps mount a modified WikibaseCirrusSearch.php. If there's a more opinionated view on php.ini from the team, perhaps that can be distributed with this repo?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants