Fix loading PHP extensions

This commit is contained in:
Sander van der Burg 2020-11-01 21:52:35 +01:00 committed by Sander van der Burg
parent c3f981c6e6
commit 2b7089c881
3 changed files with 16 additions and 4 deletions

View File

@ -1,5 +1,5 @@
{createManagedProcess, apacheHttpd, cacheDir}:
{instanceSuffix ? "", instanceName ? "httpd${instanceSuffix}", configFile, initialize ? "", postInstall ? ""}:
{instanceSuffix ? "", instanceName ? "httpd${instanceSuffix}", configFile, initialize ? "", environment ? {}, postInstall ? ""}:
let
user = instanceName;
@ -7,7 +7,7 @@ let
in
createManagedProcess {
name = instanceName;
inherit instanceName initialize postInstall;
inherit instanceName initialize environment postInstall;
process = "${apacheHttpd}/bin/httpd";
args = [ "-f" configFile ];

View File

@ -22,7 +22,7 @@ in
simpleWebappApache = import ./simple-webapp-apache.nix {
inherit createManagedProcess logDir cacheDir runtimeDir forceDisableUserChange;
inherit (pkgs) stdenv apacheHttpd php writeTextFile;
inherit (pkgs) stdenv runCommand apacheHttpd php writeTextFile;
};
mysql = import ./mysql.nix {

View File

@ -1,4 +1,4 @@
{createManagedProcess, stdenv, apacheHttpd, php, writeTextFile, logDir, runtimeDir, cacheDir, forceDisableUserChange}:
{createManagedProcess, stdenv, runCommand, apacheHttpd, php, writeTextFile, logDir, runtimeDir, cacheDir, forceDisableUserChange}:
{instanceSuffix ? "", instanceName ? "httpd${instanceSuffix}", port ? 80, modules ? [], serverName ? "localhost", serverAdmin, documentRoot ? ./webapp, enablePHP ? false, enableCGI ? false, extraConfig ? "", postInstall ? ""}:
let
@ -32,11 +32,23 @@ let
++ stdenv.lib.optional enableCGI "cgi";
apacheLogDir = "${logDir}/${instanceName}";
phpIni = runCommand "php.ini"
{
preferLocalBuild = true;
}
''
cat ${php}/etc/php.ini > $out
cat ${php.phpIni} > $out
'';
in
import ./apache.nix {
inherit createManagedProcess apacheHttpd cacheDir;
} {
inherit instanceName postInstall;
environment = stdenv.lib.optionalAttrs enablePHP {
PHPRC = phpIni;
};
initialize = ''
mkdir -m0700 -p ${apacheLogDir}