-
Notifications
You must be signed in to change notification settings - Fork 327
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
[PHP] Allow additional php.ini files instead of overwriting via options.file #969
Comments
Thanks for sharing this use case. If the {
"applications": {
"hello-world": {
"type": "php",
"root": "/www/public",
"script": "index.php",
"options": {
"file": [
"php.ini",
"some-tweaks.ini"
]
}
}
}
} |
That would be perfect! |
I'm not sure that we can make
AFAICT you have two options
{
"applications": {
"hello-world": {
"type": "php",
"root": "/www/public",
"script": "index.php",
"environment": {
"PHP_INI_SCAN_DIR": "/tmp/php.inis"
}
}
}
} |
I think the environment variable is a good solution. The tweaked php.ini files can be placed somewhere and loaded dynamically. After checking the docs again, this option can even be used to set multiple directories separated by comma. I will give it a try but from what it looks like this should be something we put in our PHP docs to share this option with others. |
Thanks for the suggestions. I didn't think about using the It works! {
"applications": {
"app": {
"type": "php",
"root": "public",
"script": "index.php",
"environment": {
"PHP_INI_SCAN_DIR": ":config/"
}
}
} Because If you want to dynamically load Xdebug depending on the {
"settings": {
"http": {
"log_route": true
}
},
"listeners": {
"*:443": {
"pass": "routes/https",
"tls": {
"certificate": "bundle"
}
}
},
"routes": {
"https": [
{
"match": {
"arguments": {
"XDEBUG_TRIGGER": "1"
}
},
"action": {
"pass": "applications/app-xdebug",
"response_headers": {
"With-Xdebug": "true"
}
}
},
{
"action": {
"pass": "applications/app",
"response_headers": {
"With-Xdebug": "false"
}
}
}
]
},
"applications": {
"app": {
"type": "php",
"root": "public",
"script": "index.php"
},
"app-xdebug": {
"type": "php",
"root": "public",
"script": "index.php",
"environment": {
"PHP_INI_SCAN_DIR": ":config/directory-that-has-an-ini-file-that-enables-xdebug/"
}
}
}
} Thanks all! |
Currently, there is no way to load additional php.ini files.
When you specify
options.file
, you override the default loaded php.ini completely.When reading the code, it seems this is how it was designed:
unit/src/nxt_php_sapi.c
Lines 409 to 422 in c905d0d
unit/src/nxt_php_sapi.c
Line 671 in c905d0d
But, if you want to enable (zend) extensions on a per application basis, this becomes annoying.
You now have to copy the default php.ini, store it in a new file and then append your tweaks to it.
It would be easier if I could do this:
Or, specify the (additional) extensions that I want to load and let me provide extra config via
admin
anduser
:The text was updated successfully, but these errors were encountered: