33 lines
1.3 KiB
Bash
Executable File
33 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# vhost-stack
|
|
# https://git.stack-source.com/msb/vhost-stack
|
|
# Copyright (c) 2024 Matthew Saunders Brown <matthewsaundersbrown@gmail.com>
|
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
|
|
# check for missing /run/php/php-fpm-vpanel.sock link
|
|
if [[ ! -L /run/php/php-fpm-vpanel.sock ]]; then
|
|
# check for existing alternatives and use that if it's set
|
|
if [[ -L /etc/alternatives/php-fpm-vpanel.sock ]]; then
|
|
SOCKET=`readlink /etc/alternatives/php-fpm-vpanel.sock`
|
|
if [[ -S $SOCKET ]]; then
|
|
/usr/bin/update-alternatives --quiet --set php-fpm-vpanel.sock $SOCKET
|
|
else
|
|
echo "ERROR: Socket $SOCKET does not exists"
|
|
exit 1
|
|
fi
|
|
else
|
|
# alternatives not set for php-fpm-vpanel.sock, get current php-cli version and use that
|
|
PHP_MAJOR_VERSION=`php -r "echo PHP_MAJOR_VERSION;"`
|
|
PHP_MINOR_VERSION=`php -r "echo PHP_MINOR_VERSION;"`
|
|
SOCKET=/run/php/php$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION-fpm-vpanel.sock
|
|
PRIORITY=$PHP_MAJOR_VERSION$PHP_MINOR_VERSION
|
|
if [[ -S $SOCKET ]]; then
|
|
update-alternatives --quiet --install /run/php/php-fpm-vpanel.sock php-fpm-vpanel.sock $SOCKET $PRIORITY
|
|
else
|
|
echo "ERROR: Socket $SOCKET does not exists"
|
|
exit 1
|
|
fi
|
|
fi
|
|
fi
|