Nixpkgs: php package does not consider anymore /etc/php.d/xxx.ini

Created on 27 May 2020  路  11Comments  路  Source: NixOS/nixpkgs

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

  • system: "x86_64-linux"
  • host os: Linux 5.6.13, NixOS, 20.09pre226148.0f5ce2fac0c (Nightingale)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.3.4
  • channels(shyim): "nixos-20.09pre226148.0f5ce2fac0c"
  • channels(root): "nixos-20.09pre226148.0f5ce2fac0c"
  • nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nix

Maintainer information:

attribute: php
bug

All 11 comments

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sid-kap picture sid-kap  路  3Comments

langston-barrett picture langston-barrett  路  3Comments

ayyess picture ayyess  路  3Comments

copumpkin picture copumpkin  路  3Comments

lverns picture lverns  路  3Comments