Determin PHP version if installed via debian packages system.
This commit is contained in:
		| @@ -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_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 ? | ||||
|    # - | ||||
|    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 | ||||
|     | ||||
| [[ -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 "$WEBSITE_BASEDIR" ]] || WEBSITE_BASEDIR=$DEFAULT_WEBSITE_BASEDIR  | ||||
|  | ||||
| @@ -294,12 +294,16 @@ fi | ||||
| # - Determin PHP of all installed 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 [[  -z "$php_major_versions" ]]; then | ||||
|    echo_failed | ||||
|    error "Getting major version of installed PHP versions failed! No installed PHP versiond found!" | ||||
| if $PHP_DEBIAN_INSTALLATION ; then | ||||
|    php_major_version="$(php --version | head -1 | cut -d' ' -f2 | cut -d '-' -f1 | cut -d'.' -f1,2)" | ||||
| else | ||||
|    echo_ok | ||||
|    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 | ||||
|       error "Getting major version of installed PHP versions failed! No installed PHP versiond found!" | ||||
|    else | ||||
|       echo_ok | ||||
|    fi | ||||
| fi | ||||
|  | ||||
| # - 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   "\tType of PHP connection...............: $PHP_TYPE" | ||||
| echo "" | ||||
| echo -e   "\tInstalled PHP versions...............: $php_major_versions" | ||||
| echo -e   "\tNewest PHP Version...................: $php_latest_ver" | ||||
| if $PHP_DEBIAN_INSTALLATION ; then | ||||
|    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 "" | ||||
| if [[ "$DB_TYPE" = "mysql" ]]; then | ||||
|    echo -e   "\tDatabase type of Roundcube Database..: MySQL" | ||||
| @@ -1294,12 +1302,13 @@ elif [[ "$PHP_TYPE" = "php_fpm" ]]; then | ||||
| EOF | ||||
|    if $PHP_DEBIAN_INSTALLATION ; then | ||||
|       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 | ||||
|    else | ||||
|       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" | ||||
| EOF | ||||
|    fi | ||||
|    cat <<EOF >> ${APACHE_VHOST_DIR}/${WEBSITE_NAME}.conf 2>> $log_file | ||||
|    </FilesMatch> | ||||
|  | ||||
| @@ -1556,12 +1565,13 @@ elif [[ "$PHP_TYPE" = "php_fpm" ]]; then | ||||
| EOF | ||||
|    if $PHP_DEBIAN_INSTALLATION ; then | ||||
|       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 | ||||
|    else | ||||
|       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" | ||||
| EOF | ||||
|    fi | ||||
|    cat <<EOF >> ${APACHE_VHOST_DIR}/${WEBSITE_NAME}.conf 2>> $log_file | ||||
|    </FilesMatch> | ||||
|  | ||||
|   | ||||
| @@ -355,7 +355,7 @@ fi | ||||
| # - | ||||
| echononl "\tGet major version of all installed PHP versions" | ||||
| 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 | ||||
|    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 | ||||
| @@ -548,10 +548,9 @@ if [[  -n "$php_major_versions" ]]; then | ||||
| 	done | ||||
| else | ||||
|    if $PHP_DEBIAN_INSTALLATION ; then | ||||
|       if [[ -f "/etc/init.d/php5-fpm" ]] ; then | ||||
|          /etc/init.d/php5-fpm start > $log_file 2>&1 | ||||
|       elif [[ -f "/etc/init.d/php7-fpm" ]] ; then | ||||
|          /etc/init.d/php7-fpm start > $log_file 2>&1 | ||||
|       echononl "   Start PHP FPM engine v${php_major_version}.." | ||||
|       if [[ -f "/etc/init.d/php$(echo $php_major_version | cut -d'.' -f1)-fpm" ]] ; then | ||||
|          /etc/init.d/php$(echo $php_major_version | cut -d'.' -f1)-fpm start > $log_file 2>&1 | ||||
|       else | ||||
|          echo_skipped | ||||
|       fi | ||||
|   | ||||
		Reference in New Issue
	
	Block a user