This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

FPM/FastCGI Php changer
#1
[Solved] FPM/FastCGI Php changer
Been testing and i de like for someone to test this out
its another php changer but running Server API FPM/FastCGI
install module as normal if need be unistall old module
once installed and you set right user group save so you can acess it first thing hit the instructions buttom it may be useful


heres a bash script must be deployed after you have installed Php changer read the instructions for more detail's
Code:
#!/bin/bash
# Created by ccr1969
# Complete and error-proofed script for your PHP operations and extensions
set -euo pipefail  # More strict error-handling

# Function to install suhosin
install_suhosin() {
    local PHP_VER="$1"
    local SUHOSIN_VER="$2"
    local CONFIG_FLAG="$3"

    cd "$HOME" || exit 1
    if [[ "$SUHOSIN_VER" == "suhosin7" ]]; then
        [ -d "suhosin7" ] && (cd suhosin7 && git pull origin master) || git clone https://github.com/sektioneins/suhosin7
        cd suhosin7 || exit 1
    else
        curl -O https://download.suhosin.org/suhosin-0.9.38.tar.gz
        tar xzf suhosin-0.9.38.tar.gz
        cd suhosin-0.9.38 || exit 1
    fi

    make clean || true
    "/usr/bin/phpize${PHP_VER}"
    PATH="/usr/bin/:$PATH" ./configure --with-php-config="/usr/bin/php-config${PHP_VER}" "${CONFIG_FLAG}"
    make -j2
    make install
    echo "[suhosin]
extension=$SUHOSIN_VER.so
suhosin.session.encrypt = Off
suhosin.session.cryptua = Off
suhosin.cookie.encrypt = Off
suhosin.memory_limit = 4096
suhosin.get.max_name_length = 512
suhosin.get.max_totalname_length = 512
suhosin.get.max_value_length = 1024
suhosin.post.max_vars = 4096
suhosin.post.max_array_index_length = 256
suhosin.post.max_name_length = 512
suhosin.post.max_totalname_length = 8192
suhosin.request.max_vars = 4096
suhosin.request.max_varname_length = 512
suhosin.request.max_array_index_length = 256
suhosin.request.max_totalname_length = 8192
suhosin.request.max_varname_length = 512
suhosin.executor.include.max_traversal = 4
suhosin.executor.disable_eval = Off
suhosin.executor.disable_emodifier = Off
suhosin.log.syslog = 511
suhosin.mail.protect = 2
suhosin.sql.bailout_on_error = On" > "/etc/php/${PHP_VER}/mods-available/${SUHOSIN_VER}.ini"

    cp "/etc/php/${PHP_VER}/mods-available/${SUHOSIN_VER}.ini" "/etc/php/${PHP_VER}/fpm/conf.d/20-${SUHOSIN_VER}.ini"
    service "php${PHP_VER}-fpm" restart
}

# Main program starts here
echo "### PHP FPM Builds ###"
echo "### OnDaemonRun.hook.php Replace & Back up Original ###"
sleep 5

cd /etc/sentora/panel/modules/ub_php_ver || exit 1
unzip -o ODR.zip

DIR_HOOKS="/etc/sentora/panel/modules/apache_admin/hooks"
DIR_VER="/etc/sentora/panel/modules/ub_php_ver"
cp -b "$DIR_HOOKS/OnDaemonRun.hook.php" "$DIR_HOOKS/OnDaemonRun.hook.php.bak"
cp "$DIR_VER/OnDaemonRun.hook.php" "$DIR_HOOKS/"
rm "$DIR_VER/OnDaemonRun.hook.php"
sleep 5
echo "### site.rules add site.rules ###"
sleep 5

cd /etc/sentora/panel/modules/ub_php_ver || exit 1
unzip -o site.zip

DIR_HOOKS="/etc/sentora/configs/php/sp"
DIR_VER="/etc/sentora/panel/modules/ub_php_ver"

cp "$DIR_VER/site.rules" "$DIR_HOOKS/"
rm "$DIR_VER/site.rules"
sleep 5
add-apt-repository ppa:ondrej/php -y
apt-get update
apt-get -y install php{5.6,7.{0,1,2,3,4},8.{0,1,2,3}}-fpm php{5.6,7.{0,1,2,3,4},8.{0,1,2,3}}-dev

install_suhosin 5.6 suhosin "--enable-suhosin"
install_suhosin 7.0 suhosin7 "--enable-suhosin7"
install_suhosin 7.1 suhosin7 "--enable-suhosin7"

cd "$HOME" || exit 1
if [ ! -d "snuffleupagus-0.10.0" ]; then
    wget https://github.com/jvoisin/snuffleupagus/archive/refs/tags/v0.10.0.tar.gz
    tar xzf v0.10.0.tar.gz
fi

for PHP_VER in 7.2 7.3 7.4 8.0 8.1 8.2 8.3; do
    cd "$HOME/snuffleupagus-0.10.0/src" || exit 1
    make clean || true
    "/usr/bin/phpize${PHP_VER}"
    PATH="/usr/bin/:$PATH" ./configure --with-php-config="/usr/bin/php-config${PHP_VER}" --enable-snuffleupagus
    make -j2
    make install
    echo "extension=snuffleupagus.so" > "/etc/php/${PHP_VER}/mods-available/snuffleupagus.ini"
    echo "sp.configuration_file=/etc/sentora/configs/php/sp/sentora.rules" >> "/etc/php/${PHP_VER}/mods-available/snuffleupagus.ini"
    echo "sp.configuration_file=/etc/sentora/configs/php/sp/site.rules" >> "/etc/php/${PHP_VER}/mods-available/snuffleupagus.ini"

    cp "/etc/php/${PHP_VER}/mods-available/snuffleupagus.ini" "/etc/php/${PHP_VER}/fpm/conf.d/20-snuffleupagus.ini"
    service "php${PHP_VER}-fpm" restart
    sleep 5
done

cd "$HOME" || exit 1
rm -r v0.10.0.tar.gz suhosin-0.9.38.tar.gz

a2enmod proxy_fcgi setenvif
service apache2 restart

update-alternatives --config php

echo "### All done, buddy! ###"


Attached Files Thumbnail(s)
               

.zpp   ub_php_ver.zpp (Size: 54.34 KB / Downloads: 2)
Easy come Easy go Movies Galore
Reply
Thanks given by: TGates


Messages In This Thread
FPM/FastCGI Php changer - by ccr1969 - 08-06-2023, 10:43 AM
RE: FPM/FastCGI Php changer - by ccr1969 - 08-06-2023, 02:55 PM
RE: FPM/FastCGI Php changer - by Jettaman - 08-28-2023, 05:40 AM
RE: FPM/FastCGI Php changer - by ccr1969 - 04-20-2024, 07:10 PM
RE: FPM/FastCGI Php changer - by ccr1969 - 04-21-2024, 07:59 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Php Version Changer "Enjoy" ccr1969 2 766 05-08-2024, 06:17 AM
Last Post: ccr1969

Forum Jump:


Users browsing this thread: 1 Guest(s)