2020-02-24 19:36:42 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2023-05-12 14:42:23 +02:00
|
|
|
[ -z "$REDIS_FQDN" ] && REDIS_FQDN=redis
|
|
|
|
|
2022-11-30 17:42:16 +01:00
|
|
|
term_proc() {
|
|
|
|
echo "Entrypoint FPM caught SIGTERM signal!"
|
|
|
|
echo "Killing process $master_pid"
|
|
|
|
kill -TERM "$master_pid" 2>/dev/null
|
|
|
|
}
|
|
|
|
|
|
|
|
trap term_proc SIGTERM
|
|
|
|
|
|
|
|
change_php_vars() {
|
2020-02-24 19:36:42 +01:00
|
|
|
for FILE in /etc/php/*/fpm/php.ini
|
2022-11-30 17:42:16 +01:00
|
|
|
do
|
2020-02-24 19:36:42 +01:00
|
|
|
[[ -e $FILE ]] || break
|
|
|
|
sed -i "s/memory_limit = .*/memory_limit = 2048M/" "$FILE"
|
|
|
|
sed -i "s/max_execution_time = .*/max_execution_time = 300/" "$FILE"
|
|
|
|
sed -i "s/upload_max_filesize = .*/upload_max_filesize = 50M/" "$FILE"
|
|
|
|
sed -i "s/post_max_size = .*/post_max_size = 50M/" "$FILE"
|
2023-05-12 14:42:23 +02:00
|
|
|
sed -i "s/session.save_handler = .*/session.save_handler = redis/" "$FILE"
|
|
|
|
sed -i "s|.*session.save_path = .*|session.save_path = 'tcp://${REDIS_FQDN}:6379'|" "$FILE"
|
2020-02-24 19:36:42 +01:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2023-04-13 16:02:02 +02:00
|
|
|
echo "Configure PHP | Change PHP values ..." && change_php_vars
|
2022-11-30 17:42:16 +01:00
|
|
|
|
2023-04-13 16:02:02 +02:00
|
|
|
echo "Configure PHP | Starting PHP FPM"
|
2022-11-30 17:42:16 +01:00
|
|
|
/usr/sbin/php-fpm7.4 -R -F & master_pid=$!
|
2020-02-24 19:36:42 +01:00
|
|
|
|
2022-11-30 17:42:16 +01:00
|
|
|
# Wait for it
|
|
|
|
wait "$master_pid"
|