Fixed php session save permission problem

This commit is contained in:
2021-11-25 14:20:16 +01:00
parent 9b448938bf
commit 39724043fe
13 changed files with 44 additions and 1 deletions

View File

@@ -5,6 +5,7 @@ listen = /var/run/php/phpPHPver-fpm-Backend.sock
listen.owner = www-data
listen.group = www-data
php_admin_value[disable_functions] = exec,passthru,shell_exec,system
php_value[session.save_path] = /var/lib/php/sessions
php_admin_value[opcache.enable] = 0
php_admin_value[max_input_vars] = 5000
php_admin_value[upload_max_filesize] = 256M

View File

@@ -3,6 +3,8 @@ curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/Backen
sed -i 's/PHPver/'$phpver'/' "$phpPoolDir"/Backend.conf
groupadd Backend
useradd -g Backend Backend
usermod -a -G www-data Backend
#PHPMyAdmin configuration
touch /var/log/PhpMyAdmin/PhpMyAdmin_auth.log
chown Backend:Backend -R /usr/share/phpmyadmin

View File

@@ -6,6 +6,7 @@ listen.owner = www-data
listen.group = www-data
php_admin_value[disable_functions] = exec,passthru,shell_exec,system
php_admin_value[error_log] = /var/log/php-fpm/error-SITEname.log
php_value[session.save_path] = /var/lib/php/sessions
; OPCACHE SETTINGS
php_admin_value[opcache.memory_consumption] = 256

View File

@@ -27,6 +27,7 @@ curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/frontc
sed -i -e 's/PHPver/'$phpver'/g' -e 's/SITEname/'$sitename'/g' -e 's/DOMAINname/'$domain'/' "$phpPoolDir"/$sitename.conf
groupadd "$sitename"
useradd -g "$sitename" "$sitename"
usermod -a -G www-data "$sitename"
systemctl reload $phpFPMService

View File

@@ -6,6 +6,8 @@ listen.owner = www-data
listen.group = www-data
php_admin_value[disable_functions] = exec,passthru,system
php_admin_value[error_log] = /var/log/php-fpm/error-SITEname.log
php_value[session.save_path] = /var/lib/php/sessions
; OPCACHE SETTINGS
php_admin_value[opcache.memory_consumption] = 256
php_admin_value[opcache.enable] = 0

View File

@@ -3,6 +3,7 @@ curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/nextcl
sed -i -e 's/PHPver/'$phpver'/g' -e 's/SITEname/'$sitename'/g' -e 's/DOMAINname/'$domain'/g' "$phpPoolDir"/$sitename.conf
groupadd "$sitename"
useradd -g "$sitename" "$sitename"
usermod -a -G www-data "$sitename"
mkdir -p /var/www/"$domain"/html/data
#Getting Nextcloud

View File

@@ -6,6 +6,8 @@ listen.owner = www-data
listen.group = www-data
php_admin_value[disable_functions] = exec,passthru,shell_exec,system
php_admin_value[error_log] = /var/log/php-fpm/error-SITEname.log
php_value[session.save_path] = /var/lib/php/sessions
; OPCACHE SETTINGS
php_admin_value[opcache.memory_consumption] = 256
php_admin_value[opcache.enable] = 0

View File

@@ -12,6 +12,7 @@ curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/none/F
sed -i -e 's/PHPver/'$phpver'/g' -e 's/SITEname/'$sitename'/g' -e 's/DOMAINname/'$domain'/' "$phpPoolDir"/$sitename.conf
groupadd "$sitename"
useradd -g "$sitename" "$sitename"
usermod -a -G www-data "$sitename"
systemctl reload $phpFPMService
fi

View File

@@ -6,6 +6,8 @@ listen.owner = www-data
listen.group = www-data
php_admin_value[error_log] = /var/log/php-fpm/error-SITEname.log
php_admin_value[disable_functions] = exec,passthru,shell_exec,system
php_value[session.save_path] = /var/lib/php/sessions
; OPCACHE SETTINGS
php_admin_value[opcache.memory_consumption] = 256
php_admin_value[opcache.enable] = 0

View File

@@ -37,6 +37,7 @@ curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/wordpr
sed -i -e 's/PHPver/'$phpver'/g' -e 's/SITEname/'$sitename'/g' -e 's/DOMAINname/'$domain'/g' "$phpPoolDir"/$sitename.conf
groupadd "$sitename"
useradd -g "$sitename" "$sitename"
usermod -a -G www-data "$sitename"
systemctl reload $phpFPMService

View File

@@ -0,0 +1,25 @@
#!/bin/bash
#######################################################
# @description: #
# Setup the PHP session folder as a Ramdisk / tmpfs #
# This will store session info in memory #
# #
# @author: Bram Prieshof #
#######################################################
#sysCheck
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 bash <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/Scripts/GeneratePhplist.sh) ; fi
source /etc/ICTM/phpvar.list
#Stop php service
systemctl stop $phpFPMService
#Reset php session folder
rm -rf /var/lib/php/sessions
mkdir -p /var/lib/php/sessions
#Create memdisk/Tmpfs and mount it
echo "tmpfs /var/lib/php/sessions tmpfs size=32m,uid=$(id -u www-data),gid=$(id -g www-data),mode=0773 0 0" >> /etc/fstab
mount -a
#start php service
systemctl stop $phpFPMService

View File

@@ -15,6 +15,10 @@ 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' "$phpMainConf"
#Php session to disk
chown www-data:www-data /var/lib/php/sessions
chmod 1773 /var/lib/php/sessions
if [ "$shortdist" = "el8" ]; then
# Centos Mysql config
echo "pdo_mysql.default_socket = '/var/run/mysqld/mysqld.sock'" >> /etc/opt/remi/php${phpver//.}/php.d/60-mysql_sock.ini

View File

@@ -12,7 +12,7 @@ elif [ "$shortdist" = "el8" ]; then
phpMainConf=/etc/opt/remi/php${phpver//.}/php.ini
phpFPMService=php${phpver//.}-php-fpm
#Creating Socket directory
mkdir -p /var/run/php
mkdir -p /var/run/php /var/lib/php/sessions
fi
#Setting php version branch