From 0c5ee948b52017f3c6d4c087cef9d40ab80ccc3a Mon Sep 17 00:00:00 2001 From: Matthew Saunders Brown Date: Thu, 13 Jun 2024 13:53:46 -0700 Subject: [PATCH] detect correct php version --- etc/apache2/conf-available/vpanel.conf | 2 +- etc/php/{8.1 => }/fpm/pool.d/vpanel.conf | 2 +- install.sh | 11 +++++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) rename etc/php/{8.1 => }/fpm/pool.d/vpanel.conf (84%) diff --git a/etc/apache2/conf-available/vpanel.conf b/etc/apache2/conf-available/vpanel.conf index 9ad7430..6260cd4 100644 --- a/etc/apache2/conf-available/vpanel.conf +++ b/etc/apache2/conf-available/vpanel.conf @@ -4,7 +4,7 @@ Alias /panel /srv/www/html/panel # panel php-fpm worker - SetHandler "proxy:unix:/run/php/php8.1-fpm-vpanel.sock|fcgi://localhost" + SetHandler "proxy:unix:/run/php/php-fpm-vpanel.sock|fcgi://localhost" # Enable rewrite engine diff --git a/etc/php/8.1/fpm/pool.d/vpanel.conf b/etc/php/fpm/pool.d/vpanel.conf similarity index 84% rename from etc/php/8.1/fpm/pool.d/vpanel.conf rename to etc/php/fpm/pool.d/vpanel.conf index b779b46..19c55b5 100644 --- a/etc/php/8.1/fpm/pool.d/vpanel.conf +++ b/etc/php/fpm/pool.d/vpanel.conf @@ -1,7 +1,7 @@ [vpanel] user = vpanel group = vpanel -listen = /run/php/php8.1-fpm-vpanel.sock +listen = /run/php/php-fpm-vpanel.sock listen.owner = www-data listen.group = www-data pm = ondemand diff --git a/install.sh b/install.sh index d0f6413..8166a36 100755 --- a/install.sh +++ b/install.sh @@ -2,11 +2,18 @@ useradd --no-create-home --home-dir /srv/www/html/panel --shell /usr/sbin/nologin --system --user-group vpanel cp bin/vpanel-verify-access.sh /usr/local/bin/ chmod 755 /usr/local/bin/vpanel-verify-access.sh +# set PHP version +PHP_MAJOR_VERSION=`php -r "echo PHP_MAJOR_VERSION;"` +PHP_MINOR_VERSION=`php -r "echo PHP_MINOR_VERSION;"` +phpVersion=$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION +# create versioned php fpm dir +mkdir etc/php/$phpVersion +mv etc/php/fpm etc/php/$phpVersion/ cp -a etc/* /etc/ chmod 440 /etc/sudoers.d/vpanel a2enconf vpanel -sed -i "s|;process_control_timeout = 0|process_control_timeout = 1s|g" /etc/php/8.1/fpm/php-fpm.conf -service php8.1-fpm restart +sed -i "s|;process_control_timeout = 0|process_control_timeout = 1s|g" /etc/php/$phpVersion/fpm/php-fpm.conf +service php$phpVersion-fpm restart service apache2 restart cp -a panel /srv/www/html/ mkdir /srv/www/html/panel/tmp