HEX
Server: Apache/2.4.65 (Debian)
System: Linux srv39710 6.1.0-41-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.158-1 (2025-11-09) x86_64
User: root (0)
PHP: 8.4.11
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
Upload Files
File: /var/lib/dpkg/info/ispmanager-pkg-phpfpm.postinst
#!/bin/bash
# postinst script for coremanager
#
# see: dh_installdeb(1)

#set -e

# summary of how this script can be called:
#        * <postinst> `configure' <most-recently-configured-version>
#        * <old-postinst> `abort-upgrade' <new version>
#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
#          <new-version>
#        * <postinst> `abort-remove'
#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
#          <failed-install-package> <version> `removing'
#          <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package

COREDIR=/usr/local/mgr5
CONFNAME=phpfpm.conf
. ${COREDIR}/lib/pkgsh/core_pkg_funcs.sh
. ${COREDIR}/lib/pkgsh/ispmgr_pkg_funcs.sh

if [ "$(lsb_release -s -c)" = "focal" ] || [ "$(lsb_release -s -c)" = "bullseye" ] || [ -f /etc/php/7.4/fpm/php.ini ]; then
	PHPETC=/etc/php/7.4
	PHPMOD=php
	FPMSERVICE=php7.4-fpm
elif [ "$(lsb_release -s -c)" = "buster" ] || [ -f /etc/php/7.3/fpm/php.ini ]; then
	PHPETC=/etc/php/7.3
	PHPMOD=php
	FPMSERVICE=php7.3-fpm
elif [ "$(lsb_release -s -c)" = "bionic" ] || [ -f /etc/php/7.2/fpm/php.ini ]; then
	PHPETC=/etc/php/7.2
	PHPMOD=php
	FPMSERVICE=php7.2-fpm
elif [ "$(lsb_release -s -c)" = "xenial" ] || [ -f /etc/php/7.0/fpm/php.ini ]; then
	PHPETC=/etc/php/7.0
	PHPMOD=php
	FPMSERVICE=php7.0-fpm
elif [ "$(lsb_release -s -c)" = "jammy" ] || [ -f /etc/php/8.1/fpm/php.ini ]; then
	PHPETC=/etc/php/8.1
	PHPMOD=php
	FPMSERVICE=php8.1-fpm
elif [ "$(lsb_release -s -c)" = "bookworm" ] || [ -f /etc/php/8.2/fpm/php.ini ]; then
	PHPETC=/etc/php/8.2
	PHPMOD=php
	FPMSERVICE=php8.2-fpm
elif [ "$(lsb_release -s -c)" = "noble" ] || [ -f /etc/php/8.3/fpm/php.ini ]; then
	PHPETC=/etc/php/8.3
	PHPMOD=php
	FPMSERVICE=php8.3-fpm
else
	PHPETC=/etc/php5
	PHPMOD=php5
	FPMSERVICE=php5-fpm
fi
CONFDIR=${PHPETC}/fpm
CONFFILE=${CONFDIR}/php.ini

case "$1" in
    configure)

	# При service php5-fpm reload, он перетирает PID, но не перезапускается, и приходится деелать killall php5-fpm
	# Данная строка, вроде, фиксит это.
	if [ -f /etc/init/php5-fpm.conf ]; then
		grep -qE "^reload signal USR2" /etc/init/php5-fpm.conf || sed -i -r "/reload signal USR2/s|^#\s*||" /etc/init/php5-fpm.conf
		if [ -z ${2} ]; then
			killall php5-fpm >/dev/null 2>&1 ||:
		fi
	fi

	if [ -z ${2} ]; then
		if [ "#${ISPCONVERT}" = "#yes" ]; then
			PATHLIST="fpm-service fpm-pool.d fpm-sock.d php_fpm_ini php_bin php_cfg php_ini php_ver"
			PathConvert ${COREDIR}/etc/conf.d/phpfpm.conf
			MakeConfigLink phpfpm
			ReloadMgr ${ISPMGR}
		else

			TZ=$(cat /etc/timezone)
			grep -q "^date.timezone =" ${CONFFILE} || sed -i -r "s|;date.timezone =|date.timezone = ${TZ}|" ${CONFFILE}
			grep -qiE '^\s*short_open_tag\s*=\s*off' ${CONFFILE} && sed -i -r 's/(^\s*short_open_tag\s*=\s*)off/\1On/gi' ${CONFFILE}

			EnableService ${FPMSERVICE}
			MakeConfigLink phpfpm

			if ! grep -qE "^\s*path\s+php_ext" ${COREDIR}/etc/${ISPMGR}.conf.d/${CONFNAME}; then
				PATH_PHP_EXT=$(php -i | awk '$1 == "extension_dir" {print $3}')
				echo "path php_ext ${PATH_PHP_EXT}" >> ${COREDIR}/etc/${ISPMGR}.conf.d/${CONFNAME}
			fi

			PHP_VER=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;")
			grep -q "path php_ver" ${COREDIR}/etc/${ISPMGR}.conf.d/${CONFNAME} || echo "path php_ver ${PHP_VER}" >> ${COREDIR}/etc/${ISPMGR}.conf.d/${CONFNAME}

			AddPath php_cfg_fpm ${PHPETC}/fpm/conf.d phpfpm
			if ! echo "${FPMSERVICE}" | grep -q php5 ; then
				sed -i -r '/path fpm-service/d' ${COREDIR}/etc/${ISPMGR}.conf.d/${CONFNAME}
				AddPath fpm-service ${FPMSERVICE} phpfpm
			fi
			ReloadMgr ${ISPMGR}

			ServiceAddmon ${FPMSERVICE}

			# Afterinstall
			AfterinstallModule ${ISPMGR} phpfpm
		fi
	fi
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)
    ;;

    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.



exit 0