diff --git a/src/freedombone-app-nextcloud b/src/freedombone-app-nextcloud index 444d188288b2fca7243c49828a2ef768c3246754..308c48874f41a9860056dd82548eddce16bf4a76 100755 --- a/src/freedombone-app-nextcloud +++ b/src/freedombone-app-nextcloud @@ -248,8 +248,8 @@ function nextcloud_update_files { } function upgrade_nextcloud_base { - nextcloud_check_php_init /etc/php/7.0/cli/php.ini - nextcloud_check_php_init /etc/php/7.0/fpm/php.ini + nextcloud_check_php_init "/etc/php/${PHP_VERSION}/cli/php.ini" + nextcloud_check_php_init "/etc/php/${PHP_VERSION}/fpm/php.ini" # shellcheck disable=SC2086 systemctl restart php${PHP_VERSION}-fpm @@ -378,7 +378,7 @@ function remove_nextcloud { function_check remove_nodejs remove_nodejs pleroma-nextcloud - sed -i 's|env[PATH]|;env[PATH]|g' /etc/php/7.0/fpm/pool.d/www.conf + sed -i 's|env[PATH]|;env[PATH]|g' "/etc/php/${PHP_VERSION}/fpm/pool.d/www.conf" read_config_param "NEXTCLOUD_DOMAIN_NAME" read_config_param "MY_USERNAME" @@ -434,11 +434,11 @@ function install_nextcloud_main { $INSTALL_PACKAGES php-zip # Ensure PATH is available to php - if [ ! -f /etc/php/7.0/fpm/pool.d/www.conf ]; then + if [ ! -f "/etc/php/${PHP_VERSION}/fpm/pool.d/www.conf" ]; then echo $'No php www configuration file found' exit 628757 fi - sed -i 's|;env[PATH]|env[PATH]|g' /etc/php/7.0/fpm/pool.d/www.conf + sed -i 's|;env[PATH]|env[PATH]|g' "/etc/php/${PHP_VERSION}/fpm/pool.d/www.conf" if [ ! -d "/var/www/$NEXTCLOUD_DOMAIN_NAME" ]; then mkdir "/var/www/$NEXTCLOUD_DOMAIN_NAME" @@ -712,8 +712,8 @@ function install_nextcloud_main { setup_nextcloud_turn - nextcloud_check_php_init /etc/php/7.0/cli/php.ini - nextcloud_check_php_init /etc/php/7.0/fpm/php.ini + nextcloud_check_php_init "/etc/php/${PHP_VERSION}/cli/php.ini" + nextcloud_check_php_init "/etc/php/${PHP_VERSION}/fpm/php.ini" set_completion_param "nextcloud domain" "$NEXTCLOUD_DOMAIN_NAME" diff --git a/src/freedombone-app-postactiv b/src/freedombone-app-postactiv index 1dbd01eb3dedee289a3c874e970e46c43b090c98..02abd05b73b7f6eb0a7dcd737e80686502869af1 100755 --- a/src/freedombone-app-postactiv +++ b/src/freedombone-app-postactiv @@ -533,8 +533,8 @@ function remove_postactiv { remove_backup_database_local postactiv sed -i '/postactiv-firewall/d' /etc/crontab - sed -i 's|mysqli.allow_persistent.*|mysqli.allow_persistent = On|g' /etc/php/7.0/cli/php.ini - sed -i 's|mysqli.reconnect.*|mysqli.reconnect = Off|g' /etc/php/7.0/cli/php.ini + sed -i 's|mysqli.allow_persistent.*|mysqli.allow_persistent = On|g' "/etc/php/${PHP_VERSION}/cli/php.ini" + sed -i 's|mysqli.reconnect.*|mysqli.reconnect = Off|g' "/etc/php/${PHP_VERSION}/cli/php.ini" if [ -f /usr/bin/postactiv-firewall ]; then rm /usr/bin/postactiv-firewall @@ -835,8 +835,8 @@ function install_postactiv_main { fi # php configuration - sed -i 's|mysqli.allow_persistent.*|mysqli.allow_persistent = On|g' /etc/php/7.0/cli/php.ini - sed -i 's|mysqli.reconnect.*|mysqli.reconnect = On|g' /etc/php/7.0/cli/php.ini + sed -i 's|mysqli.allow_persistent.*|mysqli.allow_persistent = On|g' "/etc/php/${PHP_VERSION}/cli/php.ini" + sed -i 's|mysqli.reconnect.*|mysqli.reconnect = On|g' "/etc/php/${PHP_VERSION}/cli/php.ini" systemctl restart mariadb # shellcheck disable=SC2086 diff --git a/src/freedombone-base-email b/src/freedombone-base-email index 0ae4218be08e264778084d4e22b76d3a89be01fa..f07048dda20a15c7f86aef6dfd831c6e727033e9 100755 --- a/src/freedombone-base-email +++ b/src/freedombone-base-email @@ -1933,7 +1933,7 @@ function install_email { function remove_ip_addresses_from_email_logs { { echo '#!/bin/bash'; echo ''; - echo 'if grep -q "= /dev/null" /etc/php/7.0/fpm/php-fpm.conf; then'; + echo "if grep -q \"= /dev/null\" /etc/php/${PHP_VERSION}/fpm/php-fpm.conf; then"; echo ' if [ -f /var/log/exim4/mainlog ]; then'; echo ' rm /var/log/exim4/mainlog'; echo ' fi'; diff --git a/src/freedombone-logging b/src/freedombone-logging index 86999aa40b88bb2e127447aab568997f9d543534..f5c0c1df0b3682ea6332627d4376a89679ceacf4 100755 --- a/src/freedombone-logging +++ b/src/freedombone-logging @@ -136,8 +136,8 @@ if [[ "$1" == "on" || "$1" == "On" || "$1" == "ON" ]]; then fi echo 'Log notice file /var/log/tor/notices.log' > /etc/torrc.d/logging fi - if [ -f /etc/php/7.0/fpm/php-fpm.conf ]; then - sed -i 's|error_log =.*|error_log = /var/log/php-fpm.log|g' /etc/php/7.0/fpm/php-fpm.conf + if [ -f "/etc/php/${PHP_VERSION}/fpm/php-fpm.conf" ]; then + sed -i 's|error_log =.*|error_log = /var/log/php-fpm.log|g' "/etc/php/${PHP_VERSION}/fpm/php-fpm.conf" fi if [ -d /etc/nginx ]; then if [ ! -d /var/log/nginx ]; then @@ -191,8 +191,8 @@ else $REMOVE_FILES_COMMAND /var/log/radicale/* rm -rf /var/log/radicale fi - if [ -f /etc/php/7.0/fpm/php-fpm.conf ]; then - sed -i 's|error_log =.*|error_log = /dev/null|g' /etc/php/7.0/fpm/php-fpm.conf + if [ -f "/etc/php/${PHP_VERSION}/fpm/php-fpm.conf" ]; then + sed -i 's|error_log =.*|error_log = /dev/null|g' "/etc/php/${PHP_VERSION}/fpm/php-fpm.conf" $REMOVE_FILES_COMMAND /var/log/php-fpm.* fi if [ -d /etc/nginx ]; then diff --git a/src/freedombone-utils-web b/src/freedombone-utils-web index 0e7fcb5fa612971273fcc5fb615cd974505b351d..fb40f5ff5f39776dc601c05e001bf81c1a5179c1 100755 --- a/src/freedombone-utils-web +++ b/src/freedombone-utils-web @@ -460,12 +460,12 @@ function letsencrypt_renewals { } function configure_php { - sed -i "s/memory_limit =.*/memory_limit = ${MAX_PHP_MEMORY}M/g" /etc/php/7.0/fpm/php.ini - sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /etc/php/7.0/fpm/php.ini - sed -i "s/memory_limit =.*/memory_limit = ${MAX_PHP_MEMORY}M/g" /etc/php/7.0/cli/php.ini - sed -i "s/upload_max_filesize =.*/upload_max_filesize = 50M/g" /etc/php/7.0/fpm/php.ini - sed -i "s/upload_max_filesize =.*/upload_max_filesize = 50M/g" /etc/php/7.0/cli/php.ini - sed -i "s/post_max_size =.*/post_max_size = 50M/g" /etc/php/7.0/fpm/php.ini + sed -i "s/memory_limit =.*/memory_limit = ${MAX_PHP_MEMORY}M/g" "/etc/php/${PHP_VERSION}/fpm/php.ini" + sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' "/etc/php/${PHP_VERSION}/fpm/php.ini" + sed -i "s/memory_limit =.*/memory_limit = ${MAX_PHP_MEMORY}M/g" "/etc/php/${PHP_VERSION}/cli/php.ini" + sed -i "s/upload_max_filesize =.*/upload_max_filesize = 50M/g" "/etc/php/${PHP_VERSION}/fpm/php.ini" + sed -i "s/upload_max_filesize =.*/upload_max_filesize = 50M/g" "/etc/php/${PHP_VERSION}/cli/php.ini" + sed -i "s/post_max_size =.*/post_max_size = 50M/g" "/etc/php/${PHP_VERSION}/fpm/php.ini" } function install_web_server_access_control { @@ -682,31 +682,31 @@ function image_install_web_server { sed -i 's|error_log.*|error_log = /dev/null;|g' "$rootdir/etc/nginx/nginx.conf" # limit the number of php processes - if [ -f "$rootdir/etc/php/7.0/fpm/php-fpm.conf" ]; then - sed -i 's/; process.max =.*/process.max = 32/g' "$rootdir/etc/php/7.0/fpm/php-fpm.conf" - #sed -i 's/;process_control_timeout =.*/process_control_timeout = 300/g' "$rootdir/etc/php/7.0/fpm/php-fpm.conf" - sed -i 's|;systemd_interval.*|systemd_interval = 10|g' "$rootdir/etc/php/7.0/fpm/php-fpm.conf" - sed -i 's|;emergency_restart_threshold.*|emergency_restart_threshold = 2|g' "$rootdir/etc/php/7.0/fpm/php-fpm.conf" - sed -i 's|emergency_restart_threshold.*|emergency_restart_threshold = 2|g' "$rootdir/etc/php/7.0/fpm/php-fpm.conf" - sed -i 's|;emergency_restart_interval.*|emergency_restart_interval = 1m|g' "$rootdir/etc/php/7.0/fpm/php-fpm.conf" - sed -i 's|emergency_restart_interval.*|emergency_restart_interval = 1m|g' "$rootdir/etc/php/7.0/fpm/php-fpm.conf" - sed -i 's|;process_control_timeout.*|process_control_timeout = 10s|g' "$rootdir/etc/php/7.0/fpm/php-fpm.conf" - sed -i 's|process_control_timeout.*|process_control_timeout = 10s|g' "$rootdir/etc/php/7.0/fpm/php-fpm.conf" - - if ! grep -q "pm.max_children" "$rootdir/etc/php/7.0/fpm/php-fpm.conf"; then + if [ -f "$rootdir/etc/php/${PHP_VERSION}/fpm/php-fpm.conf" ]; then + sed -i 's/; process.max =.*/process.max = 32/g' "$rootdir/etc/php/${PHP_VERSION}/fpm/php-fpm.conf" + #sed -i 's/;process_control_timeout =.*/process_control_timeout = 300/g' "$rootdir/etc/php/${PHP_VERSION}/fpm/php-fpm.conf" + sed -i 's|;systemd_interval.*|systemd_interval = 10|g' "$rootdir/etc/php/${PHP_VERSION}/fpm/php-fpm.conf" + sed -i 's|;emergency_restart_threshold.*|emergency_restart_threshold = 2|g' "$rootdir/etc/php/${PHP_VERSION}/fpm/php-fpm.conf" + sed -i 's|emergency_restart_threshold.*|emergency_restart_threshold = 2|g' "$rootdir/etc/php/${PHP_VERSION}/fpm/php-fpm.conf" + sed -i 's|;emergency_restart_interval.*|emergency_restart_interval = 1m|g' "$rootdir/etc/php/${PHP_VERSION}/fpm/php-fpm.conf" + sed -i 's|emergency_restart_interval.*|emergency_restart_interval = 1m|g' "$rootdir/etc/php/${PHP_VERSION}/fpm/php-fpm.conf" + sed -i 's|;process_control_timeout.*|process_control_timeout = 10s|g' "$rootdir/etc/php/${PHP_VERSION}/fpm/php-fpm.conf" + sed -i 's|process_control_timeout.*|process_control_timeout = 10s|g' "$rootdir/etc/php/${PHP_VERSION}/fpm/php-fpm.conf" + + if ! grep -q "pm.max_children" "$rootdir/etc/php/${PHP_VERSION}/fpm/php-fpm.conf"; then { echo 'pm = static'; echo 'pm.max_children = 10'; echo 'pm.start_servers = 2'; echo 'pm.min_spare_servers = 2'; echo 'pm.max_spare_servers = 5'; - echo 'pm.max_requests = 10'; } >> "$rootdir/etc/php/7.0/fpm/php-fpm.conf" + echo 'pm.max_requests = 10'; } >> "$rootdir/etc/php/${PHP_VERSION}/fpm/php-fpm.conf" fi - if ! grep -q "request_terminate_timeout" "$rootdir/etc/php/7.0/fpm/php-fpm.conf"; then - echo 'request_terminate_timeout = 30' >> "$rootdir/etc/php/7.0/fpm/php-fpm.conf" + if ! grep -q "request_terminate_timeout" "$rootdir/etc/php/${PHP_VERSION}/fpm/php-fpm.conf"; then + echo 'request_terminate_timeout = 30' >> "$rootdir/etc/php/${PHP_VERSION}/fpm/php-fpm.conf" else - sed -i 's|request_terminate_timeout =.*|request_terminate_timeout = 30|g' >> "$rootdir/etc/php/7.0/fpm/php-fpm.conf" + sed -i 's|request_terminate_timeout =.*|request_terminate_timeout = 30|g' >> "$rootdir/etc/php/${PHP_VERSION}/fpm/php-fpm.conf" fi - sed -i 's|max_execution_time =.*|max_execution_time = 30|g' "$rootdir/etc/php/7.0/fpm/php.ini" + sed -i 's|max_execution_time =.*|max_execution_time = 30|g' "$rootdir/etc/php/${PHP_VERSION}/fpm/php.ini" fi if [ ! -d "$rootdir/etc/nginx" ]; then @@ -826,30 +826,30 @@ function install_web_server { sed -i 's|error_log.*|error_log = /dev/null;|g' /etc/nginx/nginx.conf # limit the number of php processes - sed -i 's/; process.max =.*/process.max = 32/g' /etc/php/7.0/fpm/php-fpm.conf - #sed -i 's/;process_control_timeout =.*/process_control_timeout = 300/g' /etc/php/7.0/fpm/php-fpm.conf - sed -i 's|;systemd_interval.*|systemd_interval = 10|g' /etc/php/7.0/fpm/php-fpm.conf - sed -i 's|;emergency_restart_threshold.*|emergency_restart_threshold = 2|g' /etc/php/7.0/fpm/php-fpm.conf - sed -i 's|emergency_restart_threshold.*|emergency_restart_threshold = 2|g' /etc/php/7.0/fpm/php-fpm.conf - sed -i 's|;emergency_restart_interval.*|emergency_restart_interval = 1m|g' /etc/php/7.0/fpm/php-fpm.conf - sed -i 's|emergency_restart_interval.*|emergency_restart_interval = 1m|g' /etc/php/7.0/fpm/php-fpm.conf - sed -i 's|;process_control_timeout.*|process_control_timeout = 10s|g' /etc/php/7.0/fpm/php-fpm.conf - sed -i 's|process_control_timeout.*|process_control_timeout = 10s|g' /etc/php/7.0/fpm/php-fpm.conf - - if ! grep -q "pm.max_children" /etc/php/7.0/fpm/php-fpm.conf; then + sed -i 's/; process.max =.*/process.max = 32/g' "/etc/php/${PHP_VERSION}/fpm/php-fpm.conf" + #sed -i 's/;process_control_timeout =.*/process_control_timeout = 300/g' "/etc/php/${PHP_VERSION}/fpm/php-fpm.conf" + sed -i 's|;systemd_interval.*|systemd_interval = 10|g' "/etc/php/${PHP_VERSION}/fpm/php-fpm.conf" + sed -i 's|;emergency_restart_threshold.*|emergency_restart_threshold = 2|g' "/etc/php/${PHP_VERSION}/fpm/php-fpm.conf" + sed -i 's|emergency_restart_threshold.*|emergency_restart_threshold = 2|g' "/etc/php/${PHP_VERSION}/fpm/php-fpm.conf" + sed -i 's|;emergency_restart_interval.*|emergency_restart_interval = 1m|g' "/etc/php/${PHP_VERSION}/fpm/php-fpm.conf" + sed -i 's|emergency_restart_interval.*|emergency_restart_interval = 1m|g' "/etc/php/${PHP_VERSION}/fpm/php-fpm.conf" + sed -i 's|;process_control_timeout.*|process_control_timeout = 10s|g' "/etc/php/${PHP_VERSION}/fpm/php-fpm.conf" + sed -i 's|process_control_timeout.*|process_control_timeout = 10s|g' "/etc/php/${PHP_VERSION}/fpm/php-fpm.conf" + + if ! grep -q "pm.max_children" "/etc/php/${PHP_VERSION}/fpm/php-fpm.conf"; then { echo 'pm = static'; echo 'pm.max_children = 10'; echo 'pm.start_servers = 2'; echo 'pm.min_spare_servers = 2'; echo 'pm.max_spare_servers = 5'; - echo 'pm.max_requests = 10'; } >> /etc/php/7.0/fpm/php-fpm.conf + echo 'pm.max_requests = 10'; } >> "/etc/php/${PHP_VERSION}/fpm/php-fpm.conf" fi - if ! grep -q "request_terminate_timeout" /etc/php/7.0/fpm/php-fpm.conf; then - echo 'request_terminate_timeout = 30' >> /etc/php/7.0/fpm/php-fpm.conf + if ! grep -q "request_terminate_timeout" "/etc/php/${PHP_VERSION}/fpm/php-fpm.conf"; then + echo 'request_terminate_timeout = 30' >> "/etc/php/${PHP_VERSION}/fpm/php-fpm.conf" else - sed -i 's|request_terminate_timeout =.*|request_terminate_timeout = 30|g' >> /etc/php/7.0/fpm/php-fpm.conf + sed -i 's|request_terminate_timeout =.*|request_terminate_timeout = 30|g' >> "/etc/php/${PHP_VERSION}/fpm/php-fpm.conf" fi - sed -i 's|max_execution_time =.*|max_execution_time = 30|g' /etc/php/7.0/fpm/php.ini + sed -i 's|max_execution_time =.*|max_execution_time = 30|g' "/etc/php/${PHP_VERSION}/fpm/php.ini" if [ ! -d /etc/nginx ]; then echo $"ERROR: nginx does not appear to have installed. $CHECK_MESSAGE" diff --git a/src/freedombone-utils-webadmin b/src/freedombone-utils-webadmin index 3390e8d973ec252a20a1513fd8cac77cc01f96ea..ad91389fe7a965b2481e8e8684a298ac019d1995 100755 --- a/src/freedombone-utils-webadmin +++ b/src/freedombone-utils-webadmin @@ -1396,13 +1396,13 @@ function web_admin_php_settings { chown www-data:www-data /var/local/squirrelmail/attach fi - sed -i "s|;upload_tmp_dir =|upload_tmp_dir =|g" /etc/php/7.0/fpm/php.ini - sed -i "s|;upload_tmp_dir =|upload_tmp_dir =|g" /etc/php/7.0/cli/php.ini + sed -i "s|;upload_tmp_dir =|upload_tmp_dir =|g" "/etc/php/${PHP_VERSION}/fpm/php.ini" + sed -i "s|;upload_tmp_dir =|upload_tmp_dir =|g" "/etc/php/${PHP_VERSION}/cli/php.ini" - sed -i "s|upload_tmp_dir =.*|upload_tmp_dir = $php_upload_dir|g" /etc/php/7.0/fpm/php.ini - sed -i "s|upload_tmp_dir =.*|upload_tmp_dir = $php_upload_dir|g" /etc/php/7.0/cli/php.ini - sed -i "s|upload_max_filesize =.*|upload_max_filesize = $php_max_upload|g" /etc/php/7.0/fpm/php.ini - sed -i "s|upload_max_filesize =.*|upload_max_filesize = $php_max_upload|g" /etc/php/7.0/cli/php.ini + sed -i "s|upload_tmp_dir =.*|upload_tmp_dir = $php_upload_dir|g" "/etc/php/${PHP_VERSION}/fpm/php.ini" + sed -i "s|upload_tmp_dir =.*|upload_tmp_dir = $php_upload_dir|g" "/etc/php/${PHP_VERSION}/cli/php.ini" + sed -i "s|upload_max_filesize =.*|upload_max_filesize = $php_max_upload|g" "/etc/php/${PHP_VERSION}/fpm/php.ini" + sed -i "s|upload_max_filesize =.*|upload_max_filesize = $php_max_upload|g" "/etc/php/${PHP_VERSION}/cli/php.ini" } function install_web_admin_webmail {