first commit
This commit is contained in:
47
rootfs/opt/bitnami/scripts/php/postunpack.sh
Executable file
47
rootfs/opt/bitnami/scripts/php/postunpack.sh
Executable file
@ -0,0 +1,47 @@
|
||||
#!/bin/bash
|
||||
# Copyright Broadcom, Inc. All Rights Reserved.
|
||||
# SPDX-License-Identifier: APACHE-2.0
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
# set -o xtrace # Uncomment this line for debugging purposes
|
||||
|
||||
# Load libraries
|
||||
. /opt/bitnami/scripts/libphp.sh
|
||||
. /opt/bitnami/scripts/libfs.sh
|
||||
|
||||
# Load PHP-FPM environment variables
|
||||
. /opt/bitnami/scripts/php-env.sh
|
||||
|
||||
# PHP OPcache optimizations
|
||||
php_conf_set "opcache.interned_strings_buffer" "$PHP_DEFAULT_OPCACHE_INTERNED_STRINGS_BUFFER"
|
||||
php_conf_set "opcache.memory_consumption" "$PHP_DEFAULT_OPCACHE_MEMORY_CONSUMPTION"
|
||||
php_conf_set "opcache.file_cache" "$PHP_DEFAULT_OPCACHE_FILE_CACHE"
|
||||
|
||||
# PHP-FPM configuration
|
||||
php_conf_set "listen" "$PHP_FPM_DEFAULT_LISTEN_ADDRESS" "${PHP_CONF_DIR}/php-fpm.d/www.conf"
|
||||
|
||||
# TMP dir configuration
|
||||
php_conf_set "upload_tmp_dir" "${PHP_BASE_DIR}/tmp"
|
||||
php_conf_set "session.save_path" "${PHP_TMP_DIR}/session"
|
||||
|
||||
# Ensure directories used by PHP-FPM exist and have proper ownership and permissions
|
||||
for dir in "$PHP_CONF_DIR" "$PHP_DEFAULT_CONF_DIR" "${PHP_BASE_DIR}/tmp" "$PHP_TMP_DIR" "$PHP_FPM_LOGS_DIR" "${PHP_TMP_DIR}/session"; do
|
||||
ensure_dir_exists "$dir"
|
||||
chmod -R g+rwX "$dir"
|
||||
done
|
||||
|
||||
info "Disabling PHP-FPM daemon user/group configuration"
|
||||
mv "${PHP_CONF_DIR}/common.conf" "${PHP_CONF_DIR}/common.conf.disabled"
|
||||
touch "${PHP_CONF_DIR}/common.conf"
|
||||
|
||||
# Log to stdout/stderr for easy debugging
|
||||
ln -sf "/dev/stdout" "$PHP_FPM_LOG_FILE"
|
||||
php_conf_set "error_log" "/dev/stderr"
|
||||
|
||||
# Copy all initially generated configuration files to the default directory
|
||||
# (this is to avoid breaking when entrypoint is being overridden)
|
||||
cp -r "$PHP_CONF_DIR"/* "$PHP_DEFAULT_CONF_DIR"
|
37
rootfs/opt/bitnami/scripts/php/reload.sh
Executable file
37
rootfs/opt/bitnami/scripts/php/reload.sh
Executable file
@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
# Copyright Broadcom, Inc. All Rights Reserved.
|
||||
# SPDX-License-Identifier: APACHE-2.0
|
||||
|
||||
# shellcheck disable=SC1090,SC1091
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
# set -o xtrace # Uncomment this line for debugging purposes
|
||||
|
||||
# Load libraries
|
||||
. /opt/bitnami/scripts/libphp.sh
|
||||
. /opt/bitnami/scripts/liblog.sh
|
||||
. /opt/bitnami/scripts/libwebserver.sh
|
||||
|
||||
# Load PHP-FPM environment
|
||||
. /opt/bitnami/scripts/php-env.sh
|
||||
|
||||
# Load web server environment and functions
|
||||
. "/opt/bitnami/scripts/$(web_server_type)-env.sh"
|
||||
|
||||
error_code=0
|
||||
|
||||
if is_php_fpm_enabled; then
|
||||
if is_php_fpm_not_running; then
|
||||
error "php-fpm is not running"
|
||||
error_code=1
|
||||
else
|
||||
info "** Reloading PHP-FPM configuration **"
|
||||
php_fpm_reload
|
||||
fi
|
||||
else
|
||||
web_server_reload
|
||||
fi
|
||||
|
||||
exit "$error_code"
|
19
rootfs/opt/bitnami/scripts/php/restart.sh
Executable file
19
rootfs/opt/bitnami/scripts/php/restart.sh
Executable file
@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
# Copyright Broadcom, Inc. All Rights Reserved.
|
||||
# SPDX-License-Identifier: APACHE-2.0
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
# set -o xtrace # Uncomment this line for debugging purposes
|
||||
|
||||
# Load libraries
|
||||
. /opt/bitnami/scripts/libphp.sh
|
||||
|
||||
# Load PHP-FPM environment variables
|
||||
. /opt/bitnami/scripts/php-env.sh
|
||||
|
||||
/opt/bitnami/scripts/php/stop.sh
|
||||
/opt/bitnami/scripts/php/start.sh
|
21
rootfs/opt/bitnami/scripts/php/run.sh
Executable file
21
rootfs/opt/bitnami/scripts/php/run.sh
Executable file
@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
# Copyright Broadcom, Inc. All Rights Reserved.
|
||||
# SPDX-License-Identifier: APACHE-2.0
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
# set -o xtrace # Uncomment this line for debugging purposes
|
||||
|
||||
# Load libraries
|
||||
. /opt/bitnami/scripts/libphp.sh
|
||||
. /opt/bitnami/scripts/liblog.sh
|
||||
|
||||
# Load PHP-FPM environment variables
|
||||
. /opt/bitnami/scripts/php-env.sh
|
||||
|
||||
info "** Starting PHP-FPM **"
|
||||
declare -a args=("--pid" "$PHP_FPM_PID_FILE" "--fpm-config" "$PHP_FPM_CONF_FILE" "-c" "$PHP_CONF_DIR" "-F")
|
||||
exec "${PHP_FPM_SBIN_DIR}/php-fpm" "${args[@]}"
|
34
rootfs/opt/bitnami/scripts/php/setup.sh
Executable file
34
rootfs/opt/bitnami/scripts/php/setup.sh
Executable file
@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
# Copyright Broadcom, Inc. All Rights Reserved.
|
||||
# SPDX-License-Identifier: APACHE-2.0
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
# set -o xtrace # Uncomment this line for debugging purposes
|
||||
|
||||
# Load libraries
|
||||
. /opt/bitnami/scripts/libphp.sh
|
||||
. /opt/bitnami/scripts/libfs.sh
|
||||
. /opt/bitnami/scripts/libos.sh
|
||||
|
||||
# Load PHP-FPM environment variables
|
||||
. /opt/bitnami/scripts/php-env.sh
|
||||
|
||||
# Ensure PHP-FPM daemon user exists and required folder belongs to this user when running as 'root'
|
||||
if am_i_root; then
|
||||
ensure_user_exists "$PHP_FPM_DAEMON_USER" --group "$PHP_FPM_DAEMON_GROUP"
|
||||
ensure_dir_exists "$PHP_TMP_DIR"
|
||||
chown -R "${PHP_FPM_DAEMON_USER}:${PHP_FPM_DAEMON_GROUP}" "$PHP_TMP_DIR"
|
||||
# Enable daemon configuration
|
||||
if [[ ! -f "${PHP_CONF_DIR}/common.conf" ]]; then
|
||||
cp "${PHP_CONF_DIR}/common.conf.disabled" "${PHP_CONF_DIR}/common.conf"
|
||||
fi
|
||||
fi
|
||||
|
||||
php_initialize
|
||||
|
||||
# Fix logging issue when running as root
|
||||
! am_i_root || chmod o+w "$(readlink /dev/stdout)" "$(readlink /dev/stderr)"
|
34
rootfs/opt/bitnami/scripts/php/start.sh
Executable file
34
rootfs/opt/bitnami/scripts/php/start.sh
Executable file
@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
# Copyright Broadcom, Inc. All Rights Reserved.
|
||||
# SPDX-License-Identifier: APACHE-2.0
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
# set -o xtrace # Uncomment this line for debugging purposes
|
||||
|
||||
# Load libraries
|
||||
. /opt/bitnami/scripts/libphp.sh
|
||||
. /opt/bitnami/scripts/libos.sh
|
||||
. /opt/bitnami/scripts/liblog.sh
|
||||
|
||||
# Load PHP-FPM environment variables
|
||||
. /opt/bitnami/scripts/php-env.sh
|
||||
|
||||
error_code=0
|
||||
|
||||
if is_php_fpm_not_running; then
|
||||
nohup /opt/bitnami/scripts/php/run.sh >/dev/null 2>&1 &
|
||||
if ! retry_while "is_php_fpm_running"; then
|
||||
error "php-fpm did not start"
|
||||
error_code=1
|
||||
else
|
||||
info "php-fpm started"
|
||||
fi
|
||||
else
|
||||
info "php-fpm is already running"
|
||||
fi
|
||||
|
||||
exit "$error_code"
|
23
rootfs/opt/bitnami/scripts/php/status.sh
Executable file
23
rootfs/opt/bitnami/scripts/php/status.sh
Executable file
@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
# Copyright Broadcom, Inc. All Rights Reserved.
|
||||
# SPDX-License-Identifier: APACHE-2.0
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
# set -o xtrace # Uncomment this line for debugging purposes
|
||||
|
||||
# Load libraries
|
||||
. /opt/bitnami/scripts/libphp.sh
|
||||
. /opt/bitnami/scripts/liblog.sh
|
||||
|
||||
# Load PHP-FPM environment variables
|
||||
. /opt/bitnami/scripts/php-env.sh
|
||||
|
||||
if is_php_fpm_running; then
|
||||
info "php-fpm is already running"
|
||||
else
|
||||
info "php-fpm is not running"
|
||||
fi
|
34
rootfs/opt/bitnami/scripts/php/stop.sh
Executable file
34
rootfs/opt/bitnami/scripts/php/stop.sh
Executable file
@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
# Copyright Broadcom, Inc. All Rights Reserved.
|
||||
# SPDX-License-Identifier: APACHE-2.0
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
# set -o xtrace # Uncomment this line for debugging purposes
|
||||
|
||||
# Load libraries
|
||||
. /opt/bitnami/scripts/libphp.sh
|
||||
. /opt/bitnami/scripts/libos.sh
|
||||
. /opt/bitnami/scripts/liblog.sh
|
||||
|
||||
# Load PHP-FPM environment variables
|
||||
. /opt/bitnami/scripts/php-env.sh
|
||||
|
||||
error_code=0
|
||||
|
||||
if is_php_fpm_running; then
|
||||
BITNAMI_QUIET=1 php_fpm_stop
|
||||
if ! retry_while "is_php_fpm_not_running"; then
|
||||
error "php-fpm could not be stopped"
|
||||
error_code=1
|
||||
else
|
||||
info "php-fpm stopped"
|
||||
fi
|
||||
else
|
||||
info "php-fpm is not running"
|
||||
fi
|
||||
|
||||
exit "$error_code"
|
Reference in New Issue
Block a user