如何在NixOs上修改php.ini配置?

时间:2017-03-13 18:13:28

标签: nixos

我有一台配有Nginx和phpfpm的NixOS机器。我无法想象如何在php.ini中设置一个值。

我试着这样做:

services.phpfpm.phpIni = pkgs.runCommand "php.ini" {
    options = ''
      sendmail_path = "/run/wrappers/bin/sendmail -t -i"
    '';
  } ''
    cat ${pkgs.php}/etc/php-recommended.ini > $out
    echo "$options" >> $out
  '';

但是我收到以下消息,文件保持不变:

warning: The option definition `services.phpfpm.phpIni' in
`configuration.nix' no longer has any effect; please remove it.

还有其他方法吗?

1 个答案:

答案 0 :(得分:1)

根据@ Zimm-i48的建议,您可以使用services.phpfpm.phpOptions配置选项更改php设置:

services.phpfpm.phpOptions = ''
  extension=${apcu}/lib/php/extensions/apcu.so
  apc.stat = '0'
  apc.slam_defense = '0'
  etc...
'';

更多发现选项:https://nixos.org/nixos/options.html#services.php