Replaced references php With vars
Done because differences between distros is quite big, and this was the beter solution then using alot of if statements List of changes: * Replaced service names php"$phpver"-fpm with $phpFPMService * Replaced PHPver in package list with phpPkgName * Replaced full php config path with $phpMainConf * Replaced php pool path with $phpPoolDir
This commit is contained in:
@@ -3,10 +3,11 @@
|
|||||||
##-----------------##
|
##-----------------##
|
||||||
|
|
||||||
if [ ! -f "/etc/ICTM/selopts.list" ] || [ ! -f "/etc/ICTM/mainvar.list" ] ; then echo 'This system is not yet setup, please run the main installer first' && exit ; fi
|
if [ ! -f "/etc/ICTM/selopts.list" ] || [ ! -f "/etc/ICTM/mainvar.list" ] ; then echo 'This system is not yet setup, please run the main installer first' && exit ; fi
|
||||||
|
if [ ! -f "/etc/ICTM/phpvar.list" ] ; then echo 'Php var list missing,Please run /Scipts/GeneratePhplist from the repo ' && exit ; fi
|
||||||
|
|
||||||
source /etc/ICTM/selopts.list
|
source /etc/ICTM/selopts.list
|
||||||
source /etc/ICTM/mainvar.list
|
source /etc/ICTM/mainvar.list
|
||||||
|
source /etc/ICTM/phpvar.list
|
||||||
rm /tmp/pkg.list > $OUTPUT 2>&1
|
rm /tmp/pkg.list > $OUTPUT 2>&1
|
||||||
source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/ModulesMenu.list)
|
source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/ModulesMenu.list)
|
||||||
|
|
||||||
@@ -197,7 +198,7 @@ fi
|
|||||||
##-------------##
|
##-------------##
|
||||||
|
|
||||||
$PKGM update
|
$PKGM update
|
||||||
sed -i 's/PHPver/'$phpver'/g' /tmp/pkg.list
|
sed -i 's/PHPprefix/'$phpPkgName'/g' /tmp/pkg.list
|
||||||
cat /tmp/pkg.list | xargs $PKGI
|
cat /tmp/pkg.list | xargs $PKGI
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
##-----------------##
|
##-----------------##
|
||||||
|
|
||||||
if [ ! -f "/etc/ICTM/selopts.list" ] || [ ! -f "/etc/ICTM/mainvar.list" ] ; then echo 'This system is not yet setup, please run the main installer first' && exit ; fi
|
if [ ! -f "/etc/ICTM/selopts.list" ] || [ ! -f "/etc/ICTM/mainvar.list" ] ; then echo 'This system is not yet setup, please run the main installer first' && exit ; fi
|
||||||
|
if [ ! -f "/etc/ICTM/phpvar.list" ] ; then echo 'Php var list missing,Please run /Scipts/GeneratePhplist from the repo ' && exit ; fi
|
||||||
|
|
||||||
##-----------------##
|
##-----------------##
|
||||||
# Fetching Vars #
|
# Fetching Vars #
|
||||||
@@ -11,6 +11,7 @@ if [ ! -f "/etc/ICTM/selopts.list" ] || [ ! -f "/etc/ICTM/mainvar.list" ] ; then
|
|||||||
|
|
||||||
source /etc/ICTM/selopts.list
|
source /etc/ICTM/selopts.list
|
||||||
source /etc/ICTM/mainvar.list
|
source /etc/ICTM/mainvar.list
|
||||||
|
source /etc/ICTM/phpvar.list
|
||||||
rm /tmp/pkg.list
|
rm /tmp/pkg.list
|
||||||
source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/ModulesMenu.list)
|
source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/ModulesMenu.list)
|
||||||
|
|
||||||
@@ -228,7 +229,7 @@ done
|
|||||||
##-------------##
|
##-------------##
|
||||||
|
|
||||||
$PKGM update
|
$PKGM update
|
||||||
sed -i 's/PHPver/'$phpver'/g' /tmp/pkg.list
|
sed -i 's/PHPprefix/'$phpPkgName'/g' /tmp/pkg.list
|
||||||
cat /tmp/pkg.list | xargs $PKGI
|
cat /tmp/pkg.list | xargs $PKGI
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#Backend PHP Pool
|
#Backend PHP Pool
|
||||||
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/Backend/Fpm-Pool.conf-unconfigured -o /etc/php/"$phpver"/fpm/pool.d/Backend.conf
|
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/Backend/Fpm-Pool.conf-unconfigured -o "$phpPoolDir"/Backend.conf
|
||||||
sed -i 's/PHPver/'$phpver'/' /etc/php/"$phpver"/fpm/pool.d/Backend.conf
|
sed -i 's/PHPver/'$phpver'/' "$phpPoolDir"/Backend.conf
|
||||||
groupadd Backend
|
groupadd Backend
|
||||||
useradd -g Backend Backend
|
useradd -g Backend Backend
|
||||||
#PHPMyAdmin configuration
|
#PHPMyAdmin configuration
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ sed -i -e "0,/^#ConfHere/s/\(^#Conf.*\)/#ConfHere1 /" -e '/#ConfHere1/ r /tmp/ap
|
|||||||
chown "$sitename":"$sitename" -R /var/www/"$domain"/html
|
chown "$sitename":"$sitename" -R /var/www/"$domain"/html
|
||||||
|
|
||||||
#PHP
|
#PHP
|
||||||
sed -i -e '/cgi.fix_pathinfo/c\php_admin_value[cgi.fix_pathinfo] = 1' /etc/php/"$phpver"/fpm/pool.d/$sitename.conf
|
sed -i -e '/cgi.fix_pathinfo/c\php_admin_value[cgi.fix_pathinfo] = 1' "$phpPoolDir"/$sitename.conf
|
||||||
sed -i -e '/security.limit_extensions/c\php_admin_value[security.limit_extensions] = .php' /etc/php/"$phpver"/fpm/pool.d/$sitename.conf
|
sed -i -e '/security.limit_extensions/c\php_admin_value[security.limit_extensions] = .php' "$phpPoolDir"/$sitename.conf
|
||||||
|
|
||||||
systemctl reload apache2 php$phpver-fpm
|
systemctl reload apache2 php$phpver-fpm
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#PHP Pool
|
#PHP Pool
|
||||||
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/nextcloud/Fpm-Pool.conf-unconfigured -o /etc/php/"$phpver"/fpm/pool.d/"$sitename".conf
|
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/nextcloud/Fpm-Pool.conf-unconfigured -o "$phpPoolDir"/"$sitename".conf
|
||||||
sed -i -e 's/PHPver/'$phpver'/g' -e 's/SITEname/'$sitename'/g' -e 's/DOMAINname/'$domain'/g' /etc/php/"$phpver"/fpm/pool.d/$sitename.conf
|
sed -i -e 's/PHPver/'$phpver'/g' -e 's/SITEname/'$sitename'/g' -e 's/DOMAINname/'$domain'/g' "$phpPoolDir"/$sitename.conf
|
||||||
groupadd "$sitename"
|
groupadd "$sitename"
|
||||||
useradd -g "$sitename" "$sitename"
|
useradd -g "$sitename" "$sitename"
|
||||||
mkdir -p /var/www/"$domain"/html/data
|
mkdir -p /var/www/"$domain"/html/data
|
||||||
@@ -55,4 +55,4 @@ ln -s /var/www/"$domain"/html/data/nextcloud.log /var/log/nextcloud/"$sitename"
|
|||||||
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/config/fail2ban/Jails/nextcloud_unconfigured -o /etc/fail2ban/jail.d/"$sitename"-nextcloud.local
|
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/config/fail2ban/Jails/nextcloud_unconfigured -o /etc/fail2ban/jail.d/"$sitename"-nextcloud.local
|
||||||
sed -i 's/SITEname/'$sitename'/' /etc/fail2ban/jail.d/"$sitename"-nextcloud.local
|
sed -i 's/SITEname/'$sitename'/' /etc/fail2ban/jail.d/"$sitename"-nextcloud.local
|
||||||
|
|
||||||
systemctl reload php"$phpver"-fpm
|
systemctl reload "$phpFPMService"
|
||||||
@@ -1 +1 @@
|
|||||||
libmagickcore-6.q16-3-extra libxml2 openssl zlib1g libpng-dev phpPHPver-bcmath phpPHPver-gmp
|
libmagickcore-6.q16-3-extra libxml2 openssl zlib1g libpng-dev PHPprefix-bcmath PHPprefix-gmp
|
||||||
@@ -2,11 +2,11 @@
|
|||||||
if [ $webserv != nginx_nonphp ]; then
|
if [ $webserv != nginx_nonphp ]; then
|
||||||
|
|
||||||
#Setup PHP Pool
|
#Setup PHP Pool
|
||||||
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/none/Fpm-Pool.conf-unconfigured -o /etc/php/"$phpver"/fpm/pool.d/"$sitename".conf
|
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/none/Fpm-Pool.conf-unconfigured -o "$phpPoolDir"/"$sitename".conf
|
||||||
sed -i -e 's/PHPver/'$phpver'/g' -e 's/SITEname/'$sitename'/g' -e 's/DOMAINname/'$domain'/' /etc/php/"$phpver"/fpm/pool.d/$sitename.conf
|
sed -i -e 's/PHPver/'$phpver'/g' -e 's/SITEname/'$sitename'/g' -e 's/DOMAINname/'$domain'/' "$phpPoolDir"/$sitename.conf
|
||||||
groupadd "$sitename"
|
groupadd "$sitename"
|
||||||
useradd -g "$sitename" "$sitename"
|
useradd -g "$sitename" "$sitename"
|
||||||
|
|
||||||
systemctl reload php"$phpver"-fpm
|
systemctl reload $phpFPMService
|
||||||
|
|
||||||
fi
|
fi
|
||||||
@@ -33,12 +33,12 @@ printf '%s\n' "$WPSalts" >> /var/www/"$domain"/html/wp-config.php
|
|||||||
printf '%s\n' "require_once(ABSPATH . 'wp-settings.php');" >> /var/www/"$domain"/html/wp-config.php
|
printf '%s\n' "require_once(ABSPATH . 'wp-settings.php');" >> /var/www/"$domain"/html/wp-config.php
|
||||||
|
|
||||||
#PHP Pool
|
#PHP Pool
|
||||||
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/wordpress/Fpm-Pool.conf-unconfigured -o /etc/php/"$phpver"/fpm/pool.d/"$sitename".conf
|
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/wordpress/Fpm-Pool.conf-unconfigured -o "$phpPoolDir"/"$sitename".conf
|
||||||
sed -i -e 's/PHPver/'$phpver'/g' -e 's/SITEname/'$sitename'/g' -e 's/DOMAINname/'$domain'/g' /etc/php/"$phpver"/fpm/pool.d/$sitename.conf
|
sed -i -e 's/PHPver/'$phpver'/g' -e 's/SITEname/'$sitename'/g' -e 's/DOMAINname/'$domain'/g' "$phpPoolDir"/$sitename.conf
|
||||||
groupadd "$sitename"
|
groupadd "$sitename"
|
||||||
useradd -g "$sitename" "$sitename"
|
useradd -g "$sitename" "$sitename"
|
||||||
|
|
||||||
systemctl reload php"$phpver"-fpm
|
systemctl reload $phpFPMService
|
||||||
|
|
||||||
#fail2ban
|
#fail2ban
|
||||||
if [ ! -f /etc/fail2ban/jail.d/wordpress-syslog.local ]; then
|
if [ ! -f /etc/fail2ban/jail.d/wordpress-syslog.local ]; then
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ elif [ "$shortdist" = "cent8" ]; then
|
|||||||
# System #
|
# System #
|
||||||
##------------##
|
##------------##
|
||||||
|
|
||||||
localectl set-keymap us-int > $OUTPUT 2>&1
|
localectl set-keymap us > $OUTPUT 2>&1
|
||||||
useradd -r -U -s /usr/sbin/nologin -d /var/www www-data > $OUTPUT 2>&1
|
useradd -r -U -s /usr/sbin/nologin -d /var/www www-data > $OUTPUT 2>&1
|
||||||
systemctl disable firewalld --now > $OUTPUT 2>&1
|
systemctl disable firewalld --now > $OUTPUT 2>&1
|
||||||
|
|
||||||
|
|||||||
21
Scripts/GeneratePhplist.sh
Normal file
21
Scripts/GeneratePhplist.sh
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
if [ ! -f "/etc/ICTM/mainvar.list" ] ; then echo 'This system is not yet setup, please run the main installer first' && exit ; fi
|
||||||
|
|
||||||
|
if [ "$shortdist" = "ubu1804" ] || [ "$osrel" = "ubu2004" ] || [ "$osrel" = "deb10" ] ; then
|
||||||
|
# Debian/Ubunbtu Php variables
|
||||||
|
phpPoolDir=/etc/php/${phpver}/fpm/pool.d
|
||||||
|
phpPkgName=php${phpver}
|
||||||
|
phpMainConf=/etc/php/${phpver}/fpm/php.ini
|
||||||
|
phpFPMService=php${phpver}-fpm
|
||||||
|
|
||||||
|
elif [ "$shortdist" = "cent8" ]; then
|
||||||
|
# Centos Php variable
|
||||||
|
phpPoolDir=/etc/opt/remi/php${phpver//.}/php-fpm.d/
|
||||||
|
phpPkgName=php${phpver//.}-php
|
||||||
|
phpMainConf=/etc/opt/remi/php${phpver//.}/php.ini
|
||||||
|
phpFPMService=php${phpver//.}-php-fpm
|
||||||
|
fi
|
||||||
|
|
||||||
|
#Storing vars to config
|
||||||
|
for storeme in phpPoolDir phpPkgName phpMainConf phpFPMService; do
|
||||||
|
declare -p $storeme | cut -d ' ' -f 3- >> /etc/ICTM/phpvar.list
|
||||||
|
done
|
||||||
@@ -156,7 +156,7 @@ fi
|
|||||||
##-------------##
|
##-------------##
|
||||||
|
|
||||||
$PKGM update
|
$PKGM update
|
||||||
sed -i 's/PHPver/'$phpver'/g' /tmp/pkg.list
|
sed -i 's/PHPprefix/'$phpPkgName'/g' /tmp/pkg.list
|
||||||
cat /tmp/pkg.list | xargs $PKGI
|
cat /tmp/pkg.list | xargs $PKGI
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
systemctl stop php${phpver}-fpm
|
systemctl stop $phpFPMService
|
||||||
###############
|
###############
|
||||||
# PHP-FPM #
|
# PHP-FPM #
|
||||||
###############
|
###############
|
||||||
|
|
||||||
sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /etc/php/"$phpver"/fpm/php.ini
|
sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' "$phpMainConf"
|
||||||
sed -i 's/;opcache.memory_consumption=128/opcache.memory_consumption=256/g' /etc/php/"$phpver"/fpm/php.ini
|
sed -i 's/;opcache.memory_consumption=128/opcache.memory_consumption=256/g' "$phpMainConf"
|
||||||
sed -i 's/;opcache.enable=1/opcache.enable=1/g' /etc/php/"$phpver"/fpm/php.ini
|
sed -i 's/;opcache.enable=1/opcache.enable=1/g' "$phpMainConf"
|
||||||
sed -i 's/;opcache.interned_strings_buffer=8/opcache.interned_strings_buffer=8/g' /etc/php/"$phpver"/fpm/php.ini
|
sed -i 's/;opcache.interned_strings_buffer=8/opcache.interned_strings_buffer=8/g' "$phpMainConf"
|
||||||
sed -i 's/;opcache.max_accelerated_files=10000/opcache.max_accelerated_files=50000/g' /etc/php/"$phpver"/fpm/php.ini
|
sed -i 's/;opcache.max_accelerated_files=10000/opcache.max_accelerated_files=50000/g' "$phpMainConf"
|
||||||
sed -i 's/;opcache.max_wasted_percentage=5/opcache.max_wasted_percentage=5/g' /etc/php/"$phpver"/fpm/php.ini
|
sed -i 's/;opcache.max_wasted_percentage=5/opcache.max_wasted_percentage=5/g' "$phpMainConf"
|
||||||
sed -i 's/;opcache.revalidate_freq=2/opcache.revalidate_freq=0/g' /etc/php/"$phpver"/fpm/php.ini
|
sed -i 's/;opcache.revalidate_freq=2/opcache.revalidate_freq=0/g' "$phpMainConf"
|
||||||
sed -i 's/; max_input_vars = 1000/max_input_vars = 10000/g' /etc/php/"$phpver"/fpm/php.ini
|
sed -i 's/; max_input_vars = 1000/max_input_vars = 10000/g' "$phpMainConf"
|
||||||
sed -i 's/upload_max_filesize = 2/upload_max_filesize = 128/g' /etc/php/"$phpver"/fpm/php.ini
|
sed -i 's/upload_max_filesize = 2/upload_max_filesize = 128/g' "$phpMainConf"
|
||||||
sed -i 's/post_max_size = 8/post_max_size = 64/g' /etc/php/"$phpver"/fpm/php.ini
|
sed -i 's/post_max_size = 8/post_max_size = 64/g' "$phpMainConf"
|
||||||
|
|
||||||
systemctl start php${phpver}-fpm
|
systemctl start $phpFPMService
|
||||||
systemctl enable php${phpver}-fpm
|
systemctl enable $phpFPMService
|
||||||
@@ -1 +1 @@
|
|||||||
phpPHPver-imagick php-pear phpPHPver-cli phpPHPver-apcu phpPHPver-fpm phpPHPver-mysql phpPHPver-cgi phpPHPver-common phpPHPver-mbstring phpPHPver-curl phpPHPver-gd phpPHPver-intl phpPHPver-soap phpPHPver-xml phpPHPver-xmlrpc phpPHPver-zip
|
PHPprefix-imagick php-pear PHPprefix-cli PHPprefix-apcu PHPprefix-fpm PHPprefix-mysql PHPprefix-cgi PHPprefix-common PHPprefix-mbstring PHPprefix-curl PHPprefix-gd PHPprefix-intl PHPprefix-soap PHPprefix-xml PHPprefix-xmlrpc PHPprefix-zip
|
||||||
22
SubModules/php-fpm/preconf.sh
Normal file
22
SubModules/php-fpm/preconf.sh
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
if [ "$shortdist" = "ubu1804" ] || [ "$osrel" = "ubu2004" ] || [ "$osrel" = "deb10" ] ; then
|
||||||
|
# Debian/Ubunbtu Php variables
|
||||||
|
phpPoolDir=/etc/php/${phpver}/fpm/pool.d
|
||||||
|
phpPkgName=php${phpver}
|
||||||
|
phpMainConf=/etc/php/${phpver}/fpm/php.ini
|
||||||
|
phpFPMService=php${phpver}-fpm
|
||||||
|
|
||||||
|
elif [ "$shortdist" = "cent8" ]; then
|
||||||
|
# Centos Php variable
|
||||||
|
phpPoolDir=/etc/opt/remi/php${phpver//.}/php-fpm.d/
|
||||||
|
phpPkgName=php${phpver//.}-php
|
||||||
|
phpMainConf=/etc/opt/remi/php${phpver//.}/php.ini
|
||||||
|
phpFPMService=php${phpver//.}-php-fpm
|
||||||
|
#Creating Socket directory
|
||||||
|
mkdir -p /var/run/php
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#Storing vars to config
|
||||||
|
for storeme in phpPoolDir phpPkgName phpMainConf phpFPMService; do
|
||||||
|
declare -p $storeme | cut -d ' ' -f 3- >> /etc/ICTM/phpvar.list
|
||||||
|
done
|
||||||
@@ -1 +1 @@
|
|||||||
redis-server phpPHPver-redis
|
redis-server PHPprefix-redis
|
||||||
@@ -576,7 +576,7 @@ done
|
|||||||
##-------------##
|
##-------------##
|
||||||
|
|
||||||
$PKGM update -y
|
$PKGM update -y
|
||||||
sed -i 's/PHPver/'$phpver'/g' /tmp/pkg.list
|
sed -i 's/PHPprefix/'$phpPkgName'/g' /tmp/pkg.list
|
||||||
cat /tmp/pkg.list | xargs $PKGI
|
cat /tmp/pkg.list | xargs $PKGI
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user