Describe the bug
PHP does not consider anymore ini files under /etc/php.d/
To Reproduce
environment.etc."php.d/shyim.ini" = {
text = ''
memory_limit=2G
'';
mode = "0777";
};
php -i | grep memory_limit is still 128MB.
This did worked in previous channel
Expected behavior
I can override the default values
Screenshots
Additional context
Notify maintainers
@etu
Metadata
"x86_64-linux"Linux 5.6.13, NixOS, 20.09pre226148.0f5ce2fac0c (Nightingale)yesyesnix-env (Nix) 2.3.4"nixos-20.09pre226148.0f5ce2fac0c""nixos-20.09pre226148.0f5ce2fac0c"Maintainer information:
attribute: php
cc @NixOS/php
@shyim correct, this impure side effect inducing behavior was removed. You are encouraged to use php.buildEnv { extraConfig = '''; ini contents here'''; } now. In the case that you need to maintain your current workflow I think between command line options, potentially appending/override PHP_INI_SCAN_DIR, per directory .ini files, and the various phpOptions options we can get a working solution for you - and possibly document it in the manual (though we don't want to encourage this as it introduces impure side effects).
Is your use case php-fpm, mod_php, or simply php from the command line?
I just want to increase the limit on the cli and all php packages like composer etc
@shyim does this satisfy your requirements:
environment.systemPackages =
let
php' = pkgs.php.buildEnv { extraConfig = "memory_limit = 2G"; };
in [
php'
php'.packages.composer
];
I actually didn't know that the old php derivation was impure in this sense.
But if it was, it was bad I'd say. And I'm happy that we fixed that.
But since it was impure before and is pure now we should probably add a mention for that in the release notes for 20.09.
Thanks @aanderse
Works for me.
So I will close this issue then :)
@aanderse It seems so that now extensions are missing. How can I get with buildEnv all extensions like the normal?
https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks/php.section.md#installing-php-with-extensions-ssec-php-user-guide-installing-with-extensions
https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks/php.section.md#installing-php-with-extensions-ssec-php-user-guide-installing-with-extensions
@shyim please let us know how this works out for you. Don't be hesitant to ask any questions!
@shyim
php.buildEnv {
extensions = { enabled, ... }: enabled;
extraConfig = "memory_limit=2G";
}
@NixOS/php It seems weird to me that one would need to define that the default set should be active by changing the config.
EDIT: Maybe we could have a php.withConfig for those who only wants to change the config :thinking:. Then people can use withExtensions or withConfig if they only want to do one of the actions and buildEnv for everything at once.
@etu Yep, buildEnv really should just keep them active when extensions is left unspecified. I opened a pr to fix this (#89132).