diff --git a/nixos/modules/services/web-servers/phpfpm/default.nix b/nixos/modules/services/web-servers/phpfpm/default.nix
index a3a23b222fb..787eed1c0ca 100644
--- a/nixos/modules/services/web-servers/phpfpm/default.nix
+++ b/nixos/modules/services/web-servers/phpfpm/default.nix
@@ -7,8 +7,6 @@ let
stateDir = "/run/phpfpm";
- pidFile = "${stateDir}/phpfpm.pid";
-
mkPool = n: p: ''
[${n}]
listen = ${p.listen}
@@ -17,9 +15,8 @@ let
cfgFile = pkgs.writeText "phpfpm.conf" ''
[global]
- pid = ${pidFile}
error_log = syslog
- daemonize = yes
+ daemonize = no
${cfg.extraConfig}
${concatStringsSep "\n" (mapAttrsToList mkPool cfg.pools)}
@@ -43,7 +40,7 @@ in {
description = ''
Extra configuration that should be put in the global section of
the PHP-FPM configuration file. Do not specify the options
- pid, error_log or
+ error_log or
daemonize here, since they are generated by
NixOS.
'';
@@ -129,8 +126,8 @@ in {
mkdir -p "${stateDir}"
'';
serviceConfig = {
+ Type = "notify";
ExecStart = "${cfg.phpPackage}/bin/php-fpm -y ${cfgFile} -c ${phpIni}";
- PIDFile = pidFile;
};
};
diff --git a/pkgs/development/interpreters/php/default.nix b/pkgs/development/interpreters/php/default.nix
index 7b816b49db5..f79ef61d36a 100644
--- a/pkgs/development/interpreters/php/default.nix
+++ b/pkgs/development/interpreters/php/default.nix
@@ -2,7 +2,7 @@
, mysql, libxml2, readline, zlib, curl, postgresql, gettext
, openssl, pkgconfig, sqlite, config, libjpeg, libpng, freetype
, libxslt, libmcrypt, bzip2, icu, openldap, cyrus_sasl, libmhash, freetds
-, uwimap, pam, gmp, apacheHttpd, libiconv }:
+, uwimap, pam, gmp, apacheHttpd, libiconv, systemd }:
let
@@ -19,11 +19,12 @@ let
enableParallelBuilding = true;
- buildInputs = [ flex bison pkgconfig ];
+ buildInputs = [ flex bison pkgconfig systemd ];
configureFlags = [
"EXTENSION_DIR=$(out)/lib/php/extensions"
- ] ++ lib.optional stdenv.isDarwin "--with-iconv=${libiconv}";
+ ] ++ lib.optional stdenv.isDarwin "--with-iconv=${libiconv}"
+ ++ lib.optional stdenv.isLinux "--with-fpm-systemd";
flags = {