diff --git a/configs/prod-php.ini b/configs/prod-php.ini index ad16d0b..e26ac7b 100644 --- a/configs/prod-php.ini +++ b/configs/prod-php.ini @@ -1496,7 +1496,15 @@ ldap.max_links = -1 ;dba.default_handler= [opcache] -; see /etc/php.d/10-opcache.ini +; Optimized for shared hosting — reduce idle memory footprint +; Default 128MB is excessive for most WordPress sites +opcache.memory_consumption = 64 +opcache.interned_strings_buffer = 8 +opcache.max_accelerated_files = 4000 +; Revalidate files every 60s in production (reduces stat() calls) +opcache.revalidate_freq = 60 +; Don't waste memory on CLI scripts +opcache.enable_cli = Off [curl] ; A default value for the CURLOPT_CAINFO option. This is required to be an diff --git a/scripts/detect-memory.sh b/scripts/detect-memory.sh index da27045..d6c5529 100755 --- a/scripts/detect-memory.sh +++ b/scripts/detect-memory.sh @@ -82,8 +82,8 @@ if [ "$CONTAINER_ROLE" != "httpd_only" ]; then PHP_FPM_PM=${FPM_PM:-ondemand} PHP_FPM_MAX_CHILDREN=${FPM_MAX_CHILDREN:-$calc_max_children} - PHP_FPM_PROCESS_IDLE_TIMEOUT=${FPM_PROCESS_IDLE_TIMEOUT:-10s} - PHP_FPM_MAX_REQUESTS=${FPM_MAX_REQUESTS:-500} + PHP_FPM_PROCESS_IDLE_TIMEOUT=${FPM_PROCESS_IDLE_TIMEOUT:-5s} + PHP_FPM_MAX_REQUESTS=${FPM_MAX_REQUESTS:-200} # Dynamic mode fallbacks (used if user overrides FPM_PM=dynamic) PHP_FPM_START_SERVERS=${FPM_START_SERVERS:-2}