Determin PHP version if installed via debian packages system.

This commit is contained in:
Christoph 2017-11-07 03:51:23 +01:00
parent 9176017e53
commit 24de2d80e1
2 changed files with 26 additions and 17 deletions

View File

@ -176,9 +176,6 @@ if [ -x "$httpd_binary" ];then
HTTP_USER="`$httpd_binary -t -D DUMP_RUN_CFG | grep -i -e "^User" | awk '{print$2}' | cut -d\"=\" -f2 | tr -d '"'`" HTTP_USER="`$httpd_binary -t -D DUMP_RUN_CFG | grep -i -e "^User" | awk '{print$2}' | cut -d\"=\" -f2 | tr -d '"'`"
HTTP_GROUP="`$httpd_binary -t -D DUMP_RUN_CFG | grep -i -e "^Group" | awk '{print$2}' | cut -d\"=\" -f2 | tr -d '"'`" HTTP_GROUP="`$httpd_binary -t -D DUMP_RUN_CFG | grep -i -e "^Group" | awk '{print$2}' | cut -d\"=\" -f2 | tr -d '"'`"
[[ -n "$HTTP_USER" ]] || HTTP_USER=$DEFAULT_HTTP_USER
[[ -n "$HTTP_GROUP" ]] || HTTP_GROUP=$DEFAULT_HTTP_GROUP
# - Is webserver running ? # - Is webserver running ?
# - # -
PID=$(ps aux | grep "$(realpath $httpd_binary)" | grep -e "^root" | grep -v grep | awk '{print$2}') PID=$(ps aux | grep "$(realpath $httpd_binary)" | grep -e "^root" | grep -v grep | awk '{print$2}')
@ -189,6 +186,9 @@ if [ -x "$httpd_binary" ];then
fi fi
fi fi
[[ -n "$HTTP_USER" ]] || HTTP_USER=$DEFAULT_HTTP_USER
[[ -n "$HTTP_GROUP" ]] || HTTP_GROUP=$DEFAULT_HTTP_GROUP
[[ -n "$WEBMASTER_EMAIL" ]] || fatal "E-Mail (WEBMASTER_EMAIL) for webmaster not present!" [[ -n "$WEBMASTER_EMAIL" ]] || fatal "E-Mail (WEBMASTER_EMAIL) for webmaster not present!"
[[ -n "$WEBSITE_BASEDIR" ]] || WEBSITE_BASEDIR=$DEFAULT_WEBSITE_BASEDIR [[ -n "$WEBSITE_BASEDIR" ]] || WEBSITE_BASEDIR=$DEFAULT_WEBSITE_BASEDIR
@ -294,12 +294,16 @@ fi
# - Determin PHP of all installed versions # - Determin PHP of all installed versions
# - # -
echononl "\tGet major version of all installed PHP versions" echononl "\tGet major version of all installed PHP versions"
php_major_versions=`find /usr/local/ -maxdepth 1 -mindepth 1 -type l -name "php-*" -print | cut -d "-" -f2 | sort` if $PHP_DEBIAN_INSTALLATION ; then
if [[ -z "$php_major_versions" ]]; then php_major_version="$(php --version | head -1 | cut -d' ' -f2 | cut -d '-' -f1 | cut -d'.' -f1,2)"
else
php_major_versions=`find /usr/local/ -maxdepth 1 -mindepth 1 -type l -name "php-*" -print | cut -d "-" -f2 | sort`
if [[ -z "$php_major_versions" ]]; then
echo_failed echo_failed
error "Getting major version of installed PHP versions failed! No installed PHP versiond found!" error "Getting major version of installed PHP versions failed! No installed PHP versiond found!"
else else
echo_ok echo_ok
fi
fi fi
# - Get the latest PHP version # - Get the latest PHP version
@ -357,8 +361,12 @@ echo -e "\tRoundcube TEMP Directory.............: $ROUNDCUBE_TMPDIR"
echo -e "\tRoundcube LOG Directory..............: ${WEBSITE_BASEDIR}/logs" echo -e "\tRoundcube LOG Directory..............: ${WEBSITE_BASEDIR}/logs"
echo -e "\tType of PHP connection...............: $PHP_TYPE" echo -e "\tType of PHP connection...............: $PHP_TYPE"
echo "" echo ""
echo -e "\tInstalled PHP versions...............: $php_major_versions" if $PHP_DEBIAN_INSTALLATION ; then
echo -e "\tNewest PHP Version...................: $php_latest_ver" echo -e "\tInstalled PHP version................: $php_major_version"
else
echo -e "\tInstalled PHP versions...............: $php_major_versions"
echo -e "\tNewest PHP Version...................: $php_latest_ver"
fi
echo "" echo ""
if [[ "$DB_TYPE" = "mysql" ]]; then if [[ "$DB_TYPE" = "mysql" ]]; then
echo -e "\tDatabase type of Roundcube Database..: MySQL" echo -e "\tDatabase type of Roundcube Database..: MySQL"
@ -1294,12 +1302,13 @@ elif [[ "$PHP_TYPE" = "php_fpm" ]]; then
EOF EOF
if $PHP_DEBIAN_INSTALLATION ; then if $PHP_DEBIAN_INSTALLATION ; then
cat <<EOF >> ${APACHE_VHOST_DIR}/${WEBSITE_NAME}.conf 2>> $log_file cat <<EOF >> ${APACHE_VHOST_DIR}/${WEBSITE_NAME}.conf 2>> $log_file
SetHandler "proxy:unix:/var/run/php5-fpm.sock|fcgi://127.0.0.1" SetHandler "proxy:unix:/var/run/php$(echo $php_major_version | cut -d'.' -f1)-fpm.sock|fcgi://127.0.0.1"
EOF EOF
else else
cat <<EOF >> ${APACHE_VHOST_DIR}/${WEBSITE_NAME}.conf 2>> $log_file cat <<EOF >> ${APACHE_VHOST_DIR}/${WEBSITE_NAME}.conf 2>> $log_file
SetHandler "proxy:unix:/tmp/php-${php_latest_ver}-fpm.www.sock|fcgi://127.0.0.1" SetHandler "proxy:unix:/tmp/php-${php_latest_ver}-fpm.www.sock|fcgi://127.0.0.1"
EOF EOF
fi
cat <<EOF >> ${APACHE_VHOST_DIR}/${WEBSITE_NAME}.conf 2>> $log_file cat <<EOF >> ${APACHE_VHOST_DIR}/${WEBSITE_NAME}.conf 2>> $log_file
</FilesMatch> </FilesMatch>
@ -1556,12 +1565,13 @@ elif [[ "$PHP_TYPE" = "php_fpm" ]]; then
EOF EOF
if $PHP_DEBIAN_INSTALLATION ; then if $PHP_DEBIAN_INSTALLATION ; then
cat <<EOF >> ${APACHE_VHOST_DIR}/${WEBSITE_NAME}.conf 2>> $log_file cat <<EOF >> ${APACHE_VHOST_DIR}/${WEBSITE_NAME}.conf 2>> $log_file
SetHandler "proxy:unix:/var/run/php5-fpm.sock|fcgi://127.0.0.1" SetHandler "proxy:unix:/var/run/php$(echo $php_major_version | cut -d'.' -f1)-fpm.sock|fcgi://127.0.0.1"
EOF EOF
else else
cat <<EOF >> ${APACHE_VHOST_DIR}/${WEBSITE_NAME}.conf 2>> $log_file cat <<EOF >> ${APACHE_VHOST_DIR}/${WEBSITE_NAME}.conf 2>> $log_file
SetHandler "proxy:unix:/tmp/php-${php_latest_ver}-fpm.www.sock|fcgi://127.0.0.1" SetHandler "proxy:unix:/tmp/php-${php_latest_ver}-fpm.www.sock|fcgi://127.0.0.1"
EOF EOF
fi
cat <<EOF >> ${APACHE_VHOST_DIR}/${WEBSITE_NAME}.conf 2>> $log_file cat <<EOF >> ${APACHE_VHOST_DIR}/${WEBSITE_NAME}.conf 2>> $log_file
</FilesMatch> </FilesMatch>

View File

@ -355,7 +355,7 @@ fi
# - # -
echononl "\tGet major version of all installed PHP versions" echononl "\tGet major version of all installed PHP versions"
if $PHP_DEBIAN_INSTALLATION ; then if $PHP_DEBIAN_INSTALLATION ; then
echo_skipped php_major_version="$(php --version | head -1 | cut -d' ' -f2 | cut -d '-' -f1 | cut -d'.' -f1,2)"
else else
php_major_versions="$(find /usr/local/ -maxdepth 1 -mindepth 1 -type l -name "php-*" -print | cut -d "-" -f2 | sort)" php_major_versions="$(find /usr/local/ -maxdepth 1 -mindepth 1 -type l -name "php-*" -print | cut -d "-" -f2 | sort)"
if [[ -z "$php_major_versions" ]]; then if [[ -z "$php_major_versions" ]]; then
@ -548,10 +548,9 @@ if [[ -n "$php_major_versions" ]]; then
done done
else else
if $PHP_DEBIAN_INSTALLATION ; then if $PHP_DEBIAN_INSTALLATION ; then
if [[ -f "/etc/init.d/php5-fpm" ]] ; then echononl " Start PHP FPM engine v${php_major_version}.."
/etc/init.d/php5-fpm start > $log_file 2>&1 if [[ -f "/etc/init.d/php$(echo $php_major_version | cut -d'.' -f1)-fpm" ]] ; then
elif [[ -f "/etc/init.d/php7-fpm" ]] ; then /etc/init.d/php$(echo $php_major_version | cut -d'.' -f1)-fpm start > $log_file 2>&1
/etc/init.d/php7-fpm start > $log_file 2>&1
else else
echo_skipped echo_skipped
fi fi