2023-01-15 06:51:11 +01:00
|
|
|
{ lib
|
2022-09-15 05:46:14 +02:00
|
|
|
, pkgs
|
|
|
|
|
2023-01-15 06:51:11 +01:00
|
|
|
, siteName
|
|
|
|
, prependFile ? null
|
|
|
|
, extensions ? [
|
2022-09-15 05:46:14 +02:00
|
|
|
# "bcmath"
|
|
|
|
# "curl"
|
|
|
|
# "gd"
|
|
|
|
# "gmp"
|
|
|
|
# "iconv"
|
|
|
|
# "imagick"
|
|
|
|
# "intl"
|
|
|
|
# "ldap"
|
|
|
|
# "pdo_pgsql"
|
|
|
|
# "pdo_sqlite"
|
|
|
|
# "pgsql"
|
|
|
|
# "soap"
|
|
|
|
# "sqlite3"
|
|
|
|
# "zip"
|
2023-01-15 06:51:11 +01:00
|
|
|
]
|
|
|
|
, zend_extensions ? [
|
2022-09-15 05:46:14 +02:00
|
|
|
# "opcache"
|
2023-01-15 06:51:11 +01:00
|
|
|
]
|
|
|
|
}:
|
2022-09-15 05:46:14 +02:00
|
|
|
|
2023-01-15 06:51:11 +01:00
|
|
|
let
|
2022-09-15 05:46:14 +02:00
|
|
|
concatWithPrefix = prefix: content:
|
|
|
|
lib.strings.concatMapStrings
|
|
|
|
(x: prefix + x + "\n")
|
|
|
|
content;
|
|
|
|
in
|
|
|
|
|
2023-01-15 06:51:11 +01:00
|
|
|
pkgs.writeText "php-${siteName}.ini" ''
|
2022-09-15 05:46:14 +02:00
|
|
|
[PHP]
|
|
|
|
engine = On
|
|
|
|
short_open_tag = Off
|
|
|
|
precision = 14
|
|
|
|
output_buffering = 4096
|
|
|
|
zlib.output_compression = Off
|
|
|
|
implicit_flush = Off
|
|
|
|
serialize_precision = -1
|
|
|
|
zend.enable_gc = On
|
|
|
|
zend.exception_ignore_args = On
|
|
|
|
expose_php = Off
|
|
|
|
max_execution_time = 30 ; seconds
|
|
|
|
max_input_time = 60
|
|
|
|
memory_limit = 1024M
|
|
|
|
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
|
|
|
|
display_errors = Off
|
|
|
|
display_startup_errors = Off
|
|
|
|
log_errors = On
|
|
|
|
log_errors_max_len = 1024
|
|
|
|
ignore_repeated_errors = On
|
|
|
|
ignore_repeated_source = On
|
|
|
|
report_memleaks = On
|
|
|
|
error_log = syslog
|
|
|
|
syslog.ident = php
|
|
|
|
|
2022-09-29 08:32:30 +02:00
|
|
|
cgi.fix_pathinfo=1
|
|
|
|
|
2022-09-15 05:46:14 +02:00
|
|
|
post_max_size = 8M
|
|
|
|
|
|
|
|
auto_prepend_file = "${if prependFile == null then "" else prependFile}"
|
|
|
|
auto_append_file =
|
|
|
|
|
|
|
|
extension_dir = "/usr/lib/php/modules/"
|
|
|
|
|
|
|
|
${concatWithPrefix "extension=" extensions}
|
|
|
|
${concatWithPrefix "zend_extension=" zend_extensions}
|
|
|
|
|
|
|
|
[CLI Server]
|
|
|
|
cli_server.color = On
|
|
|
|
|
|
|
|
; [PostgreSQL]
|
|
|
|
; pgsql.allow_persistent = On
|
|
|
|
; pgsql.auto_reset_persistent = Off
|
|
|
|
; pgsql.max_persistent = -1
|
|
|
|
; pgsql.max_links = -1
|
|
|
|
; pgsql.ignore_notice = 0
|
|
|
|
; pgsql.log_notice = 0
|
|
|
|
|
|
|
|
; [Session]
|
|
|
|
; session.save_handler = redis
|
|
|
|
; session.save_path = "unix:///run/redis/redis.sock?database=1"
|
|
|
|
; session.use_strict_mode = 1
|
|
|
|
; session.use_cookies = 1
|
|
|
|
; session.use_only_cookies = 1
|
|
|
|
|
|
|
|
; [opcache]
|
|
|
|
; opcache.enable=1
|
|
|
|
; opcache.memory_consumption=128
|
|
|
|
; opcache.interned_strings_buffer=16
|
|
|
|
; opcache.max_accelerated_files=20000
|
2023-01-15 06:51:11 +01:00
|
|
|
''
|