Support PHP installed from Debian Packages System.

This commit is contained in:
2017-11-06 04:24:52 +01:00
parent 7427ebec6b
commit 186d3b94d5
3 changed files with 136 additions and 31 deletions

View File

@ -157,6 +157,7 @@ MAIN_DOMAIN=${_tmp_string##*.}
[[ -n "$IPV6" ]] || fatal "IPv4 Address (IPV6) not present!"
[[ -n "$APACHE_DEBIAN_INSTALLATION" ]] || APACHE_DEBIAN_INSTALLATION=false
[[ -n "$PHP_DEBIAN_INSTALLATION" ]] || PHP_DEBIAN_INSTALLATION=false
httpd_binary="`which httpd`"
if [ -z "$httpd_binary" ]; then
@ -305,20 +306,24 @@ fi
# -
echononl "\tGet major version of latest installed PHP version"
php_latest_ver=""
if [[ -n "$php_major_versions" ]]; then
for _ver in $php_major_versions ; do
if [[ -z "$php_latest_ver" ]] ; then
php_latest_ver=$_ver
elif [[ "${_ver%.*}" -gt "${php_latest_ver%.*}" ]] ; then
php_latest_ver=$_ver
elif [[ "${_ver%.*}" -eq "${php_latest_ver%.*}" ]] ; then
[[ "${_ver#*.}" -gt "${php_latest_ver#*.}" ]] && php_latest_ver=$_ver
fi
done
echo_ok
else
if $PHP_DEBIAN_INSTALLATION ; then
echo_skipped
warn "Getting major version of latest installed PHP version failed! - No installed PHP versiond found!"
else
if [[ -n "$php_major_versions" ]]; then
for _ver in $php_major_versions ; do
if [[ -z "$php_latest_ver" ]] ; then
php_latest_ver=$_ver
elif [[ "${_ver%.*}" -gt "${php_latest_ver%.*}" ]] ; then
php_latest_ver=$_ver
elif [[ "${_ver%.*}" -eq "${php_latest_ver%.*}" ]] ; then
[[ "${_ver#*.}" -gt "${php_latest_ver#*.}" ]] && php_latest_ver=$_ver
fi
done
echo_ok
else
echo_skipped
warn "Getting major version of latest installed PHP version failed! - No installed PHP versiond found!"
fi
fi
echo ""
@ -445,14 +450,13 @@ fi
## -
## - !! Take care to do this for all php installations (PHP 5.5/5.6/..)
## -
for _version in $php_major_versions ; do
echo -e "\n\n\t\033[37m\033[1mInstall modules for PHP Version ${_version}..\033[m\n"
echo -e "\n\n\t\033[37m\033[1mInstall modules for PHP Version ${_version}..\033[m\n"
if $PHP_DEBIAN_INSTALLATION ; then
for _module in $needed_php_pear_modules ; do
echononl "\tInstall Module '$_module'.."
if ! /usr/local/php-${_version}/bin/pear list | grep -q "$_module" 2> /dev/null ; then
/usr/local/php-${_version}/bin/pear install $_module > $log_file 2>&1
if ! pear list | grep -q "$_module" 2> /dev/null ; then
pear install $_module > $log_file 2>&1
if [[ "$?" = "0" ]]; then
echo_ok
else
@ -460,7 +464,7 @@ for _version in $php_major_versions ; do
error "$(cat $log_file)"
if [[ "$_module" = "Net_IDNA2" ]]; then
echononl "\tInstall (beta) Net_IDNA2-0.1.1 .."
/usr/local/php-${_version}/bin/pear install channel://pear.php.net/Net_IDNA2-0.1.1 > $log_file 2>&1
pear install channel://pear.php.net/Net_IDNA2-0.1.1 > $log_file 2>&1
if [ "$?" = "0" ]; then
echo_ok
else
@ -473,7 +477,36 @@ for _version in $php_major_versions ; do
echo_skipped
fi
done
done
else
for _version in $php_major_versions ; do
for _module in $needed_php_pear_modules ; do
echononl "\tInstall Module '$_module'.."
if ! /usr/local/php-${_version}/bin/pear list | grep -q "$_module" 2> /dev/null ; then
/usr/local/php-${_version}/bin/pear install $_module > $log_file 2>&1
if [[ "$?" = "0" ]]; then
echo_ok
else
echo_failed
error "$(cat $log_file)"
if [[ "$_module" = "Net_IDNA2" ]]; then
echononl "\tInstall (beta) Net_IDNA2-0.1.1 .."
/usr/local/php-${_version}/bin/pear install channel://pear.php.net/Net_IDNA2-0.1.1 > $log_file 2>&1
if [ "$?" = "0" ]; then
echo_ok
else
echo_failed
error "$(cat $log_file)"
fi
fi
fi
else
echo_skipped
fi
done
done
fi
echo -e "\n\n\t\033[37m\033[1mInstall (global) composer..\033[m\n"
@ -639,10 +672,15 @@ fi
echononl "\tInstall PHP dependencies.."
#/usr/local/php-${php_latest_ver}/bin/php /usr/local/bin/composer install --no-dev
su www-data -c"cd ${WEBSITE_BASEDIR}/roundcubemail-${ROUNDCUBE_VERSION}
/usr/local/php-${php_latest_ver}/bin/php /usr/local/bin/composer install --no-dev" -s /bin/bash \
> $log_file 2>&1
if $PHP_DEBIAN_INSTALLATION ; then
su ${HTTP_USER} -c"cd ${WEBSITE_BASEDIR}/roundcubemail-${ROUNDCUBE_VERSION}
php /usr/local/bin/composer install --no-dev" -s /bin/bash \
> $log_file 2>&1
else
su ${HTTP_USER} -c"cd ${WEBSITE_BASEDIR}/roundcubemail-${ROUNDCUBE_VERSION}
/usr/local/php-${php_latest_ver}/bin/php /usr/local/bin/composer install --no-dev" -s /bin/bash \
> $log_file 2>&1
fi
if [[ $? -eq 0 ]]; then
echo_ok
else
@ -1253,7 +1291,16 @@ elif [[ "$PHP_TYPE" = "php_fpm" ]]; then
DocumentRoot "${WEBSITE_BASEDIR}/htdocs/"
<FilesMatch \.php$>
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"
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
cat <<EOF >> ${APACHE_VHOST_DIR}/${WEBSITE_NAME}.conf 2>> $log_file
</FilesMatch>
<IfModule dir_module>
@ -1506,7 +1553,16 @@ elif [[ "$PHP_TYPE" = "php_fpm" ]]; then
DocumentRoot "${WEBSITE_BASEDIR}/htdocs/"
<FilesMatch \.php$>
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"
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
cat <<EOF >> ${APACHE_VHOST_DIR}/${WEBSITE_NAME}.conf 2>> $log_file
</FilesMatch>
<IfModule dir_module>