More fixes for AlpinePHPTool, Fixes for CT Nextcloud:

* Fixed not Stoping/Starting php-fpm services on upgrade and install
* Fixed PHP detection by checking if php or php-fpm exists

CT Nextcloud: added missing php-Phar package,
fixed typo in FirstRun.sh
This commit is contained in:
2025-01-17 19:10:37 +01:00
parent 41dea36a0b
commit 584d4e6ad3
3 changed files with 19 additions and 8 deletions

View File

@@ -1 +1 @@
phpPHPver-pdo_mysql phpPHPver-pecl-imagick phpPHPver-cli phpPHPver-pecl-apcu phpPHPver-pecl-redis phpPHPver-fpm phpPHPver-cgi phpPHPver-common phpPHPver-mbstring phpPHPver-curl phpPHPver-gd phpPHPver-intl phpPHPver-soap phpPHPver-xml phpPHPver-zip phpPHPver-pear phpPHPver-session phpPHPver-posix phpPHPver-pdo phpPHPver-dom phpPHPver-simplexml phpPHPver-xmlreader phpPHPver-xmlwriter phpPHPver-opcache phpPHPver-pcntl phpPHPver-fileinfo phpPHPver-bcmath phpPHPver-gmp phpPHPver-sysvsem phpPHPver-exif phpPHPver-bz2 phpPHPver-sodium phpPHPver-ctype
phpPHPver-pdo_mysql phpPHPver-pecl-imagick phpPHPver-cli phpPHPver-pecl-apcu phpPHPver-pecl-redis phpPHPver-fpm phpPHPver-cgi phpPHPver-common phpPHPver-mbstring phpPHPver-curl phpPHPver-gd phpPHPver-intl phpPHPver-soap phpPHPver-xml phpPHPver-zip phpPHPver-pear phpPHPver-session phpPHPver-posix phpPHPver-pdo phpPHPver-dom phpPHPver-simplexml phpPHPver-xmlreader phpPHPver-xmlwriter phpPHPver-opcache phpPHPver-pcntl phpPHPver-fileinfo phpPHPver-bcmath phpPHPver-gmp phpPHPver-sysvsem phpPHPver-exif phpPHPver-bz2 phpPHPver-sodium phpPHPver-ctype phpPHPver-phar

View File

@@ -40,4 +40,4 @@ sudo -u nginx phpPHPver /opt/nextcloud/occ config:system:set trusted_domains 1 -
sudo -u nginx phpPHPver /opt/nextcloud/occ config:system:set overwrite.cli.url --value="$NextcloudWebProto://$(ifconfig | grep -A 1 'eth0' | tail -1 | cut -d ':' -f 2 | cut -d ' ' -f 1)"
sudo -u nginx phpPHPver /opt/nextcloud/occ config:system:set overwriteprotocol --value="$NextcloudWebProto"
sudo -u nginx phpPHPver /opt/nextcloud/occ config:system:set maintenance_window_start --type=integer --value=2
sudo -u nginx phpPHPver /opt/nextcloud/occ occ maintenance:repair --include-expensive
sudo -u nginx phpPHPver /opt/nextcloud/occ maintenance:repair --include-expensive

View File

@@ -98,17 +98,22 @@ run_Purge() {
#Get current PHP Version
OldPHPVer=$(grep php /etc/apk/world -m 1|sed -e "s/\-.*//" -e "s/php//")
#Check if PHP is installed
if ! command -v php$OldPHPVer &> /dev/null; then printf "ERROR: PHP is not installed\n\n"; exit 1;fi
PHPInstalled=false
if command -v php$OldPHPVer &> /dev/null; then PHPInstalled=true;fi
if command -v php-fpm$OldPHPVer &> /dev/null; then PHPInstalled=true;fi
if ! $PHPInstalled; then printf "ERROR: PHP is not installed\n\n"; exit 1;fi
#Create Backup an its location
if [[ ! -d "/opt/PHPCfgBackup/" ]];then mkdir -p "/opt/PHPCfgBackup"; fi
if [[ -f /etc/crontabs/nginx ]]; then cp /etc/crontabs/nginx /opt/PHPCfgBackup/crontabs-nginx; fi
service php-fpm$OldPHPVer stop
rc-update del php-fpm$OldPHPVer
tar -czf "/opt/PHPCfgBackup/PHP$OldPHPVer-Config.tar.gz" -C "/etc/php$OldPHPVer" ./
rm -rf "/etc/php$OldPHPVer"
#Set placeholder in Nginx for PHP Socket
sed -i "/fastcgi_pass unix:\/run\/php-/c\ \ fastcgi_pass unix:\/run\/php-fpmPHPver\/php-fpm.sock;" /etc/nginx/nginx.conf
#Purge PHP packages
apk del php*
apk del "php*"
}
#(re)install PHP packages
@@ -177,6 +182,11 @@ fetch_Config() {
esac
}
start_Services(){
service php-fpm$NewPHPVer start
service nginx restart
}
case $mode in
distrobuilder)
#Set config location
@@ -185,10 +195,11 @@ case $mode in
run_Install
;;
fresh)
fetch_Config
#Set config location
configStore=/tmp
fetch_Config
run_Install
start_Services
;;
purge)
run_Purge
@@ -200,6 +211,6 @@ case $mode in
service nginx stop
run_Purge
run_Install
service nginx start
start_Services
;;
esac