![]() |
|
FPM/FastCGI Php changer - Printable Version +- Sentora Support Forums (https://senforums.mach-hosting.com) +-- Forum: Sentora Public Support Forums v2.x.x (https://senforums.mach-hosting.com/forumdisplay.php?fid=66) +--- Forum: 3rd Party Module Support v2.x.x (https://senforums.mach-hosting.com/forumdisplay.php?fid=71) +---- Forum: Active v2.x.x Modules (https://senforums.mach-hosting.com/forumdisplay.php?fid=78) +---- Thread: FPM/FastCGI Php changer (/showthread.php?tid=12959) |
FPM/FastCGI Php changer - ccr1969 - 08-06-2023 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
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! ###"RE: FPM/FastCGI Php changer - ccr1969 - 08-06-2023 (08-06-2023, 10:43 AM)ccr1969 proof of concept Wrote: Been testing and i de like for someone to test this out RE: FPM/FastCGI Php changer - Jettaman - 08-28-2023 Awesome! Have you checked to make sure suhosin and snuff are blocking disabled functions? RE: FPM/FastCGI Php changer - ccr1969 - 04-20-2024 Quote:Awesome! Have you checked to make sure suhosin and snuff are blocking disabled functions? Yes just need to add it to the rules. Restart Fpm and rule will take effect. Still working on way, to add the New rules through panel . service php8.3-fpm restart change what in red to what ever php your using RE: FPM/FastCGI Php changer - ccr1969 - 04-21-2024 added latest jvoisin / snuffleupagus php 8.3.6 in the FPM/FastCGI Php changer RE: FPM/FastCGI Php changer - ccr1969 - 05-24-2024 slight update as made a error and add it in folder as the zpp its corrected now xml will work sorry my bad on the oversight. |