detect correct php version

This commit is contained in:
Matthew Saunders Brown 2024-06-13 13:53:46 -07:00
parent e00528d9c8
commit 0c5ee948b5
3 changed files with 11 additions and 4 deletions

View File

@ -4,7 +4,7 @@ Alias /panel /srv/www/html/panel
# panel php-fpm worker
<FilesMatch ".+\.ph(p[3457]?|t|tml)$">
SetHandler "proxy:unix:/run/php/php8.1-fpm-vpanel.sock|fcgi://localhost"
SetHandler "proxy:unix:/run/php/php-fpm-vpanel.sock|fcgi://localhost"
</FilesMatch>
# Enable rewrite engine

View File

@ -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

View File

@ -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