[Solved]
FPM/FastCGI Php changer
08-06-2023, 10:43 AM
(This post was last modified: 10-21-2024, 06:31 AM by ccr1969.)
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
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
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-v0.11.0" ]; then
wget https://github.com/jvoisin/snuffleupagus/archive/refs/tags/v0.11.0.tar.gz
tar xzf v0.11.0.tar.gz
fi
for PHP_VER in 7.2 7.3 7.4 8.0 8.1 8.2 8.3 8.4; do
cd "$HOME/snuffleupagus-0.11.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.9.0.tar.gz suhosin-0.9.38.tar.gz
rm -r v0.11.0.tar.gz
rm -r suhosin-0.9.38
rm -r snuffleupagus-0.11.0
rm -r suhosin7
a2enmod proxy_fcgi setenvif
service apache2 restart
update-alternatives --config php
echo "### All done, buddy! ###"
Easy come Easy go Movies Galore