HEX
Server: nginx/1.18.0
System: Linux hqnl0246134.online-vm.com 5.4.0-135-generic #152-Ubuntu SMP Wed Nov 23 20:19:22 UTC 2022 x86_64
User: www-data (33)
PHP: 7.4.33
Disabled: phpinfo,disk_free_space,disk_total_space,diskfreespace,dl,exec,opcache_get_configuration,opcache_get_status,passthru,pclose,pcntl_alarm,pcntl_exec,pcntl_fork,pcntl_get_last_error,pcntl_getpriority,pcntl_setpriority,pcntl_signal,pcntl_signal_dispatch,pcntl_sigprocmask,pcntl_sigtimedwait,pcntl_sigwaitinfo,pcntl_strerror,pcntl_waitpid,pcntl_wait,pcntl_wexitstatus,pcntl_wifcontinued,pcntl_wifexited,pcntl_wifsignaled,pcntl_wifstopped,pcntl_wstopsig,pcntl_wtermsig,popen,posix_getpwuid,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,posix_uname,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,show_source,system,exec,passthru,shell_exec,system,popen,curl_exec,curl_multi_exec,parse_ini_file,show_source
Upload Files
File: /var/lib/dpkg/info/alt-php-internal.postinst
#!/bin/bash

major_ver=8
minor_ver=2
patch_ver=25
php_version="${major_ver}${minor_ver}"
php_version_dot="${major_ver}.${minor_ver}"
php_version_slash="${major_ver}\.${minor_ver}"
name='alt-php'
version="${major_ver}.${minor_ver}.${patch_ver}"
altdir="/opt/alt/php${php_version}"
_prefix='/usr'
_sysconfdir='/etc'
_bindir="${_prefix}/bin"
_sbindir="${_prefix}/sbin"

__imunify=1

if [ -n "${__imunify}" ]; then
    altdir="/opt/alt/php-internal"
fi

if [ -n "${__imunify}" ]; then
    find ${altdir} -type f -exec chmod 700 {} \;
    chmod 700 ${altdir}${_sysconfdir}/php.d
    chmod 700 ${altdir}/link
    chmod 5700 ${altdir}/var/lib/php/session
    chmod 600 ${altdir}${_sysconfdir}/php.d/default.ini
    chmod 700 ${altdir}${_libdir}/php
    chmod 700 ${altdir}${_libdir}/php/modules
    chmod 700 ${altdir}${_includedir}/php
    chmod 700 ${altdir}${_includedir}/php/ext
else
    [ -x /usr/bin/cl-linksafe-apply-group ] && /usr/bin/cl-linksafe-apply-group ${name}${php_version} || :
    chmod 5733 ${altdir}/var/lib/php/session
fi

if [ -z "${__imunify}" ]; then
    echo "${name}-${version}" >> /opt/alt/alt_php.status
    if [ -x /opt/alt/alt-php-config/multiphp_reconfigure.py ]; then
        /opt/alt/alt-php-config/multiphp_reconfigure.py --php ${php_version}
    fi

    # Enable nd_mysqli driver instead mysqli
    if [ -x /usr/sbin/cloudlinux-selector ]; then
        if [ $(/usr/sbin/cloudlinux-selector --help | grep 'make-defaults-config' > /dev/null) ]; then
            /usr/sbin/cloudlinux-selector make-defaults-config --json --interpreter=php
        fi
    fi
    # for yum update
    # if add some extensions in default.ini -> update plesk handlers
    recreate_php_handlers=0
    for i in $(cat ${altdir}${_sysconfdir}/php.d.all/* | grep "^[zend_]*extension.*=.*" | sort | uniq | sed -e 's#^#;#;s#[ "]##g'); do
        match=$(echo $i | sed -e 's#.*=##')
        if [ ! $(grep "$match" ${altdir}${_sysconfdir}/php.d/default.ini > /dev/null) ]; then
            echo $i >> ${altdir}${_sysconfdir}/php.d/default.ini
            recreate_php_handlers=1
        fi
    done
    # in the default.ini file ioncube_loader should be the first among zend extensions
    zend_ext=$(grep 'zend_extension'  ${altdir}${_sysconfdir}/php.d/default.ini | sort | uniq)
    if [ -n "$zend_ext" ]; then
        recreate_php_handlers=1
        sed -i '/zend_extension/d'  ${altdir}${_sysconfdir}/php.d/default.ini
        for str in $zend_ext; do
            echo $str >> ${altdir}${_sysconfdir}/php.d/default.ini
        done
    fi

    if [ -x /usr/local/psa/bin/php_handler -a $recreate_php_handlers -eq 1 ]; then
        /usr/local/psa/bin/php_handler --update -id alt-php${php_version}-cgi
    fi

    if [ -x /opt/alt/alt-php-config/alt-php-panel-configuration.py ]; then
        /opt/alt/alt-php-config/alt-php-panel-configuration.py --mode=install --php=${php_version}
    fi
fi

if [ -z "${__imunify}" ]; then
    CONF_DIR='/etc/cl.selector'
    CONF_PATH="$CONF_DIR/selector.conf"
    BIN_DIR=${altdir}${_bindir}
    SBIN_DIR=${altdir}${_sbindir}
    VERS=${php_version_dot}
    VERS2=${php_version_slash}

    if [ ! -e $CONF_DIR ]; then
        mkdir -m 755 -p $CONF_DIR
    fi

    if [ ! -e $CONF_PATH ]; then
        echo -n '' > $CONF_PATH
    fi
    VERSION="`echo ${version} | awk -F '(alpha|beta|RC[0-9]+)' '{print $1}'`"
    if [ -e $CONF_PATH ]; then
        sed -i -e "/\s$VERS2/d" $CONF_PATH
        echo "php $VERS $VERSION $BIN_DIR/php-cgi" >> $CONF_PATH
        echo "php-cli $VERS $VERSION $BIN_DIR/php" >> $CONF_PATH
        echo "php-fpm $VERS $VERSION $SBIN_DIR/php-fpm" >> $CONF_PATH
        echo "lsphp $VERS $VERSION $BIN_DIR/lsphp" >> $CONF_PATH
        echo "php.ini $VERS $VERSION ${altdir}/etc/php.ini" >> $CONF_PATH
    else
        echo "Failed to create $CONF_PATH"
    fi

    if [ -e /opt/alt/alt_php.status ]; then
            sed -i "/${name}-${version}/d" /opt/alt/alt_php.status
        if [ ! -s /opt/alt/alt_php.status ]; then
            rm -f /opt/alt/alt_php.status
            if [ -x /usr/sbin/cagefsctl -a -e /usr/share/cagefs-skeleton/bin ]; then
                if [ -e "${CONF_PATH}" ]; then
                    /usr/sbin/cagefsctl --wait-lock --setup-cl-alt
                fi
                /usr/sbin/cagefsctl --wait-lock --rebuild-alt-php-ini
                if [ -e /usr/share/cagefs/need.remount ]; then
                    /usr/sbin/cagefsctl --wait-lock --remount-all
                fi
            fi
            # ALTPHP-420: update phpNN.dat files while installing alt-php
            if [ ! -e /var/lve/php${php_version_dot}.dat ]; then
                touch /var/lve/php${php_version_dot}.dat
            fi
            if [ -x /usr/share/l.v.e-manager/utils/cache_phpdata.py ]; then
                /usr/bin/flock -n /var/run/cloudlinux_cache_php.cronlock /usr/share/l.v.e-manager/utils/cache_phpdata.py
            fi
        fi
    fi
fi

if [ -n "${__imunify}" ]; then
    # ALTPHP-925: Remove alt-php74-imunify handlers from Plesk
    if [ -x /usr/local/psa/bin/php_handler ]; then
        if [ "$(/usr/local/psa/bin/php_handler --list | grep 'alt-php74-imunify')" ]; then
            /usr/local/psa/bin/php_handler --remove -id alt-php74-imunify-fastcgi
            /usr/local/psa/bin/php_handler --remove -id alt-php74-imunify-cgi
            /usr/local/psa/bin/php_handler --remove -id alt-php74-imunify-fpm
        fi
        if [ "$(/usr/local/psa/bin/php_handler --list | grep 'alt-php-internal')" ]; then
            /usr/local/psa/bin/php_handler --remove -id alt-php-internal-fastcgi
            /usr/local/psa/bin/php_handler --remove -id alt-php-internal-cgi
            /usr/local/psa/bin/php_handler --remove -id alt-php-internal-fpm
        fi
    fi
fi