Determin PHP version if installed via debian package system. Restart PHP after postfixadmin installation.
This commit is contained in:
parent
24de2d80e1
commit
f1cd028434
@ -93,6 +93,15 @@ APACHE_SERVER_KEY=""
|
|||||||
# -
|
# -
|
||||||
#CERT_ChainFile=""
|
#CERT_ChainFile=""
|
||||||
|
|
||||||
|
|
||||||
|
# - Is PHP installed from debian package system ?
|
||||||
|
# -
|
||||||
|
# - Boolean, possible values are 'true', 'false'
|
||||||
|
# -
|
||||||
|
# - Defaults to 'false'
|
||||||
|
#
|
||||||
|
#PHP_DEBIAN_INSTALLATION=""
|
||||||
|
|
||||||
# - Type of PHP installation.
|
# - Type of PHP installation.
|
||||||
# -
|
# -
|
||||||
# - Possible values are: 'php_fpm' , 'fcgid' , 'mod_php
|
# - Possible values are: 'php_fpm' , 'fcgid' , 'mod_php
|
||||||
|
@ -221,6 +221,7 @@ DOMAIN="${MAIN_DOMAIN}.$TLD"
|
|||||||
[[ -n "$IPV6" ]] || fatal "IPv4 Address (IPV6) not present!"
|
[[ -n "$IPV6" ]] || fatal "IPv4 Address (IPV6) not present!"
|
||||||
|
|
||||||
[[ -n "$APACHE_DEBIAN_INSTALLATION" ]] || APACHE_DEBIAN_INSTALLATION=false
|
[[ -n "$APACHE_DEBIAN_INSTALLATION" ]] || APACHE_DEBIAN_INSTALLATION=false
|
||||||
|
[[ -n "$PHP_DEBIAN_INSTALLATION" ]] || PHP_DEBIAN_INSTALLATION=false
|
||||||
|
|
||||||
httpd_binary="`which httpd`"
|
httpd_binary="`which httpd`"
|
||||||
if [ -z "$httpd_binary" ]; then
|
if [ -z "$httpd_binary" ]; then
|
||||||
@ -239,9 +240,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}')
|
||||||
@ -252,6 +250,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
|
||||||
|
|
||||||
@ -334,6 +335,9 @@ fi
|
|||||||
# - Determin PHP of all installed versions
|
# - Determin PHP of all installed versions
|
||||||
# -
|
# -
|
||||||
echononl "\tGet major numbers of all installed PHP versions"
|
echononl "\tGet major numbers of all installed PHP versions"
|
||||||
|
if $PHP_DEBIAN_INSTALLATION ; 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`
|
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
|
||||||
echo_failed
|
echo_failed
|
||||||
@ -341,10 +345,14 @@ if [[ -z "$php_major_versions" ]]; then
|
|||||||
else
|
else
|
||||||
echo_ok
|
echo_ok
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# - Get the latest PHP version
|
# - Get the latest PHP version
|
||||||
# -
|
# -
|
||||||
echononl "\tGet major number of latest installed PHP version"
|
echononl "\tGet major number of latest installed PHP version"
|
||||||
|
if $PHP_DEBIAN_INSTALLATION ; then
|
||||||
|
echo_skipped
|
||||||
|
else
|
||||||
php_latest_ver=""
|
php_latest_ver=""
|
||||||
if [[ -n "$php_major_versions" ]]; then
|
if [[ -n "$php_major_versions" ]]; then
|
||||||
for _ver in $php_major_versions ; do
|
for _ver in $php_major_versions ; do
|
||||||
@ -361,6 +369,7 @@ else
|
|||||||
echo_skipped
|
echo_skipped
|
||||||
warn "Getting major number of latest installed PHP version failed! - No installed PHP versiond found!"
|
warn "Getting major number of latest installed PHP version failed! - No installed PHP versiond found!"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
@ -392,8 +401,12 @@ echo -e "\tBase Directory of PFA Website........: $WEBSITE_BASEDIR"
|
|||||||
echo ""
|
echo ""
|
||||||
echo -e "\tType of PHP connection...............: $PHP_TYPE"
|
echo -e "\tType of PHP connection...............: $PHP_TYPE"
|
||||||
echo ""
|
echo ""
|
||||||
|
if $PHP_DEBIAN_INSTALLATION ; then
|
||||||
|
echo -e "\tInstalled PHP version................: $php_major_version"
|
||||||
|
else
|
||||||
echo -e "\tInstalled PHP versions...............: $php_major_versions"
|
echo -e "\tInstalled PHP versions...............: $php_major_versions"
|
||||||
echo -e "\tNewest PHP Version...................: $php_latest_ver"
|
echo -e "\tNewest PHP Version...................: $php_latest_ver"
|
||||||
|
fi
|
||||||
echo ""
|
echo ""
|
||||||
if [[ "$POSTFIX_DB_TYPE" = "mysql" ]]; then
|
if [[ "$POSTFIX_DB_TYPE" = "mysql" ]]; then
|
||||||
echo -e "\tDatabase type of Postfix Database....: MySQL"
|
echo -e "\tDatabase type of Postfix Database....: MySQL"
|
||||||
@ -680,7 +693,7 @@ if [[ ! -f "${_src_base_dir}/postfixadmin-${PF_ADMIN_VERSION}.tar.gz" ]];then
|
|||||||
echo_ok
|
echo_ok
|
||||||
else
|
else
|
||||||
echo_failed
|
echo_failed
|
||||||
error "$(cat $log_file)"
|
fatal "$(cat $log_file)"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo_skipped
|
echo_skipped
|
||||||
@ -1284,7 +1297,17 @@ elif [[ "$PHP_TYPE" = "php_fpm" ]]; then
|
|||||||
DocumentRoot "${WEBSITE_BASEDIR}/htdocs/"
|
DocumentRoot "${WEBSITE_BASEDIR}/htdocs/"
|
||||||
|
|
||||||
<FilesMatch \.php$>
|
<FilesMatch \.php$>
|
||||||
|
EOF
|
||||||
|
if $PHP_DEBIAN_INSTALLATION ; then
|
||||||
|
cat <<EOF >> ${APACHE_VHOST_DIR}/${WEBSITE_NAME}.conf 2>> $log_file
|
||||||
|
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"
|
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>
|
</FilesMatch>
|
||||||
|
|
||||||
<IfModule dir_module>
|
<IfModule dir_module>
|
||||||
@ -1536,7 +1559,17 @@ elif [[ "$PHP_TYPE" = "php_fpm" ]]; then
|
|||||||
DocumentRoot "${WEBSITE_BASEDIR}/htdocs/"
|
DocumentRoot "${WEBSITE_BASEDIR}/htdocs/"
|
||||||
|
|
||||||
<FilesMatch \.php$>
|
<FilesMatch \.php$>
|
||||||
|
EOF
|
||||||
|
if $PHP_DEBIAN_INSTALLATION ; then
|
||||||
|
cat <<EOF >> ${APACHE_VHOST_DIR}/${WEBSITE_NAME}.conf 2>> $log_file
|
||||||
|
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"
|
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>
|
</FilesMatch>
|
||||||
|
|
||||||
<IfModule dir_module>
|
<IfModule dir_module>
|
||||||
@ -1654,6 +1687,7 @@ else
|
|||||||
echo_ok
|
echo_ok
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if $APACHE_DEBIAN_INSTALLATION ; then
|
if $APACHE_DEBIAN_INSTALLATION ; then
|
||||||
## - add to /etc/apache2/ports.conf
|
## - add to /etc/apache2/ports.conf
|
||||||
## -
|
## -
|
||||||
@ -3264,6 +3298,52 @@ else
|
|||||||
error "$(cat $log_file)"
|
error "$(cat $log_file)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# - Start all PHP FPM engines
|
||||||
|
# -
|
||||||
|
if [[ -n "$php_major_versions" ]]; then
|
||||||
|
for _ver in $php_major_versions ; do
|
||||||
|
echononl " Restart PHP FPM engine v${_ver}.."
|
||||||
|
if [[ -f "/etc/init.d/php-${_ver}-fpm" ]]; then
|
||||||
|
/etc/init.d/php-${_ver}-fpm restart > $log_file 2>&1
|
||||||
|
if [[ $? -eq 0 ]]; then
|
||||||
|
echo_ok
|
||||||
|
else
|
||||||
|
echo_failed
|
||||||
|
error "$(cat $log_file)"
|
||||||
|
fi
|
||||||
|
elif [[ -f "/etc/systemd/system/php-${_ver}-fpm.service" ]] ; then
|
||||||
|
systemctl restart php-${_ver}-fpm > $log_file 2>&1
|
||||||
|
if [[ $? -eq 0 ]]; then
|
||||||
|
echo_ok
|
||||||
|
else
|
||||||
|
echo_failed
|
||||||
|
error "$(cat $log_file)"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo_skipped
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
if $PHP_DEBIAN_INSTALLATION ; then
|
||||||
|
echononl " Retart 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 restart > $log_file 2>&1
|
||||||
|
else
|
||||||
|
echo_skipped
|
||||||
|
fi
|
||||||
|
if [[ $? -eq 0 ]]; then
|
||||||
|
echo_ok
|
||||||
|
else
|
||||||
|
echo_failed
|
||||||
|
error "$(cat $log_file)"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo_skipped
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
info "Browse to \033[1mhttp://${WEBSITE_NAME}/setup.php\033[m to create a 'setup password'\n$(cat <<EOF
|
info "Browse to \033[1mhttp://${WEBSITE_NAME}/setup.php\033[m to create a 'setup password'\n$(cat <<EOF
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user