#!/usr/bin/env bash # php ( fuer Apache 2 ) # _VERSION= _FREETYPE_VERSION="2.10.4" _ICU4C_VERSION="57-2" _LIBXML2_VERSION="2.9.4" #WITHOUT_APACHE_MOD_PHP=true _APACHE_MOD_PHP=no _APACHE_VERSION= _HTTPD_USER=www-data _srcdir=$(dirname $(realpath $0)) _pwd=`pwd` _PHP_FPM_SUPPORT=yes _LEGACY_SQL_FUNCTION_SUPPORT=no _SYMLINK_PHP=no _SYMLINK_PHP_MAIN_VERSION=yes _MEMORY_LIMIT="512M" _MAX_EXECUTION_TIME=180 _MAX_INPUT_TIME=180 _UPLOAD_MAX_FILESIZE="128M" _POST_MAX_SIZE="128M" _SKIP_UPDATE_DB=no _CRONTAB_BAKUP_FILE="$(mktemp)" _VSERVER_GUEST=no _backup_date="$(date +%Y%m%d-%H%M)" ## --- Some functions ## --- echononl(){ echo X\\c > /tmp/shprompt$$ if [ `wc -c /tmp/shprompt$$ | awk '{print $1}'` -eq 1 ]; then echo -e -n "$*\\c" 1>&2 else echo -e -n "$*" 1>&2 fi rm /tmp/shprompt$$ } fatal(){ echo "" echo -e "\t[ \033[31m\033[1mError\033[m ]: $*" echo "" echo -e "\t\033[31m\033[1mInstalllation wird abgebrochen\033[m\033[m" echo "" rm -f "$tmp_err_msg" exit 1 } error(){ echo "" echo -e "\t[ \033[31m\033[1mError\033[m ]: $*" echo "" } warn (){ echo "" echo -e "\t[ \033[33m\033[1mWarning\033[m ]: $*" echo "" } info (){ echo "" echo -e "\t[ \033[32m\033[1mInfo\033[m ]: $*" echo "" } echo_ok() { echo -e "\033[75G[ \033[1;32mok\033[m ]" ## echo -e " [ ok ]" } echo_failed(){ echo -e "\033[75G[ \033[1;31mfailed\033[m ]" ## echo -e " [ failed ]" } echo_skipped() { echo -e "\033[75G[ \033[37m\033[1mskipped\033[m ]" } echo_try_from_src() { echo -e "\033[75G[ \033[33m\033[1mfailed\033[m ]" echo "" echo -e "\t[ \033[33m\033[1mInfo\033[m ]: Try installing extension from source..." echo "" } echo_try_beta_version() { echo -e "\033[75G[ \033[33m\033[1mfailed\033[m ]" echo "" echo -e "\t[ \033[33m\033[1mInfo\033[m ]: Try installing beta version..." echo "" } is_int() { return $(test "$@" -eq "$@" > /dev/null 2>&1); } detect_os_1 () { if $(which lsb_release > /dev/null 2>&1) ; then os_dist="$(lsb_release -i | awk '{print tolower($3)}')" os_version="$(lsb_release -r | awk '{print tolower($2)}')" os_codename="$(lsb_release -c | awk '{print tolower($2)}')" if [[ "$os_dist" = "debian" ]]; then if $(echo "$os_version" | grep -q '\.') ; then os_version=$(echo "$os_version" | cut --delimiter='.' -f1) fi fi elif [[ -e "/etc/os-release" ]]; then . /etc/os-release os_dist=$ID os_version=${os_version_ID} fi # remove whitespace from os_dist and os_version os_dist="${os_dist// /}" os_version="${os_version// /}" } ## --- ## --- END: functions ## -------------------------------------------------- # - Support systemd ? # - if [[ "X$(which systemd)" = "X" ]]; then SYSTEMD_EXISTS=false else SYSTEMD_EXISTS=true fi # - Set variable # - os_dist # - os_version # - os_codename # - detect_os_1 _required_base_packages="" _required_compiler_packages="" _required_extension_packages="" # - PHP Extension imagick, geoip, memcached # - _required_extension_packages="$_required_extension_packages libmagickwand-dev libmagickcore-dev libgeoip1 libgeoip-dev geoip-bin libmemcached-dev" # - Compile stuff # - _required_compiler_packages="$_required_compiler_packages g++ g++-multilib gcc gcc-multilib cpp make automake autoconf libtool flex bison gettext pkg-config gnu-standards libssl-dev libreadline-dev libncurses-dev" # - Needed to build apache webserver with php/ruby support # - _required_base_packages="$_required_base_packages libxml2 libxml2-dev curl libcurl4-openssl-dev libqdbm-dev libgdbm-dev libpspell-dev libjpeg-dev libxpm-dev libfreetype6-dev libwmf-dev libtiff-dev libpaper-dev libmagic-dev libmagick-dev libgraphics-magick-perl libgraphicsmagick++1-dev libgraphicsmagick1-dev libgraphviz-dev libgsf-1-dev libilmbase-dev libvpx-dev vpx-tools libgpm-dev libkpathsea-dev libopenexr-dev librsvg2-dev libdjvulibre-dev libatm-dev libexpat-dev imagemagick graphicsmagick re2c sqlite3 exif libexiv2-dev netpbm libnetpbm10-dev libmcrypt-dev mcrypt libwebp-dev libpq-dev postgresql-client libreadline-dev libncurses-dev libxslt1-dev libpcre3-dev libc-client-dev libicu-dev libtidy-dev libmm-dev libgmp-dev libkrb5-dev libldap-dev libmhash-dev libapr1-dev libaprutil1-dev liblua5.1-0 liblua5.1-0-dev libsctp-dev libcrypto++-dev libzip-dev libharfbuzz-dev libsodium-dev libxmlrpc-epi-dev" # libcroco3-dev # - Package libgraphicsmagick++3 is not available at ubunru 18.04" # - if [[ "$os_dist" != "ubuntu" ]] ; then _required_base_packages="$_required_base_packages libgraphicsmagick++3" fi if [[ "$os_dist" = "debian" ]] && [[ $os_version -lt 9 ]] ; then _required_base_packages="$_required_base_packages libjasper-dev libpng12-dev" if [[ ! -d "/usr/local/mysql/" ]]; then _required_base_packages="$_required_base_packages libmysqlclient-dev" fi else _required_base_packages="$_required_base_packages libpng-dev" if [[ ! -d "/usr/local/mysql/" ]]; then _required_base_packages="$_required_base_packages default-libmysqlclient-dev" fi fi if [[ "$os_dist" = "debian" ]] && [[ $os_version -eq 7 ]] ; then _required_base_packages="$_required_base_packages libgd2-xpm-dev libdb5.1 libdb5.1++ libdb5.1++-dev libdb5.1-dev" else _required_base_packages="$_required_base_packages libgd-dev libdb5.3 libdb5.3++ libdb5.3++-dev libdb5.3-dev" fi if $SYSTEMD_EXISTS ; then _required_base_packages="$_required_base_packages libsystemd-dev" fi needed_compiler_packages="" for _pkg in $_required_compiler_packages ; do needed_compiler_packages="$needed_compiler_packages $_pkg" done needed_debian_packages="" for _pkg in $_required_base_packages ; do needed_debian_packages="$needed_debian_packages $_pkg" done needed_extension_packages="" for _pkg in $_required_extension_packages ; do needed_extension_packages="$needed_extension_packages $_pkg" done ## -------------------------------------------------- tmp_err_msg=$(mktemp) ## - Determin httpd binary ## - _httpd_binary="`which httpd`" if [ -z "$_httpd_binary" ]; then _httpd_binary="$(ps -axu | grep httpd | grep -e "^root" | grep -v grep | awk '{print$11}')" if [ -z "$_httpd_binary" ]; then if [ -x "/usr/local/apache2/bin/httpd" ]; then _httpd_binary="/usr/local/apache2/bin/httpd" fi fi fi if [ -x "$_httpd_binary" ];then ## - Determin websever user ## - _pass_web_user=false web_user="`$_httpd_binary -t -D DUMP_RUN_CFG | grep -i -e "^User" | awk '{print$2}' | cut -d\"=\" -f2 | tr -d '"'`" web_group="`$_httpd_binary -t -D DUMP_RUN_CFG | grep -i -e "^Group" | awk '{print$2}' | cut -d\"=\" -f2 | tr -d '"'`" if [ -z "$web_user" -o -z "$web_group" ]; then _HTTPD_USER=www-data else _HTTPD_USER=$web_user _HTTPD_GROUP=$web_group fi fi ## -------------------------------------------------- ## -------------------------------------------------- clear echo echo -e "\033[21G\033[32mInstallation PHP \033[m" echo echo echo echo "" echo -e "\033[32m--\033[m" echo "" echo "Insert PHP version number." echo "" echo "" VERSION= while [ "X$VERSION" = "X" ] do echononl "PHP Version [$_VERSION]: " read VERSION if [ "X$VERSION" = "X" ]; then VERSION=$_VERSION fi done PHP_MAIN_VERSION=`echo $VERSION | cut -d '.' -f1,2` PHP_MAJOR_VERSION=`echo $VERSION | cut -d '.' -f1` PHP_MINOR_VERSION=`echo $VERSION | cut -d '.' -f2` PHP_PATCH_LEVEL=`echo $VERSION | cut -d '.' -f3` # Since version 7.4 package 'libsqlite3-dev' is needed # Since version 7.4 package 'libonig-dev' is needed # if ([[ "$PHP_MAJOR_VERSION" -eq 7 ]] && [[ "$PHP_MINOR_VERSION" -gt 3 ]]) \ || [[ "$PHP_MAJOR_VERSION" -gt 7 ]] ; then needed_debian_packages="$needed_debian_packages libsqlite3-dev libonig-dev" fi # - A hack, because configure don't work with systemd on version 5.4.x ## - if [[ "$PHP_MAIN_VERSION" = "5.4" ]]; then SYSTEMD_EXISTS=false fi ## - Let make use multiple cores (-j) ## - if [[ "$PHP_MAIN_VERSION" != "5.4" ]]; then export MAKEFLAGS=-j$(expr `grep "^processor" /proc/cpuinfo | sort -u | wc -l` + 1) else unset MAKEFLAGS fi if [[ "$PHP_MAIN_VERSION" = "5.6" ]] && [[ $os_version -gt 9 ]]; then #if [[ -e "/usr/local/libxml2" ]]; then warn "For php version 5.6 at debian 10 and above, you need manual installation of \t freetype (libfreetype6-dev) \t libxml2 \t icu4c (libicu)" #fi fi echo "" echo "" echo -e "\033[32m--\033[m" echo "" echo "Insert User/Group for apache daemon (httpd)." echo "" echo "" HTTPD_USER= while [ "X$HTTPD_USER" = "X" ] do echononl "apache user [${_HTTPD_USER}]: " read HTTPD_USER if [ "X$HTTPD_USER" = "X" ]; then HTTPD_USER=$_HTTPD_USER fi done if [ -z "$_HTTPD_GROUP" ]; then if [ "$HTTPD_USER" = "nobody" ]; then _HTTPD_GROUP="nogroup" else _HTTPD_GROUP=$HTTPD_USER fi fi while [ "X$HTTPD_GROUP" = "X" ] do echononl "apache group [$_HTTPD_GROUP]: " read HTTPD_GROUP if [ "X$HTTPD_GROUP" = "X" ]; then HTTPD_GROUP=$_HTTPD_GROUP fi done _PHP_FPM_USER=$HTTPD_USER _PHP_FPM_GROUP=$HTTPD_GROUP echo "" echo "" echo -e "\033[32m--\033[m" echo "" echo -e "Install php-$VERSION with apache module? [ \033[33myes/no\033[m ]" echo "" echo "" OK="" while [ "X$OK" = "X" ] do echononl "Install mod_apache ? [ $_APACHE_MOD_PHP ] " read OK __to_lower=`echo $OK | tr '[:upper:]' '[:lower:]' | tr -d ' '` if [ "X$OK" = "X" ]; then OK=$_APACHE_MOD_PHP break fi if [ "$__to_lower" = "yes" -o "$__to_lower" = "no" ]; then OK=$__to_lower break fi echo "" echo -e "\t\033[31mWrong entry !! Try again..\033[m" echo "" OK= done if [ "$OK" = "yes" ]; then WITHOUT_APACHE_MOD_PHP=false WITH_MOD_PHP=true else WITHOUT_APACHE_MOD_PHP=true WITH_MOD_PHP=false fi if $WITH_MOD_PHP ; then echo "" echo -e "\033[32m--\033[m" echo "" echo "Insert version numbers apache (httpd) apr and apr-util." echo "" echo "" APACHE_VERSION= while [ "X$APACHE_VERSION" = "X" ] do echononl "apache version [$_APACHE_VERSION]: " read APACHE_VERSION if [ "X$APACHE_VERSION" = "X" ]; then APACHE_VERSION=$_APACHE_VERSION fi if [ -d /usr/local/httpd-${APACHE_VERSION}_php-${VERSION} ]; then echo "" #echo -e "\t\033[31mApache Instalation found at \"/usr/local/httpd-${APACHE_VERSION}_php-${VERSION}\" !! Try again..\033[m" echo -e "\t\033[32mApache Instalation found at \"/usr/local/httpd-${APACHE_VERSION}_php-${VERSION}\" !! Try again..\033[m" echo "" #APACHE_VERSION= fi done APACHE_BASEDIR=/usr/local/httpd-${APACHE_VERSION}_php-${VERSION} APXS=${APACHE_BASEDIR}/bin/apxs PHP_VERSION_STRING="${VERSION}_httpd-${APACHE_VERSION}" PREFIX_PHP="/usr/local/php-$VERSION-httpd-${APACHE_VERSION}" PHP_INI_FILE="${APACHE_BASEDIR}/conf/php.ini" _builddir=${_srcdir}/php-${VERSION}_httpd-${APACHE_VERSION} _logdir=${_srcdir}/log_php-${VERSION}_httpd-${APACHE_VERSION}_build else PHP_VERSION_STRING="$VERSION" PREFIX_PHP=/usr/local/php-$VERSION PHP_INI_FILE="${PREFIX_PHP}/etc/php.ini" _builddir=${_srcdir}/php-${VERSION} _logdir=${_srcdir}/log_php-${VERSION}_build fi echo "" echo "" echo -e "\033[32m--\033[m" echo "" echo -e "Define PHP parameters for php.ini file" echo "" ## - php.ini: memory_limit if [ -f "/usr/local/php-${PHP_MAIN_VERSION}/etc/php.ini" ]; then __memory_limit=$(grep -e "^\s*memory_limit" /usr/local/php-${PHP_MAIN_VERSION}/etc/php.ini | awk '{print$3}') if [ -n "$__memory_limit" ] ; then _MEMORY_LIMIT=$__memory_limit fi fi if [ -f "/usr/local/php-${PHP_MAIN_VERSION}/etc/php.ini" ]; then __memory_limit=$(grep -e "^\s*memory_limit" /usr/local/php-${PHP_MAIN_VERSION}/etc/php.ini | awk '{print$3}') if [ -n "$__memory_limit" ] ; then __MEMORY_LIMIT=$__memory_limit fi fi MEMORY_LIMIT="" while [[ "X$MEMORY_LIMIT" = "X" ]]; do echononl "memory_limit - Append unit \"K\", \"M\" or \"G\" [$_MEMORY_LIMIT] " read MEMORY_LIMIT if [ "X$MEMORY_LIMIT" = "X" ]; then MEMORY_LIMIT=$_MEMORY_LIMIT fi if is_int $MEMORY_LIMIT ; then MEMORY_LIMIT="${MEMORY_LIMIT}M" warn "No unit is given. \"M\" was appended: memory_limit: $MEMORY_LIMIT" continue fi _unit="${MEMORY_LIMIT: -1}" if [[ "$_unit" != "K" ]] && [[ "$_unit" != "M" ]] && [[ "$_unit" != "G" ]]; then warn "Wrong unit was given for memory_limit. Reenter again" MEMORY_LIMIT="" continue fi if ! is_int ${MEMORY_LIMIT::-1} ; then warn "Wrong value for memory_limit. was given. Reenter again" MEMORY_LIMIT="" fi done ## - php.ini: max_execution_time if [ -f "/usr/local/php-${PHP_MAIN_VERSION}/etc/php.ini" ]; then __max_execution_time=$(grep -e "^\s*max_execution_time" /usr/local/php-${PHP_MAIN_VERSION}/etc/php.ini | awk '{print$3}') if [ -n "$__max_execution_time" ] ; then _MAX_EXECUTION_TIME=$__max_execution_time fi fi MAX_EXECUTION_TIME="" while [[ "X$MAX_EXECUTION_TIME" = "X" ]]; do echononl "max_execution_time (in Seconds) !! insert ONLY the number? [$_MAX_EXECUTION_TIME] " read MAX_EXECUTION_TIME if [ "X$MAX_EXECUTION_TIME" = "X" ]; then MAX_EXECUTION_TIME=$_MAX_EXECUTION_TIME fi if ! is_int ${MAX_EXECUTION_TIME} ; then warn "Wrong value for max_execution_time was given. Reenter again" MAX_EXECUTION_TIME="" fi done ## - php.ini: upload_max_filesize if [ -f "/usr/local/php-${PHP_MAIN_VERSION}/etc/php.ini" ]; then __upload_max_filesize=$(grep -e "^\s*upload_max_filesize" /usr/local/php-${PHP_MAIN_VERSION}/etc/php.ini | awk '{print$3}') if [ -n "$__upload_max_filesize" ] ; then _UPLOAD_MAX_FILESIZE=$__upload_max_filesize fi fi ## - php.ini: max_input_time if [ -f "/usr/local/php-${PHP_MAIN_VERSION}/etc/php.ini" ]; then __max_input_time=$(grep -e "^\s*max_input_time" /usr/local/php-${PHP_MAIN_VERSION}/etc/php.ini | awk '{print$3}') if [ -n "$__max_input_time" ] ; then _MAX_INPUT_TIME=$__max_input_time fi fi MAX_INPUT_TIME="" while [[ "X$MAX_INPUT_TIME" = "X" ]]; do echononl "max_input_time (in Seconds) !! insert ONLY the number? [$_MAX_INPUT_TIME] " read MAX_INPUT_TIME if [ "X$MAX_INPUT_TIME" = "X" ]; then MAX_INPUT_TIME=$_MAX_INPUT_TIME fi if ! is_int ${MAX_INPUT_TIME} ; then warn "Wrong value for max_input_time was given. Reenter again" MAX_INPUT_TIME="" fi done ## - php.ini: upload_max_filesize if [ -f "/usr/local/php-${PHP_MAIN_VERSION}/etc/php.ini" ]; then __upload_max_filesize=$(grep -e "^\s*upload_max_filesize" /usr/local/php-${PHP_MAIN_VERSION}/etc/php.ini | awk '{print$3}') if [ -n "$__upload_max_filesize" ] ; then _UPLOAD_MAX_FILESIZE=$__upload_max_filesize fi fi UPLOAD_MAX_FILESIZE="" while [[ "X$UPLOAD_MAX_FILESIZE" = "X" ]]; do echononl "upload_max_filesize - Append unit \"K\", \"M\" or \"G\" [$_UPLOAD_MAX_FILESIZE] " read UPLOAD_MAX_FILESIZE if [ "X$UPLOAD_MAX_FILESIZE" = "X" ]; then UPLOAD_MAX_FILESIZE=$_UPLOAD_MAX_FILESIZE fi if is_int $UPLOAD_MAX_FILESIZE ; then UPLOAD_MAX_FILESIZE="${UPLOAD_MAX_FILESIZE}M" warn "No unit is given. \"M\" was appended: upload_max_filesize: $UPLOAD_MAX_FILESIZE" continue fi _unit="${UPLOAD_MAX_FILESIZE: -1}" if [[ "$_unit" != "K" ]] && [[ "$_unit" != "M" ]] && [[ "$_unit" != "G" ]]; then warn "Wrong unit was given for upload_max_filesize Reenter again" UPLOAD_MAX_FILESIZE="" continue fi if ! is_int ${UPLOAD_MAX_FILESIZE::-1} ; then warn "Wrong value for upload_max_filesize was given. Reenter again" UPLOAD_MAX_FILESIZE="" fi done ## - php.ini: post_max_size if [ -f "/usr/local/php-${PHP_MAIN_VERSION}/etc/php.ini" ]; then __post_max_size=$(grep -e "^\s*post_max_size" /usr/local/php-${PHP_MAIN_VERSION}/etc/php.ini | awk '{print$3}') if [ -n "$__post_max_size" ] ; then _POST_MAX_SIZE=$__post_max_size fi fi POST_MAX_SIZE="" while [[ "X$POST_MAX_SIZE" = "X" ]]; do echononl "post_max_size - Append unit \"K\", \"M\" or \"G\" [$_POST_MAX_SIZE] " read POST_MAX_SIZE if [ "X$POST_MAX_SIZE" = "X" ]; then POST_MAX_SIZE=$_POST_MAX_SIZE fi if is_int $POST_MAX_SIZE ; then POST_MAX_SIZE="${POST_MAX_SIZE}M" warn "No unit was given. So I apaended \"M\": post_max_size: $POST_MAX_SIZE" continue fi _unit="${POST_MAX_SIZE: -1}" if [[ "$_unit" != "K" ]] && [[ "$_unit" != "M" ]] && [[ "$_unit" != "G" ]]; then warn "Wrong unit was given for post_max_size. Reenter again" POST_MAX_SIZE="" continue fi if ! is_int ${POST_MAX_SIZE::-1} ; then warn "Wrong value for post_max_size was given. Reenter again" POST_MAX_SIZE="" fi done echo "" echo "" echo -e "\033[32m--\033[m" echo "" echo -e "Set Symlinks ? [ \033[33myes/no\033[m ]" echo "" echo "" if [ ! -h /usr/local/php ] ; then SYMLINK_PHP=true echo "Symlink /usr/local/php -> /usr/local/php-$PHP_MAIN_VERSION will be set." else OK="" while [ "X$OK" = "X" ] do echononl "Set symlink /usr/local/php -> /usr/local/php-$PHP_MAIN_VERSION ? [ $_SYMLINK_PHP ]: " read OK __to_lower=`echo $OK | tr '[:upper:]' '[:lower:]' | tr -d ' '` if [ "X$OK" = "X" ]; then OK=$_SYMLINK_PHP break fi if [ "$__to_lower" = "yes" -o "$__to_lower" = "no" ]; then OK=$__to_lower break fi echo "" echo -e "\t\033[31mWrong entry !! Try again..\033[m" echo "" OK= done if [ "$OK" = "yes" ]; then SYMLINK_PHP=true else SYMLINK_PHP=false fi fi echo "" if [ ! -h /usr/local/php-${PHP_MAIN_VERSION} ] ; then SYMLINK_PHP_MAIN_VERSION=true echo "Symlink /usr/local/php-$PHP_MAIN_VERSION -> `basename $PREFIX_PHP` will be set." else OK="" while [ "X$OK" = "X" ]; do echononl "Set symlink /usr/local/php-$PHP_MAIN_VERSION -> `basename $PREFIX_PHP` ? [ $_SYMLINK_PHP_MAIN_VERSION ]: " read OK __to_lower=`echo $OK | tr '[:upper:]' '[:lower:]' | tr -d ' '` if [ "X$OK" = "X" ]; then OK=$_SYMLINK_PHP_MAIN_VERSION break fi if [ "$__to_lower" = "yes" -o "$__to_lower" = "no" ]; then OK=$__to_lower break; fi echo "" echo -e "\t\033[31mWrong entry !! Try again..\033[m" echo "" OK= done if [ "$OK" = "yes" ]; then SYMLINK_PHP_MAIN_VERSION=true else SYMLINK_PHP_MAIN_VERSION=false fi fi echo "" echo "" echo -e "\033[32m--\033[m" echo "" echo -e "Install support of PHP-FPM (FastCGI Process Manager) [ \033[33myes/no\033[m ]" echo "" echo "" OK="" while [ "X$OK" = "X" ] do echononl "Install FPM support ? [ $_PHP_FPM_SUPPORT ] " read OK __to_lower=`echo $OK | tr '[:upper:]' '[:lower:]' | tr -d ' '` if [ "X$OK" = "X" ]; then OK=$_PHP_FPM_SUPPORT break fi if [ "$__to_lower" = "yes" -o "$__to_lower" = "no" ]; then OK=$__to_lower break fi echo "" echo -e "\t\033[31mWrong entry !! Try again..\033[m" echo "" OK= done if [ "$OK" = "yes" ]; then WITH_PHP_FPM_SUPPORT=true ACTIVATE_PHP_FPM_INIT_SCRIPT=true else WITH_PHP_FPM_SUPPORT=false ACTIVATE_PHP_FPM_INIT_SCRIPT=false fi if $WITH_PHP_FPM_SUPPORT ; then echo "" echo -e "\033[32m--\033[m" echo "" echo "" OK="" echononl "Set \"umask\" to \"0002\" for PHP-FPM process? [no]: " read OK while [ "X$OK" != "Xyes" -a "X$OK" != "XYes" -a "X$OK" != "Xno" -a "X$OK" != "XNo" -a "X$OK" != "X" ]; do echononl "falsche Angabe! [no]: " read OK done if [ "$OK" = "yes" -o "$OK" = "Yes" ]; then SET_UMASK=true UMASK=0002 else SET_UMASK=false fi DEFAULT_FPM_POOL_START_SERVER=15 DEFAULT_FPM_POOL_MIN_SPARE=6 DEFAULT_FPM_POOL_MAX_SPARE=24 DEFAULT_FPM_POOL_MAX_REQUESTS=500 DEFAULT_FPM_POOL_MAX_CHILDREN=250 # If php pool definitions exists on installed php, then take that value # if [[ -f "/usr/local/php-${PHP_MAIN_VERSION}/etc/fpm.d/www-${PHP_MAIN_VERSION}.php-fpm.conf" ]] ; then __pm_start_servers=$(grep -e "^\s*pm.start_servers" "/usr/local/php-${PHP_MAIN_VERSION}/etc/fpm.d/www-${PHP_MAIN_VERSION}.php-fpm.conf" | awk '{print$3}') if [[ -n "$__pm_start_servers" ]] ; then DEFAULT_FPM_POOL_START_SERVER=$__pm_start_servers fi fi if [[ -f "/usr/local/php-${PHP_MAIN_VERSION}/etc/fpm.d/www-${PHP_MAIN_VERSION}.php-fpm.conf" ]] ; then __pm_min_spare_servers=$(grep -e "^\s*pm.min_spare_servers" "/usr/local/php-${PHP_MAIN_VERSION}/etc/fpm.d/www-${PHP_MAIN_VERSION}.php-fpm.conf" | awk '{print$3}') if [[ -n "$__pm_min_spare_servers" ]] ; then DEFAULT_FPM_POOL_MIN_SPARE=$__pm_min_spare_servers fi fi if [[ -f "/usr/local/php-${PHP_MAIN_VERSION}/etc/fpm.d/www-${PHP_MAIN_VERSION}.php-fpm.conf" ]] ; then __pm_max_spare_servers=$(grep -e "^\s*pm.max_spare_servers" "/usr/local/php-${PHP_MAIN_VERSION}/etc/fpm.d/www-${PHP_MAIN_VERSION}.php-fpm.conf" | awk '{print$3}') if [[ -n "$__pm_max_spare_servers" ]] ; then DEFAULT_FPM_POOL_MAX_SPARE=$__pm_max_spare_servers fi fi if [[ -f "/usr/local/php-${PHP_MAIN_VERSION}/etc/fpm.d/www-${PHP_MAIN_VERSION}.php-fpm.conf" ]] ; then __pm_max_requests=$(grep -e "^\s*pm.max_requests" "/usr/local/php-${PHP_MAIN_VERSION}/etc/fpm.d/www-${PHP_MAIN_VERSION}.php-fpm.conf" | awk '{print$3}') if [[ -n "$__pm_max_requests" ]] ; then DEFAULT_FPM_POOL_MAX_REQUESTS=$__pm_max_requests fi fi if [[ -f "/usr/local/php-${PHP_MAIN_VERSION}/etc/fpm.d/www-${PHP_MAIN_VERSION}.php-fpm.conf" ]] ; then __pm_max_children=$(grep -e "^\s*pm.max_children" "/usr/local/php-${PHP_MAIN_VERSION}/etc/fpm.d/www-${PHP_MAIN_VERSION}.php-fpm.conf" | awk '{print$3}') if [[ -n "$__pm_max_children" ]] ; then DEFAULT_FPM_POOL_MAX_CHILDREN=$__pm_max_children fi fi echo "" echo "" echo -e "\033[32m--\033[m" echo "" echo -e "Some FPM Pool Definitions for php-fpm.conf or included files.." echo "" FPM_POOL_START_SERVER="" while [[ "X$FPM_POOL_START_SERVER" = "X" ]]; do echononl "pm.start_servers: [$DEFAULT_FPM_POOL_START_SERVER] " read FPM_POOL_START_SERVER if [ "X$FPM_POOL_START_SERVER" = "X" ]; then FPM_POOL_START_SERVER=$DEFAULT_FPM_POOL_START_SERVER break fi if ! is_int $FPM_POOL_START_SERVER ; then warn "Wrong value for pm.start_servers was given (mus be an integer). Reenter again" FPM_POOL_START_SERVER="" continue fi done FPM_POOL_MIN_SPARE="" while [[ "X$FPM_POOL_MIN_SPARE" = "X" ]]; do echononl "pm.min_spare_servers: [$DEFAULT_FPM_POOL_MIN_SPARE] " read FPM_POOL_MIN_SPARE if [ "X$FPM_POOL_MIN_SPARE" = "X" ]; then FPM_POOL_MIN_SPARE=$DEFAULT_FPM_POOL_MIN_SPARE break fi if ! is_int $FPM_POOL_MIN_SPARE ; then warn "Wrong value for pm.min_spare_servers was given (mus be an integer). Reenter again" FPM_POOL_MIN_SPARE="" continue fi done FPM_POOL_MAX_SPARE="" while [[ "X$FPM_POOL_MAX_SPARE" = "X" ]]; do echononl "pm.max_spare_servers: [$DEFAULT_FPM_POOL_MAX_SPARE] " read FPM_POOL_MAX_SPARE if [ "X$FPM_POOL_MAX_SPARE" = "X" ]; then FPM_POOL_MAX_SPARE=$DEFAULT_FPM_POOL_MAX_SPARE break fi if ! is_int $FPM_POOL_MAX_SPARE ; then warn "Wrong value for pm.max_spare_servers was given (mus be an integer). Reenter again" FPM_POOL_MAX_SPARE="" continue fi done FPM_POOL_MAX_REQUESTS="" while [[ "X$FPM_POOL_MAX_REQUESTS" = "X" ]]; do echononl "pm.max_requests: [$DEFAULT_FPM_POOL_MAX_REQUESTS] " read FPM_POOL_MAX_REQUESTS if [ "X$FPM_POOL_MAX_REQUESTS" = "X" ]; then FPM_POOL_MAX_REQUESTS=$DEFAULT_FPM_POOL_MAX_REQUESTS break fi if ! is_int $FPM_POOL_MAX_REQUESTS ; then warn "Wrong value for pm.max_request was given (mus be an integer). Reenter again" FPM_POOL_MAX_REQUESTS="" continue fi done FPM_POOL_MAX_CHILDREN="" while [[ "X$FPM_POOL_MAX_CHILDREN" = "X" ]]; do echononl "pm.max_requests: [$DEFAULT_FPM_POOL_MAX_CHILDREN] " read FPM_POOL_MAX_CHILDREN if [ "X$FPM_POOL_MAX_CHILDREN" = "X" ]; then FPM_POOL_MAX_CHILDREN=$DEFAULT_FPM_POOL_MAX_CHILDREN break fi if ! is_int $FPM_POOL_MAX_CHILDREN ; then warn "Wrong value for pm.max_request was given (mus be an integer). Reenter again" FPM_POOL_MAX_CHILDREN="" continue fi done fi if $WITH_PHP_FPM_SUPPORT && $WITH_MOD_PHP ; then if [ -f "/etc/init.d/php-${VERSION}-fpm" ];then echo "" OK="" while [ "X$OK" = "X" ]; do echononl "Activate PHP-FPM from that installation ? [ no ] " read OK __to_lower=`echo $OK | tr '[:upper:]' '[:lower:]' | tr -d ' '` if [ "X$OK" = "X" ]; then OK="no" break fi if [ "$__to_lower" = "yes" -o "$__to_lower" = "no" ]; then OK=$__to_lower break fi echo "" echo -e "\t\033[31mWrong entry !! Try again..\033[m" echo "" OK= done if [ "$OK" = "yes" ]; then ACTIVATE_PHP_FPM_INIT_SCRIPT=true else ACTIVATE_PHP_FPM_INIT_SCRIPT=false fi fi fi if [[ "$os_dist" = "debian" ]] && [[ $os_version -gt 9 ]] ; then FPM_PID_FILE=/run/php-${PHP_MAIN_VERSION}-fpm.pid else FPM_PID_FILE=/var/run/php-${PHP_MAIN_VERSION}-fpm.pid fi FPM_SYSTEMD_FILE=/etc/systemd/system/php-${PHP_MAIN_VERSION}-fpm.service FPM_INIT_SCRIPT=/etc/init.d/php-${PHP_MAIN_VERSION}-fpm FPM_LOG_DIR=/var/log/php-${PHP_MAIN_VERSION}-fpm FPM_ERROR_LOG=${FPM_LOG_DIR}/fpm-${PHP_MAIN_VERSION}-error.log FPM_POOL_CONF_DIR=fpm.d FPM_DEFAULT_POOL=www-${PHP_MAIN_VERSION} FPM_DEFAULT_POOL_USER=$_PHP_FPM_USER FPM_DEFAULT_POOL_GROUP=$_PHP_FPM_GROUP FPM_DEFAULT_POOL_LISTEN=/tmp/php-${PHP_MAIN_VERSION}-fpm.`echo ${FPM_DEFAULT_POOL} | cut -d'-' -f1`.sock FPM_DEFAULT_POOL_LISTEN_OWNER=$_PHP_FPM_USER FPM_DEFAULT_POOL_LISTEN_GROUP=$HTTPD_GROUP FPM_DEFAULT_POOL_LISTEN_MODE=0660 FPM_DEFAULT_POOL_PM=dynamic FPM_DEFAULT_POOL_STATUS_PATH="/status-${PHP_MAIN_VERSION}" FPM_DEFAULT_POOL_PING_PATH="/ping-${PHP_MAIN_VERSION}" FPM_DEFAULT_POOL_PING_RESPONSE="pong" FPM_DEFAULT_POOL_ACCESS_LOG="${FPM_LOG_DIR}/${FPM_DEFAULT_POOL}-access.log" FPM_DEFAULT_POOL_SLOW_LOG="${FPM_LOG_DIR}/${FPM_DEFAULT_POOL}-slow.log" FPM_DEFAULT_POOL_ACCESS_FORMAT="\"%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%\"" FPM_DEFAULT_POOL_TERMINATE_TIMEOUT="`expr $MAX_EXECUTION_TIME + 1`s" FPM_ULIMIT_MAX_FILES=`su -c "ulimit -H -n" -s /bin/bash $_PHP_FPM_USER` echo "" echo "" echo -e "\033[32m--\033[m" echo "" echo -e "Skip updating file name database (used by 'locate') [ \033[33myes/no\033[m ]" echo "" echo "" SKIP_UPDATE_DB="" while [[ "X$SKIP_UPDATE_DB" = "X" ]] ; do echononl "Skip updating file name database ? [ $_SKIP_UPDATE_DB ]: " read SKIP_UPDATE_DB __to_lower="$(echo $SKIP_UPDATE_DB | tr '[:upper:]' '[:lower:]' | tr -d ' ')" if [[ "X$SKIP_UPDATE_DB" = "X" ]]; then SKIP_UPDATE_DB="$_SKIP_UPDATE_DB" break fi if [ "$__to_lower" = "yes" -o "$__to_lower" = "no" ]; then SKIP_UPDATE_DB=$__to_lower break fi echo "" echo -e "\t\033[31mWrong entry !! Try again..\033[m" echo "" SKIP_UPDATE_DB= done if [[ "$SKIP_UPDATE_DB" = "yes" ]] ; then SKIP_UPDATE_DB=true else SKIP_UPDATE_DB=false fi _install_freetype=false _install_icu4c=false _install_libxml2=false if ([[ "$PHP_MAJOR_VERSION" -eq 7 ]] && [[ "$PHP_MINOR_VERSION" -lt 4 ]]) \ || [[ "$PHP_MAJOR_VERSION" -lt 7 ]] ; then if [[ "$os_dist" = "debian" ]] && [[ $os_version -gt 9 ]] ; then echo "" echo "" echo -e "\033[32m--\033[m" echo "" echo -e "We need to install a version of freetype, which supports" echo -e "service 'freetype-config'. The development library libfreetype6" echo -e "of this distribution doesn't." echo -e "" echo -e "Which version of freetype should be installed?" echo "" FREETYPE_VERSION= if [[ -n "$_FREETYPE_VERSION" ]]; then echononl "Freetype Version [${_FREETYPE_VERSION}]: " read FREETYPE_VERSION if [[ "X$FREETYPE_VERSION" = "X" ]] ; then FREETYPE_VERSION="$_FREETYPE_VERSION" fi else echononl "Freetype Version: " read FREETYPE_VERSION while [[ "X$FREETYPE_VERSION" = "X" ]]; do echo -e "\n \033[33m\033[1Freetype Version must not be empty!\033[m\n" echononl "Freetype Version : " read FREETYPE_VERSION done fi _install_freetype=true if [[ "$PHP_MAJOR_VERSION" -lt 7 ]] \ || ([[ "$PHP_MAJOR_VERSION" -eq 7 ]] && [[ "$PHP_MINOR_VERSION" -eq 0 ]]) ; then echo "" echo "" echo -e "\033[32m--\033[m" echo "" echo -e "We need to install a version of libicu (icu4c), which supports" echo -e "service 'icu-config'. The development library libicu-dev" echo -e "of this distribution doesn't." echo -e "" echo -e "Which version of icu4c should be installed?" echo "" ICU4C_VERSION= if [[ -n "$_ICU4C_VERSION" ]]; then echononl "ICU4C Version [${_ICU4C_VERSION}]: " read ICU4C_VERSION if [[ "X$ICU4C_VERSION" = "X" ]] ; then ICU4C_VERSION="$_ICU4C_VERSION" fi else echononl "ICU4C Version: " read ICU4C_VERSION while [[ "X$ICU4C_VERSION" = "X" ]]; do echo -e "\n \033[33m\033[1ICU4C Version must not be empty!\033[m\n" echononl "ICU4C Version : " read ICU4C_VERSION done fi ICU4C_MAJOR_VERSION=`echo $ICU4C_VERSION | cut -d '-' -f1` ICU4C_MINOR_VERSION=`echo $ICU4C_VERSION | cut -d '-' -f2` _install_icu4c=true echo "" echo "" echo -e "\033[32m--\033[m" echo "" echo "We need to install an manual installed version of libxml2 (without icu support)," echo "because the installed one has icu support, but is linked against the distribution" echo "supported libicu-dev package." echo -e "" echo -e "Which version of libxml2 should be installed?" echo "" LIBXML2_VERSION= if [[ -n "$_LIBXML2_VERSION" ]]; then echononl "LIBXML2 Version [${_LIBXML2_VERSION}]: " read LIBXML2_VERSION if [[ "X$LIBXML2_VERSION" = "X" ]] ; then LIBXML2_VERSION="$_LIBXML2_VERSION" fi else echononl "LIBXML2 Version: " read LIBXML2_VERSION while [[ "X$LIBXML2_VERSION" = "X" ]]; do echo -e "\n \033[33m\033[1LIBXML2 Version must not be empty!\033[m\n" echononl "LIBXML2 Version : " read LIBXML2_VERSION done fi _install_libxml2=true fi # if [[ "$PHP_MAJOR_VERSION" -lt 7 ]] fi # if [[ "$os_dist" = "debian" ]] && [[ $os_version -eq 10 ]] fi if [[ $PHP_MAJOR_VERSION -ge 7 ]] ; then echo "" echo "" echo -e "\033[32m--\033[m" echo "" echo -e "Install support for lagacy MySQL functions [ \033[33myes/no\033[m ]" echo "" echo "" OK="" while [ "X$OK" = "X" ] do echononl "Install lagacy MySQL functions support ? [ $_LEGACY_SQL_FUNCTION_SUPPORT ] " read OK __to_lower=`echo $OK | tr '[:upper:]' '[:lower:]' | tr -d ' '` if [ "X$OK" = "X" ]; then OK=$_LEGACY_SQL_FUNCTION_SUPPORT break fi if [ "$__to_lower" = "yes" -o "$__to_lower" = "no" ]; then OK=$__to_lower break fi echo "" echo -e "\t\033[31mWrong entry !! Try again..\033[m" echo "" OK= done if [ "$OK" = "yes" ]; then LEGACY_SQL_FUNCTION_SUPPORT=true else LEGACY_SQL_FUNCTION_SUPPORT=false fi else LEGACY_SQL_FUNCTION_SUPPORT=false fi echo "" echo -e "\033[32m--\033[m" echo "" echo "Are you installing on a VServer guest system?" echo "" echononl "VServer Gastsystem (yes/no) [$_VSERVER_GUEST]: " read VSERVER_GUEST if [ "X$VSERVER_GUEST" = "X" ]; then VSERVER_GUEST=$_VSERVER_GUEST fi VSERVER_GUEST=`echo "$VSERVER_GUEST" | tr '[:upper:]' '[:lower:]'` while [ "X$VSERVER_GUEST" != "Xyes" -a "X$VSERVER_GUEST" != "Xno" ]; do echo "" echononl "\twrong entry! [yes/no]: " read VSERVER_GUEST VSERVER_GUEST=`echo "$VSERVER_GUEST" | tr '[:upper:]' '[:lower:]'` done if [ "$VSERVER_GUEST" = "yes" ]; then SYSTEMD_EXISTS=false fi echo "" echo "" echo "" echo -e "\033[32m--\033[m" echo "" echo -e "\033[21G\033[32mStart PHP Installation with the following Parameters \033[m" echo "" echo "OS distribution..................: $os_dist" echo "OS version.......................: $os_version (${os_codename})" echo "" echo "PHP version......................: $VERSION" echo "PHP main version.................: $PHP_MAIN_VERSION" echo "PHP major version................: $PHP_MAJOR_VERSION" echo "PHP minor version................: $PHP_MINOR_VERSION" echo "PHP patch level..................: $PHP_PATCH_LEVEL" echo "" echo "PHP configuration (php.ini)" echo " memory_limit..................: $MEMORY_LIMIT" echo " max_execution_time............: $MAX_EXECUTION_TIME" echo " max_input_time................: $MAX_INPUT_TIME" echo " upload_max_filesize...........: $UPLOAD_MAX_FILESIZE" echo " post_max_size.................: $POST_MAX_SIZE" echo "" echo "Apache User......................: $HTTPD_USER" echo "Apache Group.....................: $HTTPD_GROUP" echo "" #echo "MySQL Installation directory..: $MYSQL_INSTALL_DIR" #echo "" echo "Install with FPM support.........: $WITH_PHP_FPM_SUPPORT" if $WITH_PHP_FPM_SUPPORT ; then echo " Activate FPM init script......: $ACTIVATE_PHP_FPM_INIT_SCRIPT" echo " Set umask 0002 for FPM........: $SET_UMASK" echo "" echo " PHP FPM Socket definition(s)..: ${FPM_DEFAULT_POOL}.php-fpm.conf" if [[ ${#existing_fpm_definition_arr[@]} -gt 0 ]] ; then for _file in "${existing_fpm_definition_arr[@]}" ; do [[ "$(basename "$_file")" = "${FPM_DEFAULT_POOL}.php-fpm.conf" ]] && continue echo " $(basename "$_file")" done fi echo "" echo "PHP FPM Pool Definitions (php-fpm.conf or included files)" echo " pm.start_servers..............: $FPM_POOL_START_SERVER" echo " pm.min_spare_servers..........: $FPM_POOL_MIN_SPARE" echo " pm.max_spare_servers..........: $FPM_POOL_MAX_SPARE" echo " pm.max_children...............: $FPM_POOL_MAX_CHILDREN" echo " pm.max_requests...............: $FPM_POOL_MAX_REQUESTS" fi if [[ $PHP_MAJOR_VERSION -ge 7 ]]; then echo "" echo "Support legacy SQL functions.....: $LEGACY_SQL_FUNCTION_SUPPORT" fi echo "" echo "Install with systemd Support.....: $SYSTEMD_EXISTS" echo "" echo "Install with (apache) mod_php....: $WITH_MOD_PHP" if $WITH_MOD_PHP ; then echo " Apache Version.............: $APACHE_VERSION" fi echo "" if $SYMLINK_PHP_MAIN_VERSION -o $SYMLINK_PHP ; then echo "Set symlniks:" if $SYMLINK_PHP ; then echo " /usr/local/php -> /usr/local/php-$PHP_MAIN_VERSION" fi if $SYMLINK_PHP_MAIN_VERSION ; then echo " /usr/local/php-$PHP_MAIN_VERSION -> `basename $PREFIX_PHP`" fi fi echo "" echo "" echo "Install extern freetype .........: $_install_freetype" if $_install_freetype ; then echo " freetype version .............: $FREETYPE_VERSION" fi echo "" echo "Install extern libicu ...........: $_install_icu4c" if $_install_icu4c ; then echo " icu4c version ................: $ICU4C_VERSION" fi echo "" echo "Install extern libxml2 ..........: $_install_libxml2" if $_install_libxml2 ; then echo " libxml2 version ..............: $LIBXML2_VERSION" fi echo "" echo "Skip 'updatedb'..................: $SKIP_UPDATE_DB" echo "" echo "" echo "Vserver Guest System.............: $VSERVER_GUEST" echo "" echononl "Start with that configuration? [yes/no]: " read OK while [ "X$OK" != "Xyes" -a "X$OK" != "XYes" -a "X$OK" != "XNo" -a "X$OK" != "Xno" ] do echononl "wrong entry! [yes/no] :" read OK done [ $OK = "Yes" -o $OK = "yes" ] || fatal "Change parameters and restart script: `basename $0`" echo "" echo "" ## -------------------------------------------------- if [ -d "$_logdir" ];then mv $_logdir $_logdir.$_backup_date fi mkdir -p $_logdir > /dev/null 2>&1 if [ -d "$_builddir" ];then mv $_builddir $_builddir.$_backup_date fi if [ -d "$PREFIX_PHP" ];then mv $PREFIX_PHP $PREFIX_PHP.$_backup_date fi declare -a existing_fpm_definition_arr=() FPM_DEFAULT_POOL_DEFINITION_EXISTS=false if $WITH_PHP_FPM_SUPPORT ; then echo "" echo -e "\033[32m--\033[m" echononl "Get existing socket definitions" if [[ -n "$(ls $PREFIX_PHP.${_backup_date}/etc/fpm.d/*.conf 2>/dev/null)" ]]; then for _file in $(ls $PREFIX_PHP.${_backup_date}/etc/fpm.d/*.conf) ; do if [[ "$(basename "$_file")" = "${FPM_DEFAULT_POOL}.php-fpm.conf" ]]; then FPM_DEFAULT_POOL_DEFINITION_EXISTS=true fi existing_fpm_definition_arr+=("$(realpath "$_file")") done echo_ok elif [[ -n "$(ls /usr/local/php-${PHP_MAIN_VERSION}/etc/fpm.d/*.conf 2>/dev/null)" ]]; then for _file in $(ls /usr/local/php-${PHP_MAIN_VERSION}/etc/fpm.d/*.conf) ; do if [[ "$(basename "$_file")" = "${FPM_DEFAULT_POOL}.php-fpm.conf" ]]; then FPM_DEFAULT_POOL_DEFINITION_EXISTS=true fi existing_fpm_definition_arr+=("$(realpath "$_file")") done echo_ok else echo_skipped fi echo -e "\033[32m--\033[m" echo "" fi echo "" echo "" echo -e "\033[32m--\033[m" echo "" echo "Starting Installation of PHP v $VERSION..." echo "" echo "" echo -e "\t---" echo -e "\t--- pre-installation tasks" echo -e "\t---" echo "" # - Update index files of the debian repositories # - echononl "\tUpdate index files of the debian repositories" apt-get update >> /dev/null 2>&1 if [ "$?" = "0" ]; then echo_ok else echo_failed fatal "\"apt-get update\" failed!" fi echononl "\tInstall compiler stuff.." if [[ -n "$needed_compiler_packages" ]]; then DEBIAN_FRONTEND=noninteractive apt-get -y install $needed_compiler_packages > /dev/null 2> $tmp_err_msg #DEBIAN_FRONTEND=noninteractive apt-get -y install $needed_packages > /dev/null 2> $tmp_err_msg if [[ $? -eq 0 ]] ; then echo_ok else echo_failed error "$(cat $tmp_err_msg)" fi else echo_skipped info "Up-to-date.." fi echononl "\tInstall needed packages for base install" if [[ -n "$needed_debian_packages" ]]; then DEBIAN_FRONTEND=noninteractive apt-get -y install $needed_debian_packages > /dev/null 2> $tmp_err_msg if [[ $? -eq 0 ]] ; then echo_ok else echo_failed error "$(cat $tmp_err_msg)" fi else echo_skipped info "Up-to-date.." fi echononl "\tInstall needed packages for php extensions" if [[ -n "$needed_extension_packages" ]]; then DEBIAN_FRONTEND=noninteractive apt-get -y install $needed_extension_packages > /dev/null 2> $tmp_err_msg if [[ $? -eq 0 ]] ; then echo_ok else echo_failed error "$(cat $tmp_err_msg)" fi else echo_skipped info "Up-to-date.." fi if $_install_freetype && [[ ! -d /usr/local/freetype-$FREETYPE_VERSION ]]; then ## - Install freetype with support for 'freetype-config' ## - echo "" echo "" echo -e "\t---" echo -e "\t--- Install freetype with support for 'freetype-config'" echo -e "\t---" echo "" freetype_archive="freetype-${FREETYPE_VERSION}.tar.gz" _src_dir_freetype="/usr/local/src/freetype" _build_dir_freetype="${_src_dir_freetype}/freetype-${FREETYPE_VERSION}" echononl "\tCreate source directory '$_src_dir_freetype'.." if [[ ! -d "$_src_dir_freetype" ]]; then mkdir "$_src_dir_freetype" >> ${_logdir}/main.log 2>&1 if [[ $? -eq 0 ]]; then echo_ok else echo_failed error "Cannot create directory '$_src_dir_freetype'" echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/no]: " read OK done [[ $OK = "yes" ]] || fatal "Interupted by user" fi else echo_skipped fi cd "$_src_dir_freetype" echononl "\tGet source $freetype_archive .." if [[ ! -f ${_src_dir_freetype}/$freetype_archive ]]; then wget -O "${_src_dir_freetype}/$freetype_archive" \ https://sourceforge.net/projects/freetype/files/freetype2/${FREETYPE_VERSION}/${freetype_archive}/download \ >> ${_logdir}/main.log 2>&1 if [ "$?" = "0" ]; then echo_ok else echo_failed error "Cannot Download '$freetype_archive'" echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/no]: " read OK done [[ $OK = "yes" ]] || fatal "Interupted by user" fi else echo_skipped fi _backup_dir="$_build_dir_freetype" echononl "\tBackup existing directory '${_backup_dir}'.." if [[ -d "${_backup_dir}" ]]; then mv "${_backup_dir}" "${_backup_dir}.$_backup_date" > /dev/null 2> $tmp_err_msg if [[ $? -eq 0 ]] ; then echo_ok else echo_failed error "$(cat $tmp_err_msg)" echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/no]: " read OK done [[ $OK = "yes" ]] || fatal "Interupted by user" fi else echo_skipped fi echononl "\tUnpack archive \"$freetype_archive\".." gunzip < "${freetype_archive}" | tar -xf - 2> $tmp_err_msg if [[ $? -eq 0 ]]; then echo_ok else echo_failed error "$(cat $tmp_err_msg)" echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/no]: " read OK done [[ $OK = "yes" ]] || fatal "Interupted by user" fi cd "$_build_dir_freetype" config_params="--enable-freetype-config --prefix=/usr/local/freetype-$FREETYPE_VERSION" echononl "\tGoing to configure freetype-$FREETYPE_VERSION .." ./configure $config_params >> ${_logdir}/freetype-configure.log 2>&1 if [ "$?" = "0" ]; then echo_ok else echo_failed error "Configuring freetype failed!\n\t see ${_logdir}/freetype-configure.log-configure.log for more details" echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/no]: " read OK done [[ $OK = "yes" ]] || fatal "Interupted by user" fi echononl "\tGoing to compile freetype-$FREETYPE_VERSION .." make > ${_logdir}/freetype-make.log 2>&1 if [ "$?" = "0" ]; then echo_ok else echo_failed error "Compiling freetype failed!\n\t see ${_logdir}/freetype-make.log for more details" echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/no]: " read OK done [[ $OK = "yes" ]] || fatal "Interupted by user" fi _backup_dir="/usr/local/freetype-${FREETYPE_VERSION}" echononl "\tBackup existing directory '${_backup_dir}'.." if [[ -d "${_backup_dir}" ]]; then mv "${_backup_dir}" "${_backup_dir}.$_backup_date" > /dev/null 2> $tmp_err_msg if [[ $? -eq 0 ]] ; then echo_ok else echo_failed error "$(cat $tmp_err_msg)" echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/no]: " read OK done [[ $OK = "yes" ]] || fatal "Interupted by user" fi else echo_skipped fi echononl "\tGoing to install freetype-$FREETYPE_VERSION.." make install > ${_logdir}/freetype-make_install.log 2>&1 if [[ $? -eq 0 ]]; then echo_ok else echo_failed error "Installing freetype failed!\n\t see ${_logdir}/freetype-make_install.log for more details" echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/no]: " read OK done [[ $OK = "yes" ]] || fatal "Interupted by user" fi echononl "\tSet symlink /usr/local/freetype -> /usr/local/freetype-$FREETYPE_VERSION .." if [ -L /usr/local/freetype ];then rm -f /usr/local/freetype fi ln -s freetype-$FREETYPE_VERSION /usr/local/freetype > $tmp_err_msg 2>&1 if [[ $? -eq 0 ]]; then echo_ok else echo_failed error "$(cat $tmp_err_msg)" echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/no]: " read OK done [[ $OK = "yes" ]] || fatal "Interupted by user" fi fi if $_install_icu4c && [[ ! -d /usr/local/icu4c-$ICU4C_VERSION ]]; then ## - Install icu4c (with support for 'icu-config' ## - echo "" echo "" echo -e "\t---" echo -e "\t--- Install icu4c with support for 'icu-config'" echo -e "\t---" echo "" icu4c_archive="icu4c-${ICU4C_MAJOR_VERSION}_${ICU4C_MINOR_VERSION}-src.tgz" _src_dir_icu4c="/usr/local/src/icu4c" _build_dir_icu4c="${_src_dir_icu4c}/icu/source" echononl "\tCreate source directory '$_src_dir_icu4c'.." if [[ ! -d "$_src_dir_icu4c" ]]; then mkdir "$_src_dir_icu4c" >> ${_logdir}/main.log 2>&1 if [[ $? -eq 0 ]]; then echo_ok else echo_failed error "Cannot create directory '$_src_dir_icu4c'" echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/no]: " read OK done [[ $OK = "yes" ]] || fatal "Interupted by user" fi else echo_skipped fi cd "$_src_dir_icu4c" echononl "\tGet source $icu4c_archive .." if [[ ! -f ${_src_dir_icu4c}/$icu4c_archive ]]; then wget -O "${_src_dir_icu4c}/$icu4c_archive" \ https://github.com/unicode-org/icu/releases/download/release-${ICU4C_VERSION}/$icu4c_archive \ >> ${_logdir}/main.log 2>&1 if [ "$?" = "0" ]; then echo_ok else echo_failed error "Cannot Download '$icu4c_archive'" echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/no]: " read OK done [[ $OK = "yes" ]] || fatal "Interupted by user" fi else echo_skipped fi _backup_dir="${_src_dir_icu4c}/icu" echononl "\tBackup existing directory '${_backup_dir}'.." if [[ -d "${_backup_dir}" ]]; then mv "${_backup_dir}" "${_backup_dir}.$_backup_date" > /dev/null 2> $tmp_err_msg if [[ $? -eq 0 ]] ; then echo_ok else echo_failed error "$(cat $tmp_err_msg)" echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/no]: " read OK done [[ $OK = "yes" ]] || fatal "Interupted by user" fi else echo_skipped fi echononl "\tUnpack archive \"$icu4c_archive\".." gunzip < "${icu4c_archive}" | tar -xf - 2> $tmp_err_msg if [[ $? -eq 0 ]]; then echo_ok else echo_failed error "$(cat $tmp_err_msg)" echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/no]: " read OK done [[ $OK = "yes" ]] || fatal "Interupted by user" fi cd "$_build_dir_icu4c" config_params="--prefix=/usr/local/icu4c-$ICU4C_VERSION" echononl "\tGoing to configure icu4c-$ICU4C_VERSION .." ./configure $config_params >> ${_logdir}/icu4c-configure.log 2>&1 if [ "$?" = "0" ]; then echo_ok else echo_failed error "Configuring icu4c failed!\n\t see ${_logdir}/icu4c-configure.log for more details" echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/no]: " read OK done [[ $OK = "yes" ]] || fatal "Interupted by user" fi echononl "\tGoing to compile icu4c-$ICU4C_VERSION .." make > ${_logdir}/icu4c-make.log 2>&1 if [ "$?" = "0" ]; then echo_ok else echo_failed error "Compiling icu4c failed!\n\t see ${_logdir}/icu4c-make.log for more details" echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/no]: " read OK done [[ $OK = "yes" ]] || fatal "Interupted by user" fi _backup_dir="/usr/local/icu4c-${ICU4C_VERSION}" echononl "\tBackup existing directory '${_backup_dir}'.." if [[ -d "${_backup_dir}" ]]; then mv "${_backup_dir}" "${_backup_dir}.$_backup_date" > /dev/null 2> $tmp_err_msg if [[ $? -eq 0 ]] ; then echo_ok else echo_failed error "$(cat $tmp_err_msg)" echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/no]: " read OK done [[ $OK = "yes" ]] || fatal "Interupted by user" fi else echo_skipped fi echononl "\tGoing to install icu4c-$ICU4C_VERSION.." make install > ${_logdir}/icu4c-make_install.log 2>&1 if [[ $? -eq 0 ]]; then echo_ok else echo_failed error "Installing icu4c failed!\n\t see ${_logdir}/icu4c-make_install.log for more details" echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/no]: " read OK done [[ $OK = "yes" ]] || fatal "Interupted by user" fi echononl "\tSet symlink /usr/local/icu4c -> /usr/local/icu4c-$ICU4C_VERSION .." if [ -L /usr/local/icu4c ];then rm -f /usr/local/icu4c fi ln -s icu4c-$ICU4C_VERSION /usr/local/icu4c > $tmp_err_msg 2>&1 if [[ $? -eq 0 ]]; then echo_ok else echo_failed error "$(cat $tmp_err_msg)" echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/no]: " read OK done [[ $OK = "yes" ]] || fatal "Interupted by user" fi fi if $_install_libxml2 && [[ ! -d /usr/local/libxml2-$LIBXML2_VERSION ]]; then ## - Install libxml2' ## - echo "" echo "" echo -e "\t---" echo -e "\t--- Install libxml2" echo -e "\t---" echo "" libxml2_archive="libxml2-${LIBXML2_VERSION}.tar.gz" _src_dir_libxml2="/usr/local/src/libxml2" _build_dir_libxml2="${_src_dir_libxml2}/libxml2-${LIBXML2_VERSION}" echononl "\tCreate source directory '$_src_dir_libxml2'.." if [[ ! -d "$_src_dir_libxml2" ]]; then mkdir "$_src_dir_libxml2" >> ${_logdir}/main.log 2>&1 if [[ $? -eq 0 ]]; then echo_ok else echo_failed error "Cannot create directory '$_src_dir_libxml2'" echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/no]: " read OK done [[ $OK = "yes" ]] || fatal "Interupted by user" fi else echo_skipped fi cd "$_src_dir_libxml2" echononl "\tGet source $libxml2_archive .." if [[ ! -f ${_src_dir_libxml2}/$libxml2_archive ]]; then wget -O "${_src_dir_libxml2}/$libxml2_archive" \ ftp://xmlsoft.org/libxml2/${libxml2_archive} \ >> ${_logdir}/main.log 2>&1 if [ "$?" = "0" ]; then echo_ok else echo_failed error "Cannot Download '$libxml2_archive'" echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/no]: " read OK done [[ $OK = "yes" ]] || fatal "Interupted by user" fi else echo_skipped fi _backup_dir="$_build_dir_libxml2" echononl "\tBackup existing directory '${_backup_dir}'.." if [[ -d "${_backup_dir}" ]]; then mv "${_backup_dir}" "${_backup_dir}.$_backup_date" > /dev/null 2> $tmp_err_msg if [[ $? -eq 0 ]] ; then echo_ok else echo_failed error "$(cat $tmp_err_msg)" echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/no]: " read OK done [[ $OK = "yes" ]] || fatal "Interupted by user" fi else echo_skipped fi echononl "\tUnpack archive \"$libxml2_archive\".." gunzip < "${libxml2_archive}" | tar -xf - 2> $tmp_err_msg if [[ $? -eq 0 ]]; then echo_ok else echo_failed error "$(cat $tmp_err_msg)" echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/no]: " read OK done [[ $OK = "yes" ]] || fatal "Interupted by user" fi cd "$_build_dir_libxml2" config_params="--prefix=/usr/local/libxml2-$LIBXML2_VERSION" echononl "\tGoing to configure libxml2-$LIBXML2_VERSION .." ./configure $config_params >> ${_logdir}/libxml2-configure.log 2>&1 if [ "$?" = "0" ]; then echo_ok else echo_failed error "Configuring libxml2 failed!\n\t see ${_logdir}/libxml2-configure.log-configure.log for more details" echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/no]: " read OK done [[ $OK = "yes" ]] || fatal "Interupted by user" fi echononl "\tGoing to compile libxml2-$LIBXML2_VERSION .." make > ${_logdir}/libxml2-make.log 2>&1 if [ "$?" = "0" ]; then echo_ok else echo_failed error "Compiling libxml2 failed!\n\t see ${_logdir}/libxml2-make.log for more details" echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/no]: " read OK done [[ $OK = "yes" ]] || fatal "Interupted by user" fi _backup_dir="/usr/local/libxml2-${LIBXML2_VERSION}" echononl "\tBackup existing directory '${_backup_dir}'.." if [[ -d "${_backup_dir}" ]]; then mv "${_backup_dir}" "${_backup_dir}.$_backup_date" > /dev/null 2> $tmp_err_msg if [[ $? -eq 0 ]] ; then echo_ok else echo_failed error "$(cat $tmp_err_msg)" echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/no]: " read OK done [[ $OK = "yes" ]] || fatal "Interupted by user" fi else echo_skipped fi echononl "\tGoing to install libxml2-$LIBXML2_VERSION.." make install > ${_logdir}/libxml2-make_install.log 2>&1 if [[ $? -eq 0 ]]; then echo_ok else echo_failed error "Installing libxml2 failed!\n\t see ${_logdir}/libxml2-make_install.log for more details" echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/no]: " read OK done [[ $OK = "yes" ]] || fatal "Interupted by user" fi echononl "\tSet symlink /usr/local/libxml2 -> /usr/local/libxml2-$LIBXML2_VERSION .." if [ -L /usr/local/libxml2 ];then rm -f /usr/local/libxml2 fi ln -s libxml2-$LIBXML2_VERSION /usr/local/libxml2 > $tmp_err_msg 2>&1 if [[ $? -eq 0 ]]; then echo_ok else echo_failed error "$(cat $tmp_err_msg)" echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/no]: " read OK done [[ $OK = "yes" ]] || fatal "Interupted by user" fi fi ## - Set Symlink ## - /usr/include/x86_64-linux-gnu/gmp.h -> /usr/include/gmp.h ## - if not exists ## - if [ -f "/usr/include/x86_64-linux-gnu/gmp.h" -a ! -e "/usr/include/gmp.h" ]; then echononl "\tSet Symlink /usr/include/x86_64-linux-gnu/gmp.h.." ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h if [ "$?" = "0" ]; then echo_ok else echo_failed warn "Cannot set Symlink /usr/include/x86_64-linux-gnu/gmp.h -> /usr/include/gmp.h" fi echo "" fi ## - Set Symlink ## - /usr/lib/x86_64-linux-gnu/libldap.so -> /usr/lib/libldap.so ## - if not exists ## - if [ -f "/usr/lib/x86_64-linux-gnu/libldap.so" -a ! -e "/usr/lib/libldap.so" ]; then echononl "\tSet Symlink /usr/lib/x86_64-linux-gnu/libldap.so.." ln -s /usr/lib/x86_64-linux-gnu/libldap.so /usr/lib/libldap.so if [ "$?" = "0" ]; then echo_ok else echo_failed warn "Cannot set Symlink /usr/lib/x86_64-linux-gnu/libldap.so -> /usr/lib/libldap.so" fi echo "" fi ## - Set Symlink ## - /usr/lib/x86_64-linux-gnu/libXpm.so -> /usr/lib/libXpm.so ## - if not exists ## - if [ -f "/usr/lib/x86_64-linux-gnu/libXpm.so" -a ! -e "/usr/lib/libXpm.so" ]; then echononl "\tSet Symlink /usr/lib/x86_64-linux-gnu/libXpm.so.." ln -s /usr/lib/x86_64-linux-gnu/libXpm.so /usr/lib/libXpm.so if [ "$?" = "0" ]; then echo_ok else echo_failed warn "Cannot set Symlink /usr/lib/x86_64-linux-gnu/libXpm.so -> /usr/lib/libXpm.so" fi echo "" fi ## - Set Symlink ## - /usr/include/x86_64-linux-gnu/curl -> /usr/include/curl ## - if not exists ## - if [[ -d "/usr/include/x86_64-linux-gnu/curl" ]] && [[ ! -e "/usr/include/curl" ]] ; then echononl "\tSet Symlink /usr/include/x86_64-linux-gnu/curl.." ln -s x86_64-linux-gnu/curl /usr/include/curl if [ "$?" = "0" ]; then echo_ok else echo_failed warn "Cannot set Symlink /usr/include/x86_64-linux-gnu/curl -> /usr/include/curl" fi echo "" fi ## - Disable crontab for user root ## - _crontab_found=false echononl "\tBackup crontab" crontab -u root -l >> $_CRONTAB_BAKUP_FILE 2> $tmp_err_msg if [ "$?" = "0" ]; then echo_ok _crontab_found=true else if [[ ! -s "$_CRONTAB_BAKUP_FILE" ]] ; then echo_skipped warn "No crontab for user 'root'found." else echo_failed error "$(cat $tmp_err_msg)" fi fi if $_crontab_found ; then echononl "\tDisable crontab for user root" crontab -r -u root >> ${_logdir}/main.log 2>&1 if [ "$?" = "0" ]; then echo_ok else echo_failed fi fi echo "" echo "" echo -e "\t---" echo -e "\t--- Install PHP v $PHP_VERSION_STRING" echo -e "\t---" echo "" ## - get sources.. ## - cd $_srcdir echononl "\tGet source php-$VERSION.tar.bz2.." if [ ! -f ${_srcdir}/php-$VERSION.tar.bz2 ]; then wget http://de2.php.net/distributions/php-$VERSION.tar.bz2 >> ${_logdir}/main.log 2>&1 if [ "$?" = "0" ]; then echo_ok else echo_failed fatal "Cannot Download php-$VERSION.tar.bz2" fi else echo_skipped fi echononl "\tUnpack archive \"php-$VERSION.tar.bz2\".." bunzip2 < ${_srcdir}/php-$VERSION.tar.bz2 | tar -xf - 2> $tmp_err_msg if [[ $? -eq 0 ]]; then echo_ok else echo_failed fatal "$(cat $tmp_err_msg)" fi echononl "\tApply patch to compile against OpenSSL 1.1.." if [[ "$os_dist" = "debian" ]] && [[ $os_version -gt 8 ]] && [[ $PHP_MAJOR_VERSION -lt 7 ]]; then if [[ -f ${_srcdir}/PHP-5.6.31-OpenSSL-1.1.0-compatibility-20170801.patch ]] ; then patch -d $_builddir -p1 < ${_srcdir}/PHP-5.6.31-OpenSSL-1.1.0-compatibility-20170801.patch > $tmp_err_msg 2>&1 if [[ $? -eq 0 ]]; then echo_ok else echo_failed fatal "$(cat $tmp_err_msg)" fi else echo_failed fatal "Can't find patchfile '${_srcdir}/PHP-5.6.31-OpenSSL-1.1.0-compatibility-20170801.patch'" fi else echo_skipped fi echononl "\tChange ownership of unpacked dirextory \"php-$VERSION\"" chown -R root.root php-$VERSION > $tmp_err_msg 2>&1 if [[ $? -eq 0 ]]; then echo_ok else echo_failed fatal "$(cat $tmp_err_msg)" fi if ! $WITHOUT_APACHE_MOD_PHP ; then mv php-$VERSION $_builddir fi cd $_builddir || exit 1 echononl "\tGoing to configure.." # : ${_arch:=i686} # : ${_arch:=athlon} # : ${_arch:=k8} ## --> x86-64 instructionset ##_cflags="-O2 -march=$_arch " ## - LDFLAGS="-s" --> Remove all symbol table and relocation information from the executable. ## F77="/usr/bin/g77-3.4" \ ## CXXCPP="/usr/bin/g++-3.4 -E" \ ## CC="/usr/bin/gcc-3.4" \ ## CXX="/usr/bin/g++-3.4" \ ## CPP="/usr/bin/cpp-3.4" \ ## CFLAGS="$_cflags" LDFLAGS="-s" \ config_params=" --prefix=$PREFIX_PHP --with-pgsql --with-pdo-pgsql --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --enable-exif --with-zlib --with-openssl --with-gdbm --with-curl --enable-dba --enable-ftp --with-gmp --with-readline --enable-sockets --with-imap --with-imap-ssl --with-kerberos --with-gettext --with-pspell --enable-soap --enable-mbstring --enable-calendar --enable-bcmath --enable-opcache --with-bz2 --enable-intl --enable-shmop --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-pcntl --with-ldap=shared --with-xsl --with-mhash --enable-cgi --with-xmlrpc" # --with-t1lib \ # Note: # Debian buster's package libfreetype6-dev is missing 'freetype-config'. # but you can use pkg-config instead. # Use '-enable-freetype', which relies on pkg-config instead of # '--with-freetype-dir_DIR', which relies on freetype-config. # if ([[ "$PHP_MAJOR_VERSION" -eq 7 ]] && [[ "$PHP_MINOR_VERSION" -gt 3 ]]) \ || [[ "$PHP_MAJOR_VERSION" -gt 7 ]] ; then # --with-png-dir has been removed. libpng is required. # --with-zlib-dir has been removed. zlib is required. # --with-jpeg-dir becomes --with-jpeg # --with-freetype-dir becomes --with-freetype # # The WDDX extension has been deprecated and moved to PECL. config_params="$config_params --with-freetype --enable-gd --with-jpeg --with-xpm --with-webp --with-zip --with-zlib --with-pear --with-sodium " else config_params="$config_params --with-gd --with-png-dir --with-pcre-regex --with-jpeg-dir --with-xpm-dir --enable-zip --enable-wddx " if [[ "$os_dist" = "debian" ]] && [[ $os_version -lt 10 ]] ; then config_params="$config_params --with-freetype-dir" else config_params="$config_params --with-freetype-dir=/usr/local/freetype" fi fi if ([[ "$PHP_MAJOR_VERSION" -eq "5" ]] || ([[ "$PHP_MAJOR_VERSION" -eq "7" ]] && [[ "$PHP_MINOR_VERSION" -eq 0 ]])) \ && [[ "$os_dist" = "debian" ]] && [[ $os_version -ge 10 ]]; then config_params="$config_params --with-icu-dir=/usr/local/icu4c --with-libxml-dir=/usr/local/libxml2" fi # --with-fpm-systemd \ if $SYSTEMD_EXISTS ; then config_params="$config_params --with-fpm-systemd" fi ## - since version 7.0: unrecognized options --with-t1lib ## - ## - '--with-webp-dir=DIR' has to be added, i.e. support for libvpx ## - '--with-vpx-dir') has been removed in favor of libwebp. ## - if [[ $PHP_MAJOR_VERSION -lt 7 ]] ; then config_params="$config_params --with-vpx-dir" else if [[ "$PHP_MAJOR_VERSION" -eq 7 ]] ; then if [[ "$PHP_MINOR_VERSION" -le 3 ]] ; then config_params="$config_params \ --with-webp-dir" fi fi fi ## - since version 7.2: MCrypt is moved to PECL ## - if ([[ "$PHP_MAJOR_VERSION" -eq 7 ]] && [[ "$PHP_MINOR_VERSION" -lt 2 ]]) \ || [[ "$PHP_MAJOR_VERSION" -lt 7 ]] ; then config_params="$config_params --with-mcrypt" fi if [[ $PHP_MAJOR_VERSION -lt 7 ]] ; then config_params="$config_params --with-mysql=mysqlnd" fi _mysql_socket="" _mysql_config="$(which mysql_config)" if [[ -z "$_mysql_config" ]]; then if [[ -x "/usr/local/mysql/bin/mysql_config" ]]; then _mysql_config="/usr/local/mysql/bin/mysql_config" fi fi if [[ -x "$_mysql_config" ]]; then if $_mysql_config --socket > /dev/null 2>&1 ; then _mysql_socket="$($_mysql_config --socket)" fi fi if [[ -n "$_mysql_socket" ]]; then config_params="$config_params --with-mysql-sock=$_mysql_socket" else config_params="$config_params --with-mysql-sock" fi if $WITHOUT_APACHE_MOD_PHP ; then config_params="$config_params --without-apxs2 --with-config-file-path=${PREFIX_PHP}/etc" else config_params="$config_params --with-apxs2=$APXS --with-config-file-path=${APACHE_BASEDIR}/conf" fi if $WITH_PHP_FPM_SUPPORT ; then config_params="$config_params --enable-fpm" fi echo "LDFLAGS=\"-s\" ./configure $config_params" > ${_logdir}/php-configure.log echo "" >> ${_logdir}/php-configure.log LDFLAGS="-s" ./configure $config_params >> ${_logdir}/php-configure.log 2>&1 if [ "$?" = "0" ]; then echo_ok else echo_failed fatal "Configuring PHP failed!\n\t see ${_logdir}/php-configure.log for more details" fi ## --with-mm \ # does not work with apache v2.4 ## --with-pgsql=/usr/local/pgsql \ ## --with-mysql=/usr/local/mysql \ ## --with-mysqli=/usr/local/mysql/bin/mysql_config \ ## --with-pdo-mysql=/usr/local/mysql \ ## --with-mysql-sock \ ## --with-mysql \ ## --with-mysqli \ ## --with-pdo-mysql \ ## --with-mysql-sock \ ## --enable-force-cgi-redirect \ ## --enable-track-vars \ ## --with-tiff-dir \ ## --with-ttf \ ## --with-memcache \ ## --with-xml \ echononl "\tGoing to compile.." make > ${_logdir}/php-make.log 2>&1 if [ "$?" = "0" ]; then echo_ok else echo_failed fatal "Compiling PHP failed!\n\t see ${_logdir}/php-make.log for more details" fi sync echononl "\tGoing to install.." make install > ${_logdir}/php-make_install.log 2>&1 if [[ $? -ne 0 ]]; then echo_failed if [[ "$PHP_MAIN_VERSION" = "5.4" ]]; then echononl "\tRetry Installing.." make install > ${_logdir}/php-make_install.log 2>&1 if [[ $? -eq 0 ]]; then echo_ok else echo_failed fatal "Installing PHP failed!\n\t see ${_logdir}/php-make_install.log for more details" fi else fatal "Installing PHP failed!\n\t see ${_logdir}/php-make_install.log for more details" fi else echo_ok fi #cp php.ini-production $PHP_INI_FILE || exit 1 [ -f $PHP_INI_FILE ] && cp -a $PHP_INI_FILE ${$PHP_INI_FILE}-$_backup_date cp php.ini-production $PHP_INI_FILE || exit 1 ## - Temporarily change PATH environment variable ## - export PATH=/usr/local/php-${VERSION}/bin:$PATH if ! $WITHOUT_APACHE_MOD_PHP ; then _set_php_entries="" echo "" echo -n "do you want to set \"LoadModule\" entries in httpd.conf ? [y/n]: " read _set_php_entries if [ "y" = "$_set_php_entries" -o "Y" = "$_set_php_entries" -o "Yes" = "$_set_php_entries" -o "yes" = "$_set_php_entries" ];then sed -i -r \ -e "s&(^\s*LoadModule php${PHP_MAJOR_VERSION}_module.*$)&\1\n\n AddType application/x-httpd-php .php\n AddType application/x-httpd-php-source .phps\n&" ${APACHE_BASEDIR}/conf/httpd.conf #-e "s&(^\s*LoadModule php${PHP_MAJOR_VERSION}_module.*$)&\1\n\n AddType application/x-httpd-php .php .php5 .php4 .php3 .phtml\n AddType application/x-httpd-php-source .phps\n&" ${APACHE_BASEDIR}/conf/httpd.conf fi fi echo "" echo "" echo -e "\t---" echo -e "\t--- post installation tasks" echo -e "\t---" if $SYMLINK_PHP ; then echononl "\tSet symlink /usr/local/php -> /usr/local/php-$PHP_MAIN_VERSION" if [ -L /usr/local/php ];then rm -f /usr/local/php fi ln -s php-$PHP_MAIN_VERSION /usr/local/php if [ "$?" = "0" ]; then echo_ok else echo_failed fi fi if $SYMLINK_PHP_MAIN_VERSION ; then echononl "\tSet symlink /usr/local/php-$PHP_MAIN_VERSION -> `basename $PREFIX_PHP`" if [ -h /usr/local/php-${PHP_MAIN_VERSION} ] ; then rm -f /usr/local/php-${PHP_MAIN_VERSION} fi ln -s `basename $PREFIX_PHP` /usr/local/php-$PHP_MAIN_VERSION if [ "$?" = "0" ]; then echo_ok else echo_failed fi fi ## - special for debian. set manpath entries ## - if [ -f /etc/manpath.config ];then if ! grep /usr/local/php/php/man /etc/manpath.config > /dev/null 2<&1 ; then echo >> /etc/manpath.config echo "MANDATORY_MANPATH /usr/local/php/php/man /var/cache/man" >> /etc/manpath.config echo "MANPATH_MAP /usr/local/php/bin /usr/local/php/php/man" >> /etc/manpath.config echo "MANDB_MAP /usr/local/php/php/man /var/cache/man" >> /etc/manpath.config fi elif [ -f /etc/man.conf];then if ! grep /opt/php/man /etc/man.conf > /dev/null 2<&1 ; then echo >> /etc/man.conf echo "MANPATH /opt/php/man /var/cache/man" >> /etc/man.conf echo "MANPATH_MAP /opt/php/bin /opt/php/man" >> /etc/man.conf fi fi ## - Add /usr/local/php/bin to the systems PATH variable ## - echo "" echononl "\tAdd `dirname $PREFIX_PHP`/php/bin to the systems PATH variable" _checkdir=`dirname $PREFIX_PHP`/php/bin if [ -f /etc/profile ]; then if ! grep -e "$_checkdir" /etc/profile > /dev/null 2<&1 ; then perl -i -n -p -e "s#^([ ]*export[ ]*PATH.*$)#check_dir=$_checkdir\nif [ -d \"\\\$check_dir\" ];then\n PATH=\\\${check_dir}:\\\$PATH\nfi\n\n\1#" /etc/profile > /dev/null 2<&1 if [ "$?" = "0" ]; then echo_ok else echo_failed fi if ! echo "$PATH" | grep $_checkdir > /dev/null 2>&1 ; then export PATH=${_checkdir}:$PATH fi else echo_skipped fi fi ## - PHP FPM ## - echo "" echo "" echo -e "\t---" echo -e "\t--- Install support for PHP-FPM" echo -e "\t---" echo "" if $WITH_PHP_FPM_SUPPORT ; then if $SYSTEMD_EXISTS ; then if $ACTIVATE_PHP_FPM_INIT_SCRIPT ; then if systemctl is-enabled php-${PHP_MAIN_VERSION}-fpm.service > /dev/null 2>&1 ; then echononl "\tStop service php-${PHP_MAIN_VERSION}-fpm" systemctl stop php-${PHP_MAIN_VERSION}-fpm.service > /dev/null 2>&1 if [ "$?" = "0" ]; then echo_ok else echo_failed error "Stopping Service \"php-${PHP_MAIN_VERSION}-fpm\" failed!" fi echononl "\tDisable service php-${PHP_MAIN_VERSION}-fpm" systemctl disable php-${PHP_MAIN_VERSION}-fpm.service > /dev/null 2>&1 if [ "$?" = "0" ]; then echo_ok else echo_failed error "Disabling Service \"php-${PHP_MAIN_VERSION}-fpm\" failed!" fi fi # if systemctl is-enabled php-${PHP_MAIN_VERSION}-fpm.service echononl "\tRemove existing service file \"php-${PHP_MAIN_VERSION}-fpm.service\"" if [[ -f "$FPM_SYSTEMD_FILE" ]] ; then rm "$FPM_SYSTEMD_FILE" > /dev/null 2<&1 if [ "$?" = "0" ]; then echo_ok else echo_failed error "Removing file \"$FPM_SYSTEMD_FILE\" failed!" fi else echo_skipped fi echononl "\tAdding systemd service \"$FPM_SYSTEMD_FILE\".." cp ${_builddir}/sapi/fpm/php-fpm.service "$FPM_SYSTEMD_FILE" > /dev/null 2<&1 if [ "$?" = "0" ]; then echo_ok else echo_failed fatal "Adding systemd service \"$FPM_SYSTEMD_FILE\" failed!" fi _failed=false echononl "\tAdjust php-${PHP_MAIN_VERSION}-fpm.service (PrivateTmp=false)" sed -i -r -e "s#(Description.*)#\1 v${PHP_MAIN_VERSION}#" "$FPM_SYSTEMD_FILE" > /dev/null 2<&1 if [[ $? -ne 0 ]]; then _failed=true fi sed -i -r -e "s#PIDFile=.*#PIDFile=${FPM_PID_FILE}#" "$FPM_SYSTEMD_FILE" > /dev/null 2<&1 if [[ $? -ne 0 ]]; then _failed=true fi if grep -q "PrivateTmp" "$FPM_SYSTEMD_FILE" > /dev/null 2<&1 ; then sed -i -r -e "s#^([[:space:]]*PrivateTmp).*#\1=false#" "$FPM_SYSTEMD_FILE" if [[ $? -ne 0 ]]; then _failed=true fi fi if grep -q -E "\\\$\{prefix\}" "$FPM_SYSTEMD_FILE" > /dev/null 2<&1 ; then sed -i -r -e "s#\\\$\{prefix\}#${PREFIX_PHP}#g" "$FPM_SYSTEMD_FILE" > /dev/null 2<&1 if [[ $? -ne 0 ]]; then _failed=true fi fi if grep -q -E "\\\$\{exec_prefix\}" "$FPM_SYSTEMD_FILE" > /dev/null 2<&1 ; then sed -i -r -e "s#\\\$\{exec_prefix\}#${PREFIX_PHP}#g" "$FPM_SYSTEMD_FILE" > /dev/null 2<&1 if [[ $? -ne 0 ]]; then _failed=true fi fi if $_failed ; then echo_failed error "Some errors adjusting php-${PHP_MAIN_VERSION}-fpm.service occured!" else echo_ok fi echononl "\tReload systemd.." systemctl daemon-reload > /dev/null 2>&1 if [ "$?" = "0" ]; then echo_ok else echo_failed error "Reloading systemd.. failed!" fi echononl "\tEnable Service \"php-${PHP_MAIN_VERSION}-fpm.service\".." systemctl enable "php-${PHP_MAIN_VERSION}-fpm.service" > /dev/null 2>&1 if [ "$?" = "0" ]; then echo_ok else echo_failed fatal "Enabling systemd service \"${FPM_SYSTEMD_FILE}\" failed!" fi echononl "\tReload systemd manager configuration.." systemctl daemon-reload > /dev/null 2<&1 if [ "$?" = "0" ]; then echo_ok else echo_failed fatal "Reloading systemd manager configuration failed!" fi fi # if $ACTIVATE_PHP_FPM_INIT_SCRIPT else echononl "\tAdd init script ${PREFIX_PHP}/sbin/php-${PHP_VERSION_STRING}-fpm" cp ${_builddir}/sapi/fpm/init.d.php-fpm ${PREFIX_PHP}/sbin/php-${PHP_VERSION_STRING}-fpm > /dev/null 2<&1 if [ "$?" = "0" ]; then echo_ok else echo_failed fi echononl "\tMake init script executable" chmod 755 ${PREFIX_PHP}/sbin/php-${PHP_VERSION_STRING}-fpm if [ "$?" = "0" ]; then echo_ok else echo_failed fi echononl "\tSet \"umask 0002\" for FPM Processes .." if $SET_UMASK ; then sed -i "1 s/\(.*\)/\1\n\numask 0002\n/" ${PREFIX_PHP}/sbin/php-${PHP_VERSION_STRING}-fpm > /dev/null 2<&1 if [ "$?" = "0" ]; then echo_ok else echo_failed fi else echo_skipped fi if $ACTIVATE_PHP_FPM_INIT_SCRIPT ; then PID=`ps aux | grep "php-fpm: " | grep "master" | grep "${PHP_MAIN_VERSION}" | grep -v grep | awk '{print$2}'` if [[ -n "$PID" ]] ; then if [[ -x "$FPM_INIT_SCRIPT" ]]; then echononl "\tStopping PHP-FPM Service" $FPM_INIT_SCRIPT stop > /dev/null 2<&1 if [ "$?" = "0" ]; then echo_ok else echo_failed error "Stopping init script $FPM_INIT_SCRIPT failed!" fi fi sleep 5 declare -i i=0 PIDS=`ps aux | grep "php-fpm: " | grep -E "(master|pool)" | grep "${PHP_MAIN_VERSION}" | grep -v grep | awk '{print$2}'` while [ "X$PIDS" != "X" ]; do if [[ $i -eq 0 ]]; then echononl "\tGoing to kill PHP-FPM Processes.." fi if [ $i -gt 20 ]; then echo_failed break fi for _PID in $PIDS ; do kill -9 $_PID > /dev/null 2>&1 done sleep 2 PIDS=`ps aux | grep "php-fpm: " | grep -E "(master|pool)" | grep "${PHP_MAIN_VERSION}" | grep -v grep | awk '{print$2}'` i+=1 done rm -f $FPM_DEFAULT_POOL_LISTEN rm -f $FPM_PID_FILE fi if [[ $i -lt 20 ]]; then echo_ok fi echononl "\tRemove existsing init script /etc/init.d/php-${PHP_VERSION_STRING}-fpm" if [ -f "/etc/init.d/php-${PHP_VERSION_STRING}-fpm" ]; then rm /etc/init.d/php-${PHP_VERSION_STRING}-fpm > /dev/null 2<&1 if [ "$?" = "0" ]; then echo_ok else echo_failed error "Removing existing init script /etc/init.d/php-${PHP_VERSION_STRING}-fpm failed!" fi else echo_skipped fi if [[ -f "$FPM_INIT_SCRIPT" ]] || [[ -h $FPM_INIT_SCRIPT ]] ; then echononl "\tRemove \"$FPM_INIT_SCRIPT\"" rm -f $FPM_INIT_SCRIPT if [ "$?" = "0" ]; then echo_ok else echo_failed error "Removing $FPM_INIT_SCRIPT failed!" fi fi echononl "\tSet Symlink $FPM_INIT_SCRIPT --> ${PREFIX_PHP}/sbin/php-${PHP_VERSION_STRING}-fpm" ln -s ${PREFIX_PHP}/sbin/php-${PHP_VERSION_STRING}-fpm $FPM_INIT_SCRIPT > /dev/null 2<&1 if [ "$?" = "0" ]; then echo_ok else echo_failed fi fi echononl "\tMake php-${PHP_MAIN_VERSION}-fpm start at boottime" if ! grep -e "$FPM_INIT_SCRIPT" /etc/rc.local > /dev/null 2>&1 ; then sed -i -r -e "s#^([[:space:]]*exit\ +.*)#sleep 2\n$FPM_INIT_SCRIPT restart > /dev/null || /bin/true\n\n\1#" /etc/rc.local if [ "$?" = "0" ]; then echo_ok else echo_failed fi else echo_skipped fi _failed=false echononl "\tAdjust ${PREFIX_PHP}/sbin/php-${PHP_VERSION_STRING}-fpm" sed -i -r -e "s&^(([ ^t]*php_fpm_PID=).*)$&## \1\n\2${FPM_PID_FILE}&g" ${PREFIX_PHP}/sbin/php-${PHP_VERSION_STRING}-fpm || _failed=true sed -i -r -e "s&^(#\ .+)php-fpm&\1php-${PHP_MAIN_VERSION}-fpm&" ${PREFIX_PHP}/sbin/php-${PHP_VERSION_STRING}-fpm || _failed=true if ! $_failed ; then echo_ok else echo_failed fi fi # if $SYSTEMD_EXISTS echononl "\tCreate php-fpm global configuration file" cat < ${PREFIX_PHP}/etc/php-fpm.conf ;;;;;;;;;;;;;;;;;;;;; ; FPM Configuration ; ;;;;;;;;;;;;;;;;;;;;; ; All relative paths in this configuration file are relative to PHP's install ; prefix (/usr/local/php-5.4.35). This prefix can be dynamically changed by using the ; '-p' argument from the command line. ; Include one or more files. If glob(3) exists, it is used to include a bunch of ; files from a glob(3) pattern. This directive can be used everywhere in the ; file. ; Relative path can also be used. They will be prefixed by: ; - the global prefix if it's been set (-p argument) ; - /usr/local/php-5.4.35 otherwise ;include=etc/fpm.d/*.conf ;;;;;;;;;;;;;;;;;; ; Global Options ; ;;;;;;;;;;;;;;;;;; [global] ; Pid file ; Note: the default prefix is /usr/local/php-5.4.35/var ; Default Value: none pid = $FPM_PID_FILE ; Set open file descriptor rlimit for the master process. ; Default Value: system defined value ;rlimit_files = 1024 rlimit_files = $FPM_ULIMIT_MAX_FILES ; Error log file ; If it's set to "syslog", log is sent to syslogd instead of being written ; in a local file. ; Note: the default prefix is /usr/local/php-5.4.35/var ; Default Value: log/php-fpm.log error_log = $FPM_ERROR_LOG include=etc/${FPM_POOL_CONF_DIR}/*.conf EOF if [ "$?" = "0" ]; then echo_ok else echo_failed fi echononl "\tCreate Configuration Directory \"${FPM_POOL_CONF_DIR}\"" mkdir -p ${PREFIX_PHP}/etc/$FPM_POOL_CONF_DIR if [ "$?" = "0" ]; then echo_ok else echo_failed fi echononl "\tCreate php-fpm configuration file for pool \"${FPM_DEFAULT_POOL}\"" if $FPM_DEFAULT_POOL_DEFINITION_EXISTS ; then echo_skipped else cat < ${PREFIX_PHP}/etc/${FPM_POOL_CONF_DIR}/${FPM_DEFAULT_POOL}.php-fpm.conf ;;;;;;;;;;;;;;;;;;;; ; Pool Definitions ; ;;;;;;;;;;;;;;;;;;;; ; Multiple pools of child processes may be started with different listening ; ports and different management options. The name of the pool will be ; used in logs and stats. There is no limitation on the number of pools which ; FPM can handle. Your system will tell you anyway :) ; Start a new pool named '$FPM_DEFAULT_POOL'. ; the variable \$pool can we used in any directive and will be replaced by the ; pool name ('$FPM_DEFAULT_POOL' here) [$FPM_DEFAULT_POOL] ; Per pool prefix ; It only applies on the following directives: ; - 'access.log' ; - 'slowlog' ; - 'listen' (unixsocket) ; - 'chroot' ; - 'chdir' ; - 'php_values' ; - 'php_admin_values' ; When not set, the global prefix (or /usr/local/php-7.4.6) applies instead. ; Note: This directive can also be relative to the global prefix. ; Default Value: none ;prefix = /path/to/pools/\$pool ; Unix user/group of processes ; Note: The user is mandatory. If the group is not set, the default user's group ; will be used. user = $FPM_DEFAULT_POOL_USER group = $FPM_DEFAULT_POOL_GROUP ; The address on which to accept FastCGI requests. ; Valid syntaxes are: ; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on ; a specific port; ; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on ; a specific port; ; 'port' - to listen on a TCP socket to all addresses ; (IPv6 and IPv4-mapped) on a specific port; ; '/path/to/unix/socket' - to listen on a unix socket. ; Note: This value is mandatory. ;listen = 127.0.0.1:9000 listen = $FPM_DEFAULT_POOL_LISTEN ; Set listen(2) backlog. ; Default Value: 511 (-1 on FreeBSD and OpenBSD) ;listen.backlog = 511 ; Set permissions for unix socket, if one is used. In Linux, read/write ; permissions must be set in order to allow connections from a web server. Many ; BSD-derived systems allow connections regardless of permissions. The owner ; and group can be specified either by name or by their numeric IDs. ; Default Values: user and group are set as the running user ; listen.owner = $FPM_DEFAULT_POOL_LISTEN_OWNER listen.group = $FPM_DEFAULT_POOL_LISTEN_GROUP listen.mode = $FPM_DEFAULT_POOL_LISTEN_MODE ; When POSIX Access Control Lists are supported you can set them using ; these options, value is a comma separated list of user/group names. ; When set, listen.owner and listen.group are ignored ;listen.acl_users = ;listen.acl_groups = ; List of addresses (IPv4/IPv6) of FastCGI clients which are allowed to connect. ; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original ; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address ; must be separated by a comma. If this value is left blank, connections will be ; accepted from any ip address. ; Default Value: any ;listen.allowed_clients = 127.0.0.1 ; Specify the nice(2) priority to apply to the pool processes (only if set) ; The value can vary from -19 (highest priority) to 20 (lower priority) ; Note: - It will only work if the FPM master process is launched as root ; - The pool processes will inherit the master process priority ; unless it specified otherwise ; Default Value: no set ; process.priority = -19 ; Set the process dumpable flag (PR_SET_DUMPABLE prctl) even if the process user ; or group is differrent than the master process user. It allows to create process ; core dump and ptrace the process for the pool user. ; Default Value: no ; process.dumpable = yes ; Choose how the process manager will control the number of child processes. ; Possible Values: ; static - a fixed number (pm.max_children) of child processes; ; dynamic - the number of child processes are set dynamically based on the ; following directives. With this process management, there will be ; always at least 1 children. ; pm.max_children - the maximum number of children that can ; be alive at the same time. ; pm.start_servers - the number of children created on startup. ; pm.min_spare_servers - the minimum number of children in 'idle' ; state (waiting to process). If the number ; of 'idle' processes is less than this ; number then some children will be created. ; pm.max_spare_servers - the maximum number of children in 'idle' ; state (waiting to process). If the number ; of 'idle' processes is greater than this ; number then some children will be killed. ; ondemand - no children are created at startup. Children will be forked when ; new requests will connect. The following parameter are used: ; pm.max_children - the maximum number of children that ; can be alive at the same time. ; pm.process_idle_timeout - The number of seconds after which ; an idle process will be killed. ; Note: This value is mandatory. pm = $FPM_DEFAULT_POOL_PM ; The number of child processes to be created when pm is set to 'static' and the ; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. ; This value sets the limit on the number of simultaneous requests that will be ; served. Equivalent to the ApacheMaxClients directive with mpm_prefork. ; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP ; CGI. The below defaults are based on a server without much resources. Don't ; forget to tweak pm.* to fit your needs. ; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' ; Note: This value is mandatory. pm.max_children = $FPM_POOL_MAX_CHILDREN ; The number of child processes created on startup. ; Note: Used only when pm is set to 'dynamic' ; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2 pm.start_servers = $FPM_POOL_START_SERVER ; The desired minimum number of idle server processes. ; Note: Used only when pm is set to 'dynamic' ; Note: Mandatory when pm is set to 'dynamic' pm.min_spare_servers = $FPM_POOL_MIN_SPARE ; The desired maximum number of idle server processes. ; Note: Used only when pm is set to 'dynamic' ; Note: Mandatory when pm is set to 'dynamic' pm.max_spare_servers = $FPM_POOL_MAX_SPARE ; The number of seconds after which an idle process will be killed. ; Note: Used only when pm is set to 'ondemand' ; Default Value: 10s ;pm.process_idle_timeout = 10s; ; The number of requests each child process should execute before respawning. ; This can be useful to work around memory leaks in 3rd party libraries. For ; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS. ; Default Value: 0 pm.max_requests = $FPM_POOL_MAX_REQUESTS ; The URI to view the FPM status page. If this value is not set, no URI will be ; recognized as a status page. It shows the following informations: ; pool - the name of the pool; ; process manager - static, dynamic or ondemand; ; start time - the date and time FPM has started; ; start since - number of seconds since FPM has started; ; accepted conn - the number of request accepted by the pool; ; listen queue - the number of request in the queue of pending ; connections (see backlog in listen(2)); ; max listen queue - the maximum number of requests in the queue ; of pending connections since FPM has started; ; listen queue len - the size of the socket queue of pending connections; ; idle processes - the number of idle processes; ; active processes - the number of active processes; ; total processes - the number of idle + active processes; ; max active processes - the maximum number of active processes since FPM ; has started; ; max children reached - number of times, the process limit has been reached, ; when pm tries to start more children (works only for ; pm 'dynamic' and 'ondemand'); ; Value are updated in real time. ; Example output: ; pool: www ; process manager: static ; start time: 01/Jul/2011:17:53:49 +0200 ; start since: 62636 ; accepted conn: 190460 ; listen queue: 0 ; max listen queue: 1 ; listen queue len: 42 ; idle processes: 4 ; active processes: 11 ; total processes: 15 ; max active processes: 12 ; max children reached: 0 ; ; By default the status page output is formatted as text/plain. Passing either ; 'html', 'xml' or 'json' in the query string will return the corresponding ; output syntax. Example: ; http://www.foo.bar/status ; http://www.foo.bar/status?json ; http://www.foo.bar/status?html ; http://www.foo.bar/status?xml ; ; By default the status page only outputs short status. Passing 'full' in the ; query string will also return status for each pool process. ; Example: ; http://www.foo.bar/status?full ; http://www.foo.bar/status?json&full ; http://www.foo.bar/status?html&full ; http://www.foo.bar/status?xml&full ; The Full status returns for each process: ; pid - the PID of the process; ; state - the state of the process (Idle, Running, ...); ; start time - the date and time the process has started; ; start since - the number of seconds since the process has started; ; requests - the number of requests the process has served; ; request duration - the duration in µs of the requests; ; request method - the request method (GET, POST, ...); ; request URI - the request URI with the query string; ; content length - the content length of the request (only with POST); ; user - the user (PHP_AUTH_USER) (or '-' if not set); ; script - the main script called (or '-' if not set); ; last request cpu - the %cpu the last request consumed ; it's always 0 if the process is not in Idle state ; because CPU calculation is done when the request ; processing has terminated; ; last request memory - the max amount of memory the last request consumed ; it's always 0 if the process is not in Idle state ; because memory calculation is done when the request ; processing has terminated; ; If the process is in Idle state, then informations are related to the ; last request the process has served. Otherwise informations are related to ; the current request being served. ; Example output: ; ************************ ; pid: 31330 ; state: Running ; start time: 01/Jul/2011:17:53:49 +0200 ; start since: 63087 ; requests: 12808 ; request duration: 1250261 ; request method: GET ; request URI: /test_mem.php?N=10000 ; content length: 0 ; user: - ; script: /home/fat/web/docs/php/test_mem.php ; last request cpu: 0.00 ; last request memory: 0 ; ; Note: There is a real-time FPM status monitoring sample web page available ; It's available in: /usr/local/php-7.4.6/share/php/fpm/status.html ; ; Note: The value must start with a leading slash (/). The value can be ; anything, but it may not be a good idea to use the .php extension or it ; may conflict with a real PHP file. ; Default Value: not set ;pm.status_path = /status pm.status_path = $FPM_DEFAULT_POOL_STATUS_PATH ; The ping URI to call the monitoring page of FPM. If this value is not set, no ; URI will be recognized as a ping page. This could be used to test from outside ; that FPM is alive and responding, or to ; - create a graph of FPM availability (rrd or such); ; - remove a server from a group if it is not responding (load balancing); ; - trigger alerts for the operating team (24/7). ; Note: The value must start with a leading slash (/). The value can be ; anything, but it may not be a good idea to use the .php extension or it ; may conflict with a real PHP file. ; Default Value: not set ;ping.path = /ping ping.path = $FPM_DEFAULT_POOL_PING_PATH ; This directive may be used to customize the response of a ping request. The ; response is formatted as text/plain with a 200 response code. ; Default Value: pong ping.response = $FPM_DEFAULT_POOL_PING_RESPONSE ; The access log file ; Default: not set ;access.log = log/\$pool.access.log access.log = $FPM_DEFAULT_POOL_ACCESS_LOG ; The access log format. ; The following syntax is allowed ; %%: the '%' character ; %C: %CPU used by the request ; it can accept the following format: ; - %{user}C for user CPU only ; - %{system}C for system CPU only ; - %{total}C for user + system CPU (default) ; %d: time taken to serve the request ; it can accept the following format: ; - %{seconds}d (default) ; - %{miliseconds}d ; - %{mili}d ; - %{microseconds}d ; - %{micro}d ; %e: an environment variable (same as \$_ENV or \$_SERVER) ; it must be associated with embraces to specify the name of the env ; variable. Some exemples: ; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e ; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e ; %f: script filename ; %l: content-length of the request (for POST request only) ; %m: request method ; %M: peak of memory allocated by PHP ; it can accept the following format: ; - %{bytes}M (default) ; - %{kilobytes}M ; - %{kilo}M ; - %{megabytes}M ; - %{mega}M ; %n: pool name ; %o: output header ; it must be associated with embraces to specify the name of the header: ; - %{Content-Type}o ; - %{X-Powered-By}o ; - %{Transfert-Encoding}o ; - .... ; %p: PID of the child that serviced the request ; %P: PID of the parent of the child that serviced the request ; %q: the query string ; %Q: the '?' character if query string exists ; %r: the request URI (without the query string, see %q and %Q) ; %R: remote IP address ; %s: status (response code) ; %t: server time the request was received ; it can accept a strftime(3) format: ; %d/%b/%Y:%H:%M:%S %z (default) ; The strftime(3) format must be encapsuled in a %{}t tag ; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t ; %T: time the log has been written (the request has finished) ; it can accept a strftime(3) format: ; %d/%b/%Y:%H:%M:%S %z (default) ; The strftime(3) format must be encapsuled in a %{}t tag ; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t ; %u: remote user ; ; Default: "%R - %u %t \"%m %r\" %s" ;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%" access.format = $FPM_DEFAULT_POOL_ACCESS_FORMAT ; The log file for slow requests ; Default Value: not set ; Note: slowlog is mandatory if request_slowlog_timeout is set slowlog = $FPM_DEFAULT_POOL_SLOW_LOG ; The timeout for serving a single request after which a PHP backtrace will be ; dumped to the 'slowlog' file. A value of '0s' means 'off'. ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) ; Default Value: 0 ;request_slowlog_timeout = 0 request_slowlog_timeout = 10s ; Depth of slow log stack trace. ; Default Value: 20 ;request_slowlog_trace_depth = 20 ; The timeout for serving a single request after which the worker process will ; be killed. This option should be used when the 'max_execution_time' ini option ; does not stop script execution for some reason. A value of '0' means 'off'. ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) ; Default Value: 0 request_terminate_timeout = $FPM_DEFAULT_POOL_TERMINATE_TIMEOUT ; The timeout set by 'request_terminate_timeout' ini option is not engaged after ; application calls 'fastcgi_finish_request' or when application has finished and ; shutdown functions are being called (registered via register_shutdown_function). ; This option will enable timeout limit to be applied unconditionally ; even in such cases. ; Default Value: no ;request_terminate_timeout_track_finished = no ; Set open file descriptor rlimit. ; Default Value: system defined value ;rlimit_files = 1024 ; Set max core size rlimit. ; Possible Values: 'unlimited' or an integer greater or equal to 0 ; Default Value: system defined value ;rlimit_core = 0 ; Chroot to this directory at the start. This value must be defined as an ; absolute path. When this value is not set, chroot is not used. ; Note: you can prefix with '\$prefix' to chroot to the pool prefix or one ; of its subdirectories. If the pool prefix is not set, the global prefix ; will be used instead. ; Note: chrooting is a great security feature and should be used whenever ; possible. However, all PHP paths will be relative to the chroot ; (error_log, sessions.save_path, ...). ; Default Value: not set ;chroot = ; Chdir to this directory at the start. ; Note: relative path can be used. ; Default Value: current directory or / when chroot ;chdir = /var/www ; Redirect worker stdout and stderr into main error log. If not set, stdout and ; stderr will be redirected to /dev/null according to FastCGI specs. ; Note: on highloaded environement, this can cause some delay in the page ; process time (several ms). ; Default Value: no ;catch_workers_output = yes ; Decorate worker output with prefix and suffix containing information about ; the child that writes to the log and if stdout or stderr is used as well as ; log level and time. This options is used only if catch_workers_output is yes. ; Settings to "no" will output data as written to the stdout or stderr. ; Default value: yes ;decorate_workers_output = no ; Clear environment in FPM workers ; Prevents arbitrary environment variables from reaching FPM worker processes ; by clearing the environment in workers before env vars specified in this ; pool configuration are added. ; Setting to "no" will make all environment variables available to PHP code ; via getenv(), \$_ENV and \$_SERVER. ; Default Value: yes ;clear_env = no ; Limits the extensions of the main script FPM will allow to parse. This can ; prevent configuration mistakes on the web server side. You should only limit ; FPM to .php extensions to prevent malicious users to use other extensions to ; execute php code. ; Note: set an empty value to allow all extensions. ; Default Value: .php ;security.limit_extensions = .php .php3 .php4 .php5 .php7 ; Pass environment variables like LD_LIBRARY_PATH. All \$VARIABLEs are taken from ; the current environment. ; Default Value: clean env env[HOSTNAME] = $(hostname -f) env[PATH] = /usr/local/bin:/usr/bin:/bin env[TMP] = /tmp env[TMPDIR] = /tmp env[TEMP] = /tmp ; Additional php.ini defines, specific to this pool of workers. These settings ; overwrite the values previously defined in the php.ini. The directives are the ; same as the PHP SAPI: ; php_value/php_flag - you can set classic ini defines which can ; be overwritten from PHP call 'ini_set'. ; php_admin_value/php_admin_flag - these directives won't be overwritten by ; PHP call 'ini_set' ; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no. ; Defining 'extension' will load the corresponding shared extension from ; extension_dir. Defining 'disable_functions' or 'disable_classes' will not ; overwrite previously defined php.ini values, but will append the new value ; instead. ; Note: path INI options can be relative and will be expanded with the prefix ; (pool, global or /usr/local/php-7.4.6) ; Default Value: nothing is defined by default except the values in php.ini and ; specified at startup with the -d argument ;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com ;php_flag[display_errors] = off ;php_admin_value[error_log] = /var/log/fpm-php.www.log ;php_admin_flag[log_errors] = on ;php_admin_value[memory_limit] = 32M EOF if [ "$?" = "0" ]; then echo_ok else echo_failed fi fi # - Copy PHP FPM definitions from current installation to the new one. # - if [[ ${#existing_fpm_definition_arr[@]} -gt 0 ]] ; then echo "" for _file in "${existing_fpm_definition_arr[@]}" ; do echononl "\tTake existing PHP FPM definition '$(basename "$_file")' .." cp "$_file" "${PREFIX_PHP}/etc/${FPM_POOL_CONF_DIR}/" > /dev/null 2>&1 if [ "$?" = "0" ]; then echo_ok else echo_failed fi done if $FPM_DEFAULT_POOL_DEFINITION_EXISTS && \ [[ -f "${PREFIX_PHP}/etc/${FPM_POOL_CONF_DIR}/${FPM_DEFAULT_POOL}.php-fpm.conf" ]] ; then echo "" key="pm.start_servers" value="$FPM_POOL_START_SERVER" echononl "\tPHP FPM Pool - Set Definition '${key}'.." #perl -i -n -p -e "s#^(\s*${key}\s*=\s*)#\1${value}#" \ # ${PREFIX_PHP}/etc/${FPM_POOL_CONF_DIR}/${FPM_DEFAULT_POOL}.php-fpm.conf sed -i -E "s/^([[:blank:]]*${key}[[:blank:]]*=[[:blank:]]*).*/\1${value}/" \ ${PREFIX_PHP}/etc/${FPM_POOL_CONF_DIR}/${FPM_DEFAULT_POOL}.php-fpm.conf if [ "$?" = "0" ]; then echo_ok else echo_failed fi key="pm.min_spare_servers" value="$FPM_POOL_MIN_SPARE" echononl "\tPHP FPM Pool - Set Definition '${key}'.." sed -i -E "s/^([[:blank:]]*${key}[[:blank:]]*=[[:blank:]]*).*/\1${value}/" \ ${PREFIX_PHP}/etc/${FPM_POOL_CONF_DIR}/${FPM_DEFAULT_POOL}.php-fpm.conf if [ "$?" = "0" ]; then echo_ok else echo_failed fi key="pm.max_spare_servers" value="$FPM_POOL_MAX_SPARE" echononl "\tPHP FPM Pool - Set Definition '${key}'.." sed -i -E "s/^([[:blank:]]*${key}[[:blank:]]*=[[:blank:]]*).*/\1${value}/" \ ${PREFIX_PHP}/etc/${FPM_POOL_CONF_DIR}/${FPM_DEFAULT_POOL}.php-fpm.conf if [ "$?" = "0" ]; then echo_ok else echo_failed fi key="pm.max_children" value="$FPM_POOL_MAX_CHILDREN" echononl "\tPHP FPM Pool - Set Definition '${key}'.." sed -i -E "s/^([[:blank:]]*${key}[[:blank:]]*=[[:blank:]]*).*/\1${value}/" \ ${PREFIX_PHP}/etc/${FPM_POOL_CONF_DIR}/${FPM_DEFAULT_POOL}.php-fpm.conf if [ "$?" = "0" ]; then echo_ok else echo_failed fi key="pm.max_requests" value="$FPM_POOL_MAX_REQUESTS" echononl "\tPHP FPM Pool - Set Definition '${key}'.." sed -i -E "s/^([[:blank:]]*${key}[[:blank:]]*=[[:blank:]]*).*/\1${value}/" \ ${PREFIX_PHP}/etc/${FPM_POOL_CONF_DIR}/${FPM_DEFAULT_POOL}.php-fpm.conf if [ "$?" = "0" ]; then echo_ok else echo_failed fi echo "" fi fi if [ "$HTTPD_USER" != $FPM_DEFAULT_POOL_LISTEN_OWNER ]; then echononl "\tAdd apache user to group \"$FPM_DEFAULT_POOL_LISTEN_GROUP\"" usermod -a -G $FPM_DEFAULT_POOL_LISTEN_GROUP $HTTPD_USER if [ "$?" = "0" ]; then echo_ok else echo_failed fi fi echononl "\tCreate log directory for PHP-FPM \"${FPM_LOG_DIR}\"" mkdir -p $FPM_LOG_DIR if [ "$?" = "0" ]; then echo_ok else echo_failed fi echononl "\tConfigure logrotation for \"${FPM_LOG_DIR}\"" if [ ! -f "/etc/logrotate.d/php-${PHP_MAIN_VERSION}-fpm" ]; then cat < /etc/logrotate.d/php-${PHP_MAIN_VERSION}-fpm $FPM_LOG_DIR/*log { daily rotate 7 start 0 compress delaycompress missingok notifempty sharedscripts postrotate if [[ -f "${FPM_LOG_DIR}/php_errors.log" ]] ; then chown ${HTTPD_USER}:$HTTPD_GROUP ${FPM_LOG_DIR}/php_errors.log fi [ ! -f $FPM_PID_FILE ]] || kill -USR1 \$(cat ${FPM_PID_FILE}) endscript } EOF if [ "$?" = "0" ]; then echo_ok else echo_failed fi else echo_skipped fi echononl "\tCreate empty logfile '${FPM_LOG_DIR}/php_errors.log'" touch "${FPM_LOG_DIR}/php_errors.log" > $tmp_err_msg 2>&1 if [ "$?" = "0" ]; then echo_ok else echo_failed error "$(cat $tmp_err_msg)" fi echononl "\tSet owner permission to '${FPM_LOG_DIR}/php_errors.log'" chown ${HTTPD_USER}:$HTTPD_GROUP "${FPM_LOG_DIR}/php_errors.log" > $tmp_err_msg 2>&1 if [ "$?" = "0" ]; then echo_ok else echo_failed error "$(cat $tmp_err_msg)" fi fi echo "" echononl "\tUpdate file name database (updatedb).." if $SKIP_UPDATE_DB ; then echo_skipped else updatedb > /dev/null 2>&1 if [ "$?" = "0" ]; then echo_ok else echo_failed fi fi ## - PHP Extensions ## - echo "" echo "" echo -e "\t---" echo -e "\t--- Install PHP extensions via pecl" echo -e "\t---" echo "" > ${_logdir}/pecl_install.log ## ----- ## - Update Channel 'pecl.php.net' ## ----- echo "## -----" >> ${_logdir}/pecl_install.log echo "## - Update Channel 'pecl.php.net'" >> ${_logdir}/pecl_install.log echo "## -----" >> ${_logdir}/pecl_install.log echononl "\tUpdate Channel 'pecl.php.net' .." echo "" >> ${_logdir}/pecl_install.log echo "${PREFIX_PHP}/bin/pecl channel-update pecl.php.net" >> ${_logdir}/pecl_install.log ${PREFIX_PHP}/bin/pecl channel-update pecl.php.net > ${_logdir}/pecl_install.log 2>&1 if [[ $? -eq 0 ]] ; then echo_ok else echo_failed error "See log file: ${_logdir}/pecl_install.log" fi ## ----- ## - END: Update Channel 'pecl.php.net' ## ----- ## ----- ## - Install geoip ## ----- echo "" >> ${_logdir}/pecl_install.log echo "" >> ${_logdir}/pecl_install.log echo "## -----" >> ${_logdir}/pecl_install.log echo "## - Install geoip" >> ${_logdir}/pecl_install.log echo "## -----" >> ${_logdir}/pecl_install.log echo "" >> ${_logdir}/pecl_install.log echononl "\tInstall geoip v.1.1.1 via pecl.." echo "" >> ${_logdir}/pecl_install.log echo "${PREFIX_PHP}/bin/pecl install geoip-1.1.1" >> ${_logdir}/pecl_install.log ${PREFIX_PHP}/bin/pecl install geoip-1.1.1 >> "${_logdir}/pecl_install.log" 2>&1 if [ "$?" = "0" ]; then echo_ok echononl "\tphp.ini: extension=geoip.so .." _extension="geoip.so" echo "" >> ${_logdir}/pecl_install.log echo "# php.ini: extension=geoip.so .." >> ${_logdir}/pecl_install.log echo "perl -i -n -p -e \"s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#\" $PHP_INI_FILE" >> ${_logdir}/pecl_install.log perl -i -n -p -e "s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#" $PHP_INI_FILE if [ "$?" = "0" ]; then echo_ok else echo_failed error "See log file: ${_logdir}/pecl_install.log" fi else echo_failed fi ## ----- ## - END: Install geoip ## ----- ## ----- ## - Install uploadprogress ## ----- echo "" >> ${_logdir}/pecl_install.log echo "" >> ${_logdir}/pecl_install.log echo "## -----" >> ${_logdir}/pecl_install.log echo "## - Install uploadprogress" >> ${_logdir}/pecl_install.log echo "## -----" >> ${_logdir}/pecl_install.log echo "" >> ${_logdir}/pecl_install.log echononl "\tInstall uploadprogress via pecl.." echo "" >> ${_logdir}/pecl_install.log echo "printf \"\\n\" | ${PREFIX_PHP}/bin/pecl install uploadprogress" >> ${_logdir}/pecl_install.log if [[ $PHP_MAJOR_VERSION -lt 7 ]] ; then printf "\n" | ${PREFIX_PHP}/bin/pecl install uploadprogress >> "${_logdir}/pecl_install.log" 2>&1 if [ "$?" = "0" ]; then echo_ok echononl "\tphp.ini: extension=uploadprogress .." zend_extension_uploadprogress=`find ${PREFIX_PHP}/lib/php/extensions -name uploadprogress.so -print` if [[ -n "$zend_extension_uploadprogress" ]]; then _extension="uploadprogress.so" echo "" >> ${_logdir}/pecl_install.log echo "# php.ini: extension=uploadprogress" >> ${_logdir}/pecl_install.log echo "perl -i -n -p -e \"s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#\" $PHP_INI_FILE" >> ${_logdir}/pecl_install.log perl -i -n -p -e "s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#" $PHP_INI_FILE if [ "$?" = "0" ]; then echo_ok else echo_failed error "See log file: ${_logdir}/pecl_install.log" fi else echo_skipped warn "Maybe extension \"uploadprogress.so\" is not supported!" fi else echo_failed fi else echo_skipped warn "Pecl extension 'uploadprogress' is only available for PHP versions < 7 - version 7 also excluded." echo "# Pecl extension 'uploadprogress' is only available for PHP versions < 7" >> ${_logdir}/pecl_install.log fi ## ----- ## - END: Install uploadprogress ## ----- ## ----- ## - Install solr ## ----- echo "" >> ${_logdir}/pecl_install.log echo "" >> ${_logdir}/pecl_install.log echo "## -----" >> ${_logdir}/pecl_install.log echo "## - Install solr" >> ${_logdir}/pecl_install.log echo "## -----" >> ${_logdir}/pecl_install.log echo "" >> ${_logdir}/pecl_install.log echononl "\tInstall solr via pecl.." if [[ $PHP_MAJOR_VERSION -lt 7 ]] ; then echo "" >> ${_logdir}/pecl_install.log echo "printf \"\\n\" | ${PREFIX_PHP}/bin/pecl install solr-2.4.0" >> ${_logdir}/pecl_install.log printf "\n" | ${PREFIX_PHP}/bin/pecl install solr-2.4.0 >> "${_logdir}/pecl_install.log" 2>&1 if [ "$?" = "0" ]; then echo_ok echononl "\tphp.ini: extension=solr .." _extension="solr.so" echo "" >> ${_logdir}/pecl_install.log echo "# php.ini: extension=solr .." >> ${_logdir}/pecl_install.log echo "perl -i -n -p -e \"s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#\" $PHP_INI_FILE" >> ${_logdir}/pecl_install.log perl -i -n -p -e "s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#" $PHP_INI_FILE if [ "$?" = "0" ]; then echo_ok else echo_failed error "See log file: ${_logdir}/pecl_install.log" fi else echo_failed fi else echo "" >> ${_logdir}/pecl_install.log echo "printf \"\\n\" | ${PREFIX_PHP}/bin/pecl install solr" >> ${_logdir}/pecl_install.log printf "\n" | ${PREFIX_PHP}/bin/pecl install solr >> "${_logdir}/pecl_install.log" 2>&1 if [ "$?" = "0" ]; then echo_ok echononl "\tphp.ini: extension=solr .." _extension="solr.so" echo "" >> ${_logdir}/pecl_install.log echo "# php.ini: extension=solr .." >> ${_logdir}/pecl_install.log echo "perl -i -n -p -e \"s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#\" $PHP_INI_FILE" >> ${_logdir}/pecl_install.log perl -i -n -p -e "s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#" $PHP_INI_FILE if [ "$?" = "0" ]; then echo_ok else echo_failed fi else echo_failed fi fi ## ----- ## - END: Install solr ## ----- ## ----- ## - Install redis ## ----- echo "" >> ${_logdir}/pecl_install.log echo "" >> ${_logdir}/pecl_install.log echo "## -----" >> ${_logdir}/pecl_install.log echo "## - Install redis" >> ${_logdir}/pecl_install.log echo "## -----" >> ${_logdir}/pecl_install.log echo "" >> ${_logdir}/pecl_install.log echononl "\tInstall redis via pecl.." if [[ $PHP_MAJOR_VERSION -lt 7 ]] ; then echo "" >> ${_logdir}/pecl_install.log echo "printf \"\\n\" | ${PREFIX_PHP}/bin/pecl install redis-4.2.0" >> ${_logdir}/pecl_install.log printf "\n" | ${PREFIX_PHP}/bin/pecl install redis-4.2.0 >> "${_logdir}/pecl_install.log" 2>&1 if [ "$?" = "0" ]; then echo_ok echononl "\tphp.ini: extension=redis .." _extension="redis.so" echo "" >> ${_logdir}/pecl_install.log echo "# php.ini: extension=redis .." >> ${_logdir}/pecl_install.log echo "perl -i -n -p -e \"s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#\" $PHP_INI_FILE" >> ${_logdir}/pecl_install.log perl -i -n -p -e "s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#" $PHP_INI_FILE if [ "$?" = "0" ]; then echo_ok else echo_failed fi else echo_failed error "See log file: ${_logdir}/pecl_install.log" fi else echo "" >> ${_logdir}/pecl_install.log echo "printf \"\\n\" | ${PREFIX_PHP}/bin/pecl install" >> ${_logdir}/pecl_install.log printf "\n" | ${PREFIX_PHP}/bin/pecl install redis >> "${_logdir}/pecl_install.log" 2>&1 if [ "$?" = "0" ]; then echo_ok echononl "\tphp.ini: extension=redis .." _extension="redis.so" echo "" >> ${_logdir}/pecl_install.log echo "# php.ini: extension=redis .." >> ${_logdir}/pecl_install.log echo "perl -i -n -p -e \"s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#\" $PHP_INI_FILE" >> ${_logdir}/pecl_install.log perl -i -n -p -e "s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#" $PHP_INI_FILE if [ "$?" = "0" ]; then echo_ok else echo_failed fi else echo_failed error "See log file: ${_logdir}/pecl_install.log" fi fi ## ----- ## - END: Install redis ## ----- echo "" >> ${_logdir}/pecl_install.log echo "" >> ${_logdir}/pecl_install.log echo "## -----" >> ${_logdir}/pecl_install.log echo "## - Install uri_template via pecl.." >> ${_logdir}/pecl_install.log echo "## -----" >> ${_logdir}/pecl_install.log echo "" >> ${_logdir}/pecl_install.log ## ----- ## - Install uri_template - !! only versions <= 5.6 ## ----- echononl "\tInstall uri_template via pecl.." if [[ $PHP_MAJOR_VERSION -lt 7 ]] ; then echo "" >> ${_logdir}/pecl_install.log echo "printf \"\\n\" | ${PREFIX_PHP}/bin/pecl install uri_template" >> ${_logdir}/pecl_install.log printf "\n" | ${PREFIX_PHP}/bin/pecl install uri_template >> "${_logdir}/pecl_install.log" 2>&1 if [ "$?" = "0" ]; then echo_ok echononl "\tphp.ini: extension=uri_template.so .." _extension="uri_template.so" echo "" >> ${_logdir}/pecl_install.log echo "# php.ini: extension=uri_template.so .." >> ${_logdir}/pecl_install.log echo "perl -i -n -p -e \"s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#\" $PHP_INI_FILE" >> ${_logdir}/pecl_install.log perl -i -n -p -e "s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#" $PHP_INI_FILE if [ "$?" = "0" ]; then echo_ok else echo_failed fi else echo_failed error "See log file: ${_logdir}/pecl_install.log" fi else echo_skipped warn "Pecl extension 'uri_template' is only available for PHP versions < 7 - version 7 also excluded." echo "# Pecl extension 'uri_template' is only available for PHP versions < 7 - version 7 also excluded." >> ${_logdir}/pecl_install.log fi ## ----- ## - END: Install uri_template ## ----- ## ----- ## - Install APCu ## ----- echo "" >> ${_logdir}/pecl_install.log echo "" >> ${_logdir}/pecl_install.log echo ""## ----- >> ${_logdir}/pecl_install.log echo "Install APCu via pecl.." >> ${_logdir}/pecl_install.log echo ""## ----- >> ${_logdir}/pecl_install.log echo "" >> ${_logdir}/pecl_install.log echononl "\tInstall APCu via pecl.." if [[ $PHP_MAJOR_VERSION -lt 7 ]] ; then echo "" >> ${_logdir}/pecl_install.log echo "printf \"\\n\" | ${PREFIX_PHP}/bin/pecl install apcu-4.0.11" >> ${_logdir}/pecl_install.log printf "\n" | ${PREFIX_PHP}/bin/pecl install apcu-4.0.11 >> "${_logdir}/pecl_install.log" 2>&1 if [ "$?" = "0" ]; then echo_ok echononl "\tphp.ini: extension=apcu .." _extension="apcu.so" echo "" >> ${_logdir}/pecl_install.log echo "# php.ini: extension=apcu .." >> ${_logdir}/pecl_install.log echo "perl -i -n -p -e \"s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\napc.enable_cli = 1\n#\" $PHP_INI_FILE" >> ${_logdir}/pecl_install.log perl -i -n -p -e "s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\napc.enable_cli = 1\n#" $PHP_INI_FILE if [ "$?" = "0" ]; then echo_ok else echo_failed fi else echo_failed error "See log file: ${_logdir}/pecl_install.log" fi else echo "" >> ${_logdir}/pecl_install.log echo "printf \"\\n\" | ${PREFIX_PHP}/bin/pecl install apcu" >> ${_logdir}/pecl_install.log printf "\n" | ${PREFIX_PHP}/bin/pecl install apcu >> "${_logdir}/pecl_install.log" 2>&1 if [ "$?" = "0" ]; then echo_ok echononl "\tphp.ini: extension=apcu .." _extension="apcu.so" echo "" >> ${_logdir}/pecl_install.log echo "# php.ini: extension=apcu .." >> ${_logdir}/pecl_install.log echo "perl -i -n -p -e \"s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\napc.enable_cli = 1\n#\" $PHP_INI_FILE" >> ${_logdir}/pecl_install.log perl -i -n -p -e "s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\napc.enable_cli = 1\n#" $PHP_INI_FILE if [ "$?" = "0" ]; then echo_ok else echo_failed fi else echo_failed error "See log file: ${_logdir}/pecl_install.log" fi fi ## ----- ## - END: Install APCu ## ----- ## ----- ## - Install memcached ## ----- echo "" >> ${_logdir}/pecl_install.log echo "" >> ${_logdir}/pecl_install.log echo "## -----" >> ${_logdir}/pecl_install.log echo "## - Install memcached" >> ${_logdir}/pecl_install.log echo "## -----" >> ${_logdir}/pecl_install.log echo "" >> ${_logdir}/pecl_install.log echononl "\tInstall memcached via pecl.." if [[ $PHP_MAJOR_VERSION -lt 7 ]] ; then echo "" >> ${_logdir}/pecl_install.log echo "printf \"no --disable-memcached-sasl\\n\" | ${PREFIX_PHP}/bin/pecl install memcached-2.2.0" >> ${_logdir}/pecl_install.log printf "no --disable-memcached-sasl\n" | ${PREFIX_PHP}/bin/pecl install memcached-2.2.0 >> "${_logdir}/pecl_install.log" 2>&1 else printf "\n" | ${PREFIX_PHP}/bin/pecl install memcached >> "${_logdir}/pecl_install.log" 2>&1 fi if [ "$?" = "0" ]; then echo_ok echononl "\tphp.ini: extension=memcached.so .." _extension="memcached.so" echo "" >> ${_logdir}/pecl_install.log echo "# php.ini: extension=memcached.so .." >> ${_logdir}/pecl_install.log echo "perl -i -n -p -e \"s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#\" $PHP_INI_FILE" >> ${_logdir}/pecl_install.log perl -i -n -p -e "s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#" $PHP_INI_FILE if [ "$?" = "0" ]; then echo_ok else echo_failed fi elif [[ $PHP_MAJOR_VERSION -lt 8 ]] ; then echo_try_from_src echo "" >> ${_logdir}/pecl_install.log echo "# Try to install memcached from source.." >> ${_logdir}/pecl_install.log echo "#" >> ${_logdir}/pecl_install.log echo "cd /tmp" >> ${_logdir}/pecl_install.log echo "rm -rf /tmp/php-memcached" >> ${_logdir}/pecl_install.log echo -e "\tTry to install memcached from source.." cd /tmp rm -rf /tmp/php-memcached _failed=false echononl "\tInstalling git .." if ! dpkg -l git 2> /dev/null | grep -e "^ii" | grep git > /dev/null 2>&1 ; then echo "# Installing git .." echo "apt-get update" >> ${_logdir}/pecl_install.log echo "apt-get -q -y install git" >> ${_logdir}/pecl_install.log apt-get -q -y install git >> "${_logdir}/pecl_install.log" 2>&1 if [ "$?" = 0 ]; then echo_ok else echo_failed error "See log file: ${_logdir}/pecl_install.log" echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/nno]: " read OK done [[ $OK = "yes" ]] || fatal "Abbruch durch User" echo "" _failed=true fi else echo_skipped fi if ! $_failed ; then echo "# Clone from github repository.." >> ${_logdir}/pecl_install.log echo "git clone https://github.com/php-memcached-dev/php-memcached.git" >> ${_logdir}/pecl_install.log echononl "\tClone from github repository.." git clone https://github.com/php-memcached-dev/php-memcached.git >> "${_logdir}/pecl_install.log" 2>&1 if [ "$?" = 0 ]; then echo_ok cd php-memcached else echo_failed error "See log file: ${_logdir}/pecl_install.log" echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/nno]: " read OK done [[ $OK = "yes" ]] || fatal "Abbruch durch User" echo "" failed=true fi fi if ! $_failed ; then echo "# git checkout php7" >> ${_logdir}/pecl_install.log echo "git checkout php7" >> ${_logdir}/pecl_install.log echononl "\tgit checkout php7.." git checkout php7 >> "${_logdir}/pecl_install.log" 2>&1 if [ "$?" = 0 ]; then echo_ok echo "cd /tmp/php-memcached" >> ${_logdir}/pecl_install.log cd /tmp/php-memcached else echo_failed error "See log file: ${_logdir}/pecl_install.log" echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/nno]: " read OK done [[ $OK = "yes" ]] || fatal "Abbruch durch User" echo "" failed=true fi fi if ! $_failed ; then echononl "\t/usr/local/php-${VERSION}/bin/phpize.." echo "/usr/local/php-${VERSION}/bin/phpize" >> "${_logdir}/pecl_install.log" 2>&1 /usr/local/php-${VERSION}/bin/phpize >> "${_logdir}/pecl_install.log" 2>&1 if [ "$?" = 0 ]; then echo_ok else echo_failed error "See log file: ${_logdir}/pecl_install.log" echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/nno]: " read OK done [[ $OK = "yes" ]] || fatal "Abbruch durch User" echo "" failed=true fi fi if ! $_failed ; then echononl "\tConfigure memcached extension.." echo "./configure --with-php-config=/usr/local/php-${VERSION}/bin/php-config --disable-memcached-sasl" >> "${_logdir}/pecl_install.log" 2>&1 ./configure --with-php-config=/usr/local/php-${VERSION}/bin/php-config \ --disable-memcached-sasl >> "${_logdir}/pecl_install.log" 2>&1 if [ "$?" = 0 ]; then echo_ok else echo_failed error "See log file: ${_logdir}/pecl_install.log" echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/nno]: " read OK done [[ $OK = "yes" ]] || fatal "Abbruch durch User" echo "" failed=true fi fi if ! $_failed ; then echononl "\tCompile memcached extension.." echo "make" >> ${_logdir}/pecl_install.log make >> "${_logdir}/pecl_install.log" 2>&1 if [ "$?" = 0 ]; then echo_ok else echo_failed error "See log file: ${_logdir}/pecl_install.log" echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/nno]: " read OK done [[ $OK = "yes" ]] || fatal "Abbruch durch User" echo "" failed=true fi fi if ! $_failed ; then echononl "\tInstall memcached extension.." echo "make install" >> ${_logdir}/pecl_install.log make install >> "${_logdir}/pecl_install.log" 2>&1 if [ "$?" = 0 ]; then echo_ok else echo_failed error "See log file: ${_logdir}/pecl_install.log" echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/nno]: " read OK done [[ $OK = "yes" ]] || fatal "Abbruch durch User" echo "" failed=true fi fi echo "rm -rf /tmp/php-memcached" >> ${_logdir}/pecl_install.log rm -rf /tmp/php-memcached if ! $_failed ; then echo "" >> ${_logdir}/pecl_install.log echo "# php.ini: extension=memcsched .." echo "perl -i -n -p -e \"s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#\" $PHP_INI_FILE" >> ${_logdir}/pecl_install.log echononl "\tphp.ini: extension=memcsched .." _extension="memcached.so" perl -i -n -p -e "s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#" $PHP_INI_FILE if [ "$?" = "0" ]; then echo_ok else echo_failed fi fi echo "" fi ## ----- ## - END: Install memcached ## ----- ## ----- ## - Install imagick ## ----- echo "" >> ${_logdir}/pecl_install.log echo "" >> ${_logdir}/pecl_install.log echo "## -----" >> ${_logdir}/pecl_install.log echo "## - Install imagick via pecl.." >> ${_logdir}/pecl_install.log echo "## -----" >> ${_logdir}/pecl_install.log echo "" >> ${_logdir}/pecl_install.log echo "cd /tmp" >> ${_logdir}/pecl_install.log echo "_MagickWand_config=\$(which MagickWand-config)" >> ${_logdir}/pecl_install.log cd /tmp _MagickWand_config=`which MagickWand-config` if [[ -z "$_MagickWand_config" ]] || [[ ! -f "$(realpath "$_MagickWand_config")" ]]; then echo "# Remove broken link '/usr/bin/MagickWand-config'" >> ${_logdir}/pecl_install.log echo "rm /usr/bin/MagickWand-config" >> ${_logdir}/pecl_install.log echononl "\tRemove broken link '/usr/bin/MagickWand-config'" if [[ -h "/usr/bin/MagickWand-config" ]]; then rm /usr/bin/MagickWand-config if [[ $? -eq 0 ]]; then echo_ok else echo_failed error "See log file: ${_logdir}/pecl_install.log" fi else echo_skipped fi echononl "\tUpdate file name database (updatedb).." echo "" >> ${_logdir}/pecl_install.log echo "# Update file name database (updatedb).." >> ${_logdir}/pecl_install.log echo "updatedb" >> ${_logdir}/pecl_install.log if $SKIP_UPDATE_DB ; then echo_skipped else updatedb >> ${_logdir}/pecl_install.log 2>&1 if [ "$?" = "0" ]; then echo_ok else echo_failed fi fi _MagickWand_config=`locate MagickWand-config | grep -e "/MagickWand-config$" | head -n 1` if [ ! -f "$_MagickWand_config" ]; then _MagickWand_config="$(find /usr/lib/x86_64-linux-gnu/ -type f -name MagickWand-config | head -n 1)" fi if [ -f "$_MagickWand_config" ]; then echononl "\tSymlink /usr/bin/MagickWand-config --> $_MagickWand_config" echo "" >> ${_logdir}/pecl_install.log echo "# Symlink /usr/bin/MagickWand-config --> $_MagickWand_config" >> ${_logdir}/pecl_install.log echo "ln -s $_MagickWand_config /usr/bin/" >> ${_logdir}/pecl_install.log ln -s $_MagickWand_config /usr/bin/ >> ${_logdir}/pecl_install.log 2>&1 if [ "$?" = "0" ]; then echo_ok else echo_failed fi else warn "Cannot find \"MagickWand_config\" - but is needed for \"imagick\"." echo "" >> ${_logdir}/pecl_install.log echo "# ---" >> ${_logdir}/pecl_install.log echo "# Warning: Cannot find \"MagickWand_config\" - but is needed for \"imagick\"." >> ${_logdir}/pecl_install.log echo "# ---" >> ${_logdir}/pecl_install.log fi echo "" >> ${_logdir}/pecl_install.log fi echononl "\tInstall imagick via pecl.." echo "# Install imagick via pecl.." >> ${_logdir}/pecl_install.log echo "printf \"\\n\" | ${PREFIX_PHP}/bin/pecl install imagick" >> ${_logdir}/pecl_install.log printf "\n" | ${PREFIX_PHP}/bin/pecl install imagick >> "${_logdir}/pecl_install.log" 2>&1 if [ "$?" = "0" ]; then echo_ok echononl "\tphp.ini: extension=imagick.so .." _extension="imagick.so" echo "" >> ${_logdir}/pecl_install.log echo "# php.ini: extension=imagick.so .." >> ${_logdir}/pecl_install.log echo "perl -i -n -p -e \"s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#\" $PHP_INI_FILE" >> ${_logdir}/pecl_install.log perl -i -n -p -e "s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#" $PHP_INI_FILE if [ "$?" = "0" ]; then echo_ok else echo_failed error "See log file: ${_logdir}/pecl_install.log" fi else echo_try_from_src echo -e "\tTry to install imagick from source.." cd /tmp rm -rf /tmp/imagick echo "" >> ${_logdir}/pecl_install.log echo "# Try to install imagick from source.." >> ${_logdir}/pecl_install.log echo ""cd /tmp >> ${_logdir}/pecl_install.log echo ""rm -rf /tmp/imagick >> ${_logdir}/pecl_install.log _failed=false echononl "\tInstalling git .." if ! dpkg -l git 2> /dev/null | grep -e "^ii" | grep git > /dev/null 2>&1 ; then echo "" >> ${_logdir}/pecl_install.log echo "# Installing git .." >> ${_logdir}/pecl_install.log echo "apt-get -q -y install git" >> ${_logdir}/pecl_install.log apt-get -q -y install git > /dev/null 2>&1 if [ "$?" = 0 ]; then echo_ok else echo_failed _failed=true fi else echo_skipped fi if ! $_failed ; then echononl "\tClone from github repository.." echo "" >> ${_logdir}/pecl_install.log echo "# Clone from github repository.." >> ${_logdir}/pecl_install.log echo "git clone https://github.com/Imagick/imagick" >> ${_logdir}/pecl_install.log git clone https://github.com/Imagick/imagick > /dev/null 2>&1 if [ "$?" = 0 ]; then echo_ok echo "" >> ${_logdir}/pecl_install.log echo "cd imagick" >> ${_logdir}/pecl_install.log cd imagick else echo_failed error "See log file: ${_logdir}/pecl_install.log" echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/nno]: " read OK done [[ $OK = "yes" ]] || fatal "Abbruch durch User" echo "" failed=true fi fi if ! $_failed ; then echononl "\ttrigger 'phpize' inside dir '/tmp/imagick' .." echo "" >> ${_logdir}/pecl_install.log echo "# Ttrigger 'phpize' inside dir '/tmp/imagick' .." >> ${_logdir}/pecl_install.log echo "/usr/local/php-${VERSION}/bin/phpize" >> ${_logdir}/pecl_install.log /usr/local/php-${VERSION}/bin/phpize > /dev/null 2>&1 if [ "$?" = 0 ]; then echo_ok else echo_failed error "See log file: ${_logdir}/pecl_install.log" echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/nno]: " read OK done [[ $OK = "yes" ]] || fatal "Abbruch durch User" echo "" failed=true fi fi if ! $_failed ; then echo "" >> ${_logdir}/pecl_install.log echo "# Configure imagick extension.." >> ${_logdir}/pecl_install.log echo "./configure --with-php-config=/usr/local/php-${VERSION}/bin/php-config" >> ${_logdir}/pecl_install.log echononl "\tConfigure imagick extension.." ./configure --with-php-config=/usr/local/php-${VERSION}/bin/php-config > /dev/null 2>&1 if [ "$?" = 0 ]; then echo_ok else echo_failed error "See log file: ${_logdir}/pecl_install.log" echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/nno]: " read OK done [[ $OK = "yes" ]] || fatal "Abbruch durch User" echo "" failed=true fi fi if ! $_failed ; then echo "" >> ${_logdir}/pecl_install.log echo "# Compile imagick extension.." >> ${_logdir}/pecl_install.log echo "make" >> ${_logdir}/pecl_install.log echononl "\tCompile imagick extension.." make > /dev/null 2>&1 if [ "$?" = 0 ]; then echo_ok else echo_failed error "See log file: ${_logdir}/pecl_install.log" echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/nno]: " read OK done [[ $OK = "yes" ]] || fatal "Abbruch durch User" echo "" failed=true fi fi if ! $_failed ; then echo "" >> ${_logdir}/pecl_install.log echo "# Install imagick extension.." >> ${_logdir}/pecl_install.log echo "make install" >> ${_logdir}/pecl_install.log echononl "\tInstall imagick extension.." make install > /dev/null 2>&1 if [ "$?" = 0 ]; then echo_ok else echo_failed error "See log file: ${_logdir}/pecl_install.log" echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/nno]: " read OK done [[ $OK = "yes" ]] || fatal "Abbruch durch User" echo "" failed=true fi fi rm -rf /tmp/imagick if ! $_failed ; then echononl "\tphp.ini: extension=imagick .." _extension="imagick.so" echo "" >> ${_logdir}/pecl_install.log echo "# php.ini: extension=imagick .." >> ${_logdir}/pecl_install.log echo "perl -i -n -p -e \"s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#\" $PHP_INI_FILE" >> ${_logdir}/pecl_install.log perl -i -n -p -e "s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#" $PHP_INI_FILE if [ "$?" = "0" ]; then echo_ok else echo_failed fi echo "" fi fi ## ----- ## - END: Install imagick ## ----- ## ----- ## - Install mcrypt ## ----- echo "" >> ${_logdir}/pecl_install.log echo "" >> ${_logdir}/pecl_install.log echo "## -----" >> ${_logdir}/pecl_install.log echo "## - Install mcrypt" >> ${_logdir}/pecl_install.log echo "## -----" >> ${_logdir}/pecl_install.log echo "" >> ${_logdir}/pecl_install.log ## - since php version 7.2: mcrypt was moved to PECL ## - if ([[ "$PHP_MAJOR_VERSION" -eq 7 ]] && [[ "$PHP_MINOR_VERSION" -ge 2 ]]) \ || [[ "$PHP_MAJOR_VERSION" -gt 7 ]] ; then echo "# Install mcrypt via pecl.." >> ${_logdir}/pecl_install.log echo "printf \"\\n\" | ${PREFIX_PHP}/bin/pecl install mcrypt" >> ${_logdir}/pecl_install.log echononl "\tInstall mcrypt via pecl.." _success=true printf "\n" | ${PREFIX_PHP}/bin/pecl install mcrypt >> "${_logdir}/pecl_install.log" 2>&1 if [[ $? -eq 0 ]]; then echo_ok else echo_failed error "See log file: ${_logdir}/pecl_install.log" echo "" >> ${_logdir}/pecl_install.log echo "# Try to install mcrypt verision 1.0.1" >> ${_logdir}/pecl_install.log echo "printf \"\\n\" | ${PREFIX_PHP}/bin/pecl install mcrypt-1.0.1" >> ${_logdir}/pecl_install.log echononl "\tTry to install mcrypt verision 1.0.1" printf "\n" | ${PREFIX_PHP}/bin/pecl install mcrypt-1.0.1 >> "${_logdir}/pecl_install.log" 2>&1 if [[ $? -eq 0 ]]; then echo_ok else echo_failed _success=false error "See log file: ${_logdir}/pecl_install.log" fi fi echononl "\tphp.ini: extension=mcrypt.so .." if $_success ; then _extension="mcrypt.so" echo "" >> ${_logdir}/pecl_install.log echo "# php.ini: extension=mcrypt.so.." >> ${_logdir}/pecl_install.log echo "perl -i -n -p -e \"s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#\" $PHP_INI_FILE" >> ${_logdir}/pecl_install.log perl -i -n -p -e "s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#" $PHP_INI_FILE if [[ $? -eq 0 ]] ; then echo_ok else echo_failed fi else echo_skipped fi fi ## ----- ## - Install wddx ## ----- echo "" >> ${_logdir}/pecl_install.log echo "" >> ${_logdir}/pecl_install.log echo "## -----" >> ${_logdir}/pecl_install.log echo "## - Install wddx" >> ${_logdir}/pecl_install.log echo "## -----" >> ${_logdir}/pecl_install.log echo "" >> ${_logdir}/pecl_install.log ## - since php version 7.4: wddx was moved to PECL ## - if ([[ "$PHP_MAJOR_VERSION" -eq 7 ]] && [[ "$PHP_MINOR_VERSION" -ge 4 ]]) \ || [[ "$PHP_MAJOR_VERSION" -gt 7 ]] ; then echo "# Install wddx via pecl.." >> ${_logdir}/pecl_install.log echo "printf \"\\n\" | ${PREFIX_PHP}/bin/pecl install wddx" >> ${_logdir}/pecl_install.log echononl "\tInstall wddx via pecl.." _success=true printf "\n" | ${PREFIX_PHP}/bin/pecl install wddx >> "${_logdir}/pecl_install.log" 2>&1 if [[ "$?" = "0" ]]; then echo_ok echononl "\tphp.ini: extension=wddx.so .." _extension="wddx.so" echo "" >> ${_logdir}/pecl_install.log echo "# php.ini: extension=wddx.so .." >> ${_logdir}/pecl_install.log echo "perl -i -n -p -e \"s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#\" $PHP_INI_FILE" >> ${_logdir}/pecl_install.log perl -i -n -p -e "s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#" $PHP_INI_FILE if [ "$?" = "0" ]; then echo_ok else echo_failed error "See log file: ${_logdir}/pecl_install.log" fi else echo_try_from_src echo -e "\tTry to install wddx from source.." cd /tmp rm -rf /tmp/pecl-text-wddx echo "" >> ${_logdir}/pecl_install.log echo "# Try to install wddx from source.." >> ${_logdir}/pecl_install.log echo "cd /tmp" >> ${_logdir}/pecl_install.log echo "rm -rf /tmp/pecl-text-wddx" >> ${_logdir}/pecl_install.log _failed=false echononl "\tInstalling git .." if ! dpkg -l git 2> /dev/null | grep -e "^ii" | grep git > /dev/null 2>&1 ; then echo "" >> ${_logdir}/pecl_install.log echo "# Installing git .." >> ${_logdir}/pecl_install.log echo "apt-get -q -y install git" >> ${_logdir}/pecl_install.log apt-get -q -y install git > /dev/null 2>&1 if [ "$?" = 0 ]; then echo_ok else echo_failed _failed=true fi else echo_skipped fi if ! $_failed ; then echo "" >> ${_logdir}/pecl_install.log echo "# Clone from github repository.." >> ${_logdir}/pecl_install.log echo "git clone https://github.com/php/pecl-text-wddx.git" >> ${_logdir}/pecl_install.log echononl "\tClone from github repository.." git clone https://github.com/php/pecl-text-wddx.git > /dev/null 2>&1 if [ "$?" = 0 ]; then echo_ok cd pecl-text-wddx else echo_failed echo "" echononl "continue anyway [yes/no]: " echo "" read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/nno]: " read OK done [[ $OK = "yes" ]] || fatal "Abbruch durch User" echo "" failed=true fi fi if ! $_failed ; then echo "" >> ${_logdir}/pecl_install.log echo "# Trigger 'phpize' inside dir '/tmp/pecl-text-wddx' .." >> ${_logdir}/pecl_install.log echo "/usr/local/php-${VERSION}/bin/phpize" >> ${_logdir}/pecl_install.log echononl "\tTrigger 'phpize' inside dir '/tmp/pecl-text-wddx' .." /usr/local/php-${VERSION}/bin/phpize > /dev/null 2>&1 if [ "$?" = 0 ]; then echo_ok else echo_failed cho "" echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/nno]: " read OK done [[ $OK = "yes" ]] || fatal "Abbruch durch User" echo "" failed=true fi fi if ! $_failed ; then echo "" >> ${_logdir}/pecl_install.log echo "# Configure wddx extension.." >> ${_logdir}/pecl_install.log echo "./configure --with-php-config=/usr/local/php-${VERSION}/bin/php-config" >> ${_logdir}/pecl_install.log echononl "\tConfigure wddx extension.." ./configure --with-php-config=/usr/local/php-${VERSION}/bin/php-config > /dev/null 2>&1 if [ "$?" = 0 ]; then echo_ok else echo_failed echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/nno]: " read OK done [[ $OK = "yes" ]] || fatal "Abbruch durch User" echo "" failed=true fi fi if ! $_failed ; then echo "" >> ${_logdir}/pecl_install.log echo "# Compile wddx extension.." >> ${_logdir}/pecl_install.log echo "" >> ${_logdir}/pecl_install.log echononl "\tCompile wddx extension.." make > /dev/null 2>&1 if [ "$?" = 0 ]; then echo_ok else echo_failed echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/nno]: " read OK done [[ $OK = "yes" ]] || fatal "Abbruch durch User" echo "" failed=true fi fi if ! $_failed ; then echo "" >> ${_logdir}/pecl_install.log echo "# Install wddx extension.." >> ${_logdir}/pecl_install.log echo "make install" >> ${_logdir}/pecl_install.log echononl "\tInstall wddx extension.." make install > /dev/null 2>&1 if [ "$?" = 0 ]; then echo_ok else echo_failed echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/nno]: " read OK done [[ $OK = "yes" ]] || fatal "Abbruch durch User" echo "" failed=true fi fi rm -rf /tmp/pecl-text-wddx if ! $_failed ; then echo "" >> ${_logdir}/pecl_install.log echo "# php.ini: extension=wddx .." >> ${_logdir}/pecl_install.log echo "perl -i -n -p -e \"s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#\" $PHP_INI_FILE" >> ${_logdir}/pecl_install.log echononl "\tphp.ini: extension=wddx .." _extension="wddx.so" perl -i -n -p -e "s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#" $PHP_INI_FILE if [ "$?" = "0" ]; then echo_ok else echo_failed fi echo "" fi fi fi ## ----- ## - END: Install wddx ## ----- ## ----- ## - Install pcntl ## ----- #echononl "\tphp.ini: extension=pcntl.so .." #_extension="pcntl.so" #perl -i -n -p -e "s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#" $PHP_INI_FILE #if [ "$?" = "0" ]; then # echo_ok #else # echo_failed #fi ## ----- ## - END: Install pcntl ## ----- ## ----- ## - Install raphf ## ----- echo "" >> ${_logdir}/pecl_install.log echo "" >> ${_logdir}/pecl_install.log echo "## -----" >> ${_logdir}/pecl_install.log echo "## - Install 'raphf' via pecl.." >> ${_logdir}/pecl_install.log echo "## -----" >> ${_logdir}/pecl_install.log echo "" >> ${_logdir}/pecl_install.log echononl "\tInstall 'raphf' via pecl.." if [[ $PHP_MAJOR_VERSION -lt 7 ]] ; then printf "\n" | ${PREFIX_PHP}/bin/pecl install raphf-1.1.2 >> "${_logdir}/pecl_install.log" 2>&1 if [ "$?" = "0" ]; then echo_ok echononl "\tphp.ini: extension=raphf .." _extension="raphf.so" perl -i -n -p -e "s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#" $PHP_INI_FILE if [ "$?" = "0" ]; then echo_ok else echo_failed fi else echo_failed fi else printf "\n" | ${PREFIX_PHP}/bin/pecl install raphf >> "${_logdir}/pecl_install.log" 2>&1 if [ "$?" = "0" ]; then echo_ok echononl "\tphp.ini: extension=raphf .." _extension="raphf.so" perl -i -n -p -e "s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#" $PHP_INI_FILE if [ "$?" = "0" ]; then echo_ok else echo_failed fi else echo_failed fi fi ## ----- ## - END: Install raphf ## ----- ## ----- ## - Install propro ## ----- echo "" >> ${_logdir}/pecl_install.log echo "" >> ${_logdir}/pecl_install.log echo "## -----" >> ${_logdir}/pecl_install.log echo "## - Install propro" >> ${_logdir}/pecl_install.log echo "## -----" >> ${_logdir}/pecl_install.log echo "" >> ${_logdir}/pecl_install.log echononl "\tInstall 'propro' via pecl.." if [[ $PHP_MAJOR_VERSION -lt 7 ]] ; then echo "printf \"\\n\" | ${PREFIX_PHP}/bin/pecl install propro-1.0.2" >> ${_logdir}/pecl_install.log printf "\n" | ${PREFIX_PHP}/bin/pecl install propro-1.0.2 >> "${_logdir}/pecl_install.log" 2>&1 if [ "$?" = "0" ]; then echo_ok echononl "\tphp.ini: extension=propro .." _extension="propro.so" perl -i -n -p -e "s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#" $PHP_INI_FILE if [ "$?" = "0" ]; then echo_ok else echo_failed fi else echo_failed fi else echo "printf \"\\n\" | ${PREFIX_PHP}/bin/pecl install propro" >> ${_logdir}/pecl_install.log printf "\n" | ${PREFIX_PHP}/bin/pecl install propro >> "${_logdir}/pecl_install.log" 2>&1 if [ "$?" = "0" ]; then echo_ok echononl "\tphp.ini: extension=propro .." _extension="propro.so" echo "" >> ${_logdir}/pecl_install.log echo "# php.ini: extension=propro .." >> ${_logdir}/pecl_install.log echo "perl -i -n -p -e \"s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#\" $PHP_INI_FILE" >> ${_logdir}/pecl_install.log perl -i -n -p -e "s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#" $PHP_INI_FILE if [ "$?" = "0" ]; then echo_ok else echo_failed fi else echo_try_from_src echo -e "\tTry to install propro from source.." cd /tmp rm -rf /tmp/ext-propro echo "" >> ${_logdir}/pecl_install.log echo "# Try to install propro from source.." >> ${_logdir}/pecl_install.log echo ""cd /tmp >> ${_logdir}/pecl_install.log echo ""rm -rf /tmp/ext-propro >> ${_logdir}/pecl_install.log _failed=false echononl "\tInstalling git .." if ! dpkg -l git 2> /dev/null | grep -e "^ii" | grep git > /dev/null 2>&1 ; then echo "" >> ${_logdir}/pecl_install.log echo "# Installing git .." >> ${_logdir}/pecl_install.log echo "apt-get -q -y install git" >> ${_logdir}/pecl_install.log apt-get -q -y install git > /dev/null 2>&1 if [ "$?" = 0 ]; then echo_ok else echo_failed _failed=true fi else echo_skipped fi if ! $_failed ; then echononl "\tClone from github repository.." echo "" >> ${_logdir}/pecl_install.log echo "# Clone from github repository.." >> ${_logdir}/pecl_install.log echo "git clone https://github.com/m6w6/ext-propro" >> ${_logdir}/pecl_install.log git clone https://github.com/m6w6/ext-propro> /dev/null 2>&1 if [ "$?" = 0 ]; then echo_ok echo "" >> ${_logdir}/pecl_install.log echo "cd ext-propro" >> ${_logdir}/pecl_install.log cd ext-propro else echo_failed echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/nno]: " read OK done [[ $OK = "yes" ]] || fatal "Abbruch durch User" echo "" _failed=true fi fi if ! $_failed ; then echononl "\ttrigger 'phpize' inside dir '/tmp/ext-propro' .." echo "" >> ${_logdir}/pecl_install.log echo "# Ttrigger 'phpize' inside dir '/tmp/ext-propro' .." >> ${_logdir}/pecl_install.log echo "/usr/local/php-${VERSION}/bin/phpize" >> ${_logdir}/pecl_install.log /usr/local/php-${VERSION}/bin/phpize > /dev/null 2>&1 if [ "$?" = 0 ]; then echo_ok else echo_failed echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/nno]: " read OK done [[ $OK = "yes" ]] || fatal "Abbruch durch User" echo "" _failed=true fi fi if ! $_failed ; then echo "" >> ${_logdir}/pecl_install.log echo "# Configure propro extension.." >> ${_logdir}/pecl_install.log echo "./configure --with-php-config=/usr/local/php-${VERSION}/bin/php-config" >> ${_logdir}/pecl_install.log echononl "\tConfigure propro extension.." ./configure --with-php-config=/usr/local/php-${VERSION}/bin/php-config > /dev/null 2>&1 if [ "$?" = 0 ]; then echo_ok else echo_failed echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/nno]: " read OK done [[ $OK = "yes" ]] || fatal "Abbruch durch User" echo "" _failed=true fi fi if ! $_failed ; then echo "" >> ${_logdir}/pecl_install.log echo "# Compile propro extension.." >> ${_logdir}/pecl_install.log echo "make" >> ${_logdir}/pecl_install.log echononl "\tCompile propro extension.." make > "${_logdir}/pecl_install.log" 2>&1 if [ "$?" = 0 ]; then echo_ok else echo_failed echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/nno]: " read OK done [[ $OK = "yes" ]] || fatal "Abbruch durch User" echo "" _failed=true fi fi if ! $_failed ; then echo "" >> ${_logdir}/pecl_install.log echo "# Install propro extension.." >> ${_logdir}/pecl_install.log echo "make install" >> ${_logdir}/pecl_install.log echononl "\tInstall propro extension.." make install > /dev/null 2>&1 if [ "$?" = 0 ]; then echo_ok else echo_failed echo "" echononl "continue anyway [yes/no]: " read OK OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do echononl "Wrong entry! - repeat [yes/nno]: " read OK done [[ $OK = "yes" ]] || fatal "Abbruch durch User" echo "" _failed=true fi fi rm -rf /tmp/ext-propro if ! $_failed ; then echononl "\tphp.ini: extension=propro .." _extension="propro.so" echo "" >> ${_logdir}/pecl_install.log echo "# php.ini: extension=memcsched .." >> ${_logdir}/pecl_install.log echo "perl -i -n -p -e \"s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#\" $PHP_INI_FILE" >> ${_logdir}/pecl_install.log perl -i -n -p -e "s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#" $PHP_INI_FILE if [ "$?" = "0" ]; then echo_ok else echo_failed fi echo "" fi fi fi ## ----- ## - END: Install propro ## ----- ## ----- ## - Install pecl_http ## ----- echo "" >> ${_logdir}/pecl_install.log echo "" >> ${_logdir}/pecl_install.log echo "## -----" >> ${_logdir}/pecl_install.log echo "## - Install 'pecl_http via pecl'.." >> ${_logdir}/pecl_install.log echo "## -----" >> ${_logdir}/pecl_install.log echo "" >> ${_logdir}/pecl_install.log echononl "\tInstall 'pecl_http' via pecl.." if [[ $PHP_MAJOR_VERSION -lt 7 ]] ; then printf "\n" | ${PREFIX_PHP}/bin/pecl install pecl_http-2.6.0 >> "${_logdir}/pecl_install.log" 2>&1 if [ "$?" = "0" ]; then echo_ok echononl "\tphp.ini: extension=pecl_http .." _extension="http.so" perl -i -n -p -e "s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#" $PHP_INI_FILE if [ "$?" = "0" ]; then echo_ok else echo_failed fi else echo_failed fi elif [[ $PHP_MAJOR_VERSION -lt 8 ]] ; then printf "\n" | ${PREFIX_PHP}/bin/pecl install pecl_http-3.2.4 >> "${_logdir}/pecl_install.log" 2>&1 if [ "$?" = "0" ]; then echo_ok echononl "\tphp.ini: extension=pecl_http .." _extension="http.so" perl -i -n -p -e "s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#" $PHP_INI_FILE if [ "$?" = "0" ]; then echo_ok else echo_failed fi else echo_failed fi else printf "\n" | ${PREFIX_PHP}/bin/pecl install pecl_http >> "${_logdir}/pecl_install.log" 2>&1 if [ "$?" = "0" ]; then echo_ok echononl "\tphp.ini: extension=pecl_http .." _extension="http.so" perl -i -n -p -e "s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#" $PHP_INI_FILE if [ "$?" = "0" ]; then echo_ok else echo_failed fi else echo_failed fi fi ## ----- ## - END: Install pecl_http ## ----- ## ----- ## - Enable ldap.so ## ----- echononl "\tphp.ini: extension=ldap .." _extension="ldap.so" perl -i -n -p -e "s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#" $PHP_INI_FILE if [ "$?" = "0" ]; then echo_ok else echo_failed fi ## ----- ## - END: Enable ldap.so ## ----- if $LEGACY_SQL_FUNCTION_SUPPORT ; then ## - PHP legacy SQL functions support ## - echo "" echo "" echo -e "\t---" echo -e "\t--- Install support for lagacy MySQL functions" echo -e "\t---" echo "" _lsf_src_dir="/usr/local/src/php-${PHP_MAIN_VERSION}_mysql" echononl "\tBackup existing directory '${_lsf_src_dir}'.." if [[ -d "${_lsf_src_dir}" ]]; then mv "$_lsf_src_dir" "${_lsf_src_dir}.$_backup_date" > /dev/null 2> $tmp_err_msg if [[ $? -eq 0 ]] ; then echo_ok else echo_failed error "$(cat $tmp_err_msg)" fi else echo_skipped fi echononl "\tCreate directory '$_lsf_src_dir'.." mkdir "$_lsf_src_dir" > /dev/null 2> $tmp_err_msg if [[ $? -eq 0 ]] ; then echo_ok else echo_failed error "$(cat $tmp_err_msg)" fi echononl "\tChange into directory '$_lsf_src_dir'.." cd "$_lsf_src_dir" > /dev/null 2> $tmp_err_msg if [[ $? -eq 0 ]] ; then echo_ok else echo_failed error "$(cat $tmp_err_msg)" fi echononl "\tClone 'https://github.com/php/pecl-database-mysql'.." git clone https://github.com/php/pecl-database-mysql ${_lsf_src_dir}/mysql --recursive > $tmp_err_msg 2>&1 if [[ $? -eq 0 ]] ; then echo_ok else echo_failed error "$(cat $tmp_err_msg)" fi echononl "\tChange into directory '${_lsf_src_dir}/mysql'.." cd "${_lsf_src_dir}/mysql" > /dev/null 2> $tmp_err_msg if [[ $? -eq 0 ]] ; then echo_ok else echo_failed error "$(cat $tmp_err_msg)" fi echononl "\tPrepare a PHP extension (SQL legazy functions) for compiling.." phpize > $tmp_err_msg 2>&1 if [[ $? -eq 0 ]] ; then echo_ok else echo_failed error "$(cat $tmp_err_msg)" fi echononl "\tConfigure PHP extension (SQL legazy functions).." ./configure > $tmp_err_msg 2>&1 if [[ $? -eq 0 ]] ; then echo_ok else echo_failed error "$(cat $tmp_err_msg)" fi echononl "\tCompile PHP extension (SQL legazy functions).." make > $tmp_err_msg 2>&1 if [[ $? -eq 0 ]] ; then echo_ok else echo_failed error "$(cat $tmp_err_msg)" fi echononl "\tInstall PHP extension (SQL legazy functions).." make install > $tmp_err_msg 2>&1 if [[ $? -eq 0 ]] ; then echo_ok else echo_failed error "$(cat $tmp_err_msg)" fi extension_lsf="$(find ${PREFIX_PHP}/lib/php/extensions -name mysql.so -print)" echononl "\tphp.ini: extension=\"$extension_lsf\" .." if [[ -n "$extension_lsf" ]]; then perl -i -n -p -e "s#^(\s*\[PHP\]\s*)#\1\nextension=$extension_lsf\n#" $PHP_INI_FILE if [ "$?" = "0" ]; then echo_ok else echo_failed fi else echo_skipped warn "Extension library \"mysql.so\" not found!" fi fi ## ----- ## - Install xdebug ## ----- echo "" echo "" echo -e "\t---" echo -e "\t--- Install PECL xdebug extension" echo -e "\t---" echo "" echononl "\tInstall xdebug via pecl.." if [[ "$PHP_MAIN_VERSION" = "5.4" ]] ; then printf "\n" | ${PREFIX_PHP}/bin/pecl install xdebug-2.2.7 >> "${_logdir}/pecl_install.log" 2>&1 elif [[ "$PHP_MAIN_VERSION" = "5.6" ]]; then printf "\n" | ${PREFIX_PHP}/bin/pecl install xdebug-2.5.5 >> "${_logdir}/pecl_install.log" 2>&1 else printf "\n" | ${PREFIX_PHP}/bin/pecl install xdebug >> "${_logdir}/pecl_install.log" 2>&1 fi if [ "$?" = "0" ]; then echo_ok else echo_failed echononl "\tInstall (beta) xdebug-2.6.0beta1 via pecl.." ${PREFIX_PHP}/bin/pecl install xdebug-2.6.0beta1 >> "${_logdir}/pecl_install.log" 2>&1 if [ "$?" = "0" ]; then echo_ok else echo_failed fi fi #if $WITHOUT_APACHE_MOD_PHP ; then # zend_extension_xdebug=`find /usr/local/php-${PHP_MAIN_VERSION}/lib/php/extensions -name xdebug.so -print` #else # #zend_extension_xdebug=`locate xdebug.so | grep ${PREFIX_PHP}/lib/php/extensions` zend_extension_xdebug=`find ${PREFIX_PHP}/lib/php/extensions -name xdebug.so -print` #fi echononl "\tphp.ini: zend_extension = \"$zend_extension_xdebug\" .." if [[ -n "$zend_extension_xdebug" ]]; then perl -i -n -p -e "s#^(\s*\[PHP\]\s*)#\1\n;zend_extension = $zend_extension_xdebug\n#" $PHP_INI_FILE #sed -i "s/^/\nzend_extension = ${zend_extension_xdebug}\n\n/" $PHP_INI_FILE if [ "$?" = "0" ]; then echo_ok else echo_failed fi else echo_skipped warn "Extension library \"xdebug.so\" not found!" fi echononl "\tphp.ini: Create section [xdebug]" echo "[xdebug]" >> $PHP_INI_FILE if [ "$?" = "0" ]; then echo_ok else echo_failed fi echononl "\tphp.ini: xdebug.max_nesting_level = 150" echo "xdebug.max_nesting_level = 150" >> $PHP_INI_FILE if [ "$?" = "0" ]; then echo_ok else echo_failed fi info "Enable xdebug extension by commenting in the apropriate line at top of php.ini file" ## ----- ## - END: Install xdebug ## ----- echo "" echo "" echo -e "\t---" echo -e "\t--- Install PHP PEAR extensions" echo -e "\t---" echo "" > ${_logdir}/pear_install.log PEAR_EXT="Net_Socket" echo "" >> ${_logdir}/pear_install.log echo "# - Install ${PEAR_EXT} via pear.." >> ${_logdir}/pear_install.log echo "# -" >> ${_logdir}/pear_install.log echo "${PREFIX_PHP}/bin/pear install \"$PEAR_EXT\"" >> ${_logdir}/pear_install.log echononl "\tInstall ${PEAR_EXT} via pear.." if [[ "$PHP_MAIN_VERSION" = "5.4" ]]; then echo "${PREFIX_PHP}/bin/pear install \"$PEAR_EXT-1.0.14\"" >> ${_logdir}/pear_install.log ${PREFIX_PHP}/bin/pear install "$PEAR_EXT-1.0.14" >> ${_logdir}/pear_install.log 2>&1 else echo "${PREFIX_PHP}/bin/pear install \"$PEAR_EXT\"" >> ${_logdir}/pear_install.log ${PREFIX_PHP}/bin/pear install "$PEAR_EXT" >> ${_logdir}/pear_install.log 2>&1 fi if [ "$?" = "0" ]; then echo_ok else echo_failed echo "" >> ${_logdir}/pear_install.log echo "# - Try to download and install '${PEAR_EXT}' manually.." >> ${_logdir}/pear_install.log echo "# -" >> ${_logdir}/pear_install.log echononl "\t Try to download and install '${PEAR_EXT}' manually.." DIST=master echo "rm -rf /tmp/${PEAR_EXT}-${DIST}.zip /tmp/${PEAR_EXT}-${DIST}" >> ${_logdir}/pear_install.log rm -rf /tmp/${PEAR_EXT}-${DIST}.zip /tmp/${PEAR_EXT}-${DIST} _failed=false echo "wget -O /tmp/${PEAR_EXT}-${DIST}.zip https://github.com/pear/${PEAR_EXT}/archive/${DIST}.zip" >> ${_logdir}/pear_install.log wget -O /tmp/${PEAR_EXT}-${DIST}.zip https://github.com/pear/${PEAR_EXT}/archive/${DIST}.zip >> ${_logdir}/pear_install.log 2>&1 if [[ $? -gt 0 ]] ; then _err_msg="Download from '${PEAR_EXT}-${DIST}.zip' https://github.com/pear' failed!" DIST=trunk echo "wget -O /tmp/${PEAR_EXT}-${DIST}.zip https://github.com/pear/${PEAR_EXT}/archive/${DIST}.zip" >> ${_logdir}/pear_install.log wget -O /tmp/${PEAR_EXT}-${DIST}.zip https://github.com/pear/${PEAR_EXT}/archive/${DIST}.zip >> ${_logdir}/pear_install.log 2>&1 if [[ $? -gt 0 ]] ; then _failed=true echo_failed error "$_err_msg \n\t Download from '${PEAR_EXT}-${DIST}.zip' https://github.com/pear' failed! \n\t See logfile '${_logdir}/pear_install.log'" fi fi if ! $_failed ; then echo "unzip -o -d /tmp /tmp/${PEAR_EXT}-${DIST}.zip" >> ${_logdir}/pear_install.log unzip -o -d /tmp /tmp/${PEAR_EXT}-${DIST}.zip >> ${_logdir}/pear_install.log 2>&1 if [[ $? -gt 0 ]] ; then echo_failed error "Unpacking downloaded pear extension '${PEAR_EXT}' failed! \n\t See logfile '${_logdir}/pear_install.log'" else pear install /tmp/${PEAR_EXT}-${DIST}/package.xml >> ${_logdir}/pear_install.log 2>&1 if [[ $? -gt 0 ]] ; then echo_failed error "'pear install /tmp/${PEAR_EXT}-master/package.xml' failed! \n\t See logfile '${_logdir}/pear_install.log'" else echo_ok fi fi fi fi PEAR_EXT="Net_SMTP" echo "" >> ${_logdir}/pear_install.log echo "# - Install ${PEAR_EXT} via pear.." >> ${_logdir}/pear_install.log echo "# -" >> ${_logdir}/pear_install.log echo "${PREFIX_PHP}/bin/pear install \"$PEAR_EXT\"" >> ${_logdir}/pear_install.log echononl "\tInstall ${PEAR_EXT} via pear.." if [[ "$PHP_MAIN_VERSION" = "5.4" ]]; then echo "${PREFIX_PHP}/bin/pear install \"$PEAR_EXT-1.7.2\"" >> ${_logdir}/pear_install.log ${PREFIX_PHP}/bin/pear install "$PEAR_EXT-1.7.2" >> ${_logdir}/pear_install.log 2>&1 else echo "${PREFIX_PHP}/bin/pear install \"$PEAR_EXT\"" >> ${_logdir}/pear_install.log ${PREFIX_PHP}/bin/pear install "$PEAR_EXT" >> ${_logdir}/pear_install.log 2>&1 fi if [ "$?" = "0" ]; then echo_ok else echo_failed echo "" >> ${_logdir}/pear_install.log echo "# - Try to download and install '${PEAR_EXT}' manually.." >> ${_logdir}/pear_install.log echo "# -" >> ${_logdir}/pear_install.log echononl "\t Try to download and install '${PEAR_EXT}' manually.." DIST=master echo "rm -rf /tmp/${PEAR_EXT}-${DIST}.zip /tmp/${PEAR_EXT}-${DIST}" >> ${_logdir}/pear_install.log rm -rf /tmp/${PEAR_EXT}-${DIST}.zip /tmp/${PEAR_EXT}-${DIST} _failed=false echo "wget -O /tmp/${PEAR_EXT}-${DIST}.zip https://github.com/pear/${PEAR_EXT}/archive/${DIST}.zip" >> ${_logdir}/pear_install.log wget -O /tmp/${PEAR_EXT}-${DIST}.zip https://github.com/pear/${PEAR_EXT}/archive/${DIST}.zip >> ${_logdir}/pear_install.log 2>&1 if [[ $? -gt 0 ]] ; then _err_msg="Download from '${PEAR_EXT}-${DIST}.zip' https://github.com/pear' failed!" DIST=trunk echo "wget -O /tmp/${PEAR_EXT}-${DIST}.zip https://github.com/pear/${PEAR_EXT}/archive/${DIST}.zip" >> ${_logdir}/pear_install.log wget -O /tmp/${PEAR_EXT}-${DIST}.zip https://github.com/pear/${PEAR_EXT}/archive/${DIST}.zip >> ${_logdir}/pear_install.log 2>&1 if [[ $? -gt 0 ]] ; then _failed=true echo_failed error "$_err_msg \n\t Download from '${PEAR_EXT}-${DIST}.zip' https://github.com/pear' failed! \n\t See logfile '${_logdir}/pear_install.log'" fi fi if ! $_failed ; then echo "unzip -o -d /tmp /tmp/${PEAR_EXT}-${DIST}.zip" >> ${_logdir}/pear_install.log unzip -o -d /tmp /tmp/${PEAR_EXT}-${DIST}.zip >> ${_logdir}/pear_install.log 2>&1 if [[ $? -gt 0 ]] ; then echo_failed error "Unpacking downloaded pear extension '${PEAR_EXT}' failed! \n\t See logfile '${_logdir}/pear_install.log'" else pear install /tmp/${PEAR_EXT}-${DIST}/package.xml >> ${_logdir}/pear_install.log 2>&1 if [[ $? -gt 0 ]] ; then echo_failed error "'pear install /tmp/${PEAR_EXT}-master/package.xml' failed! \n\t See logfile '${_logdir}/pear_install.log'" else echo_ok fi fi fi fi PEAR_EXT="Net_Sieve" echo "" >> ${_logdir}/pear_install.log echo "# - Install ${PEAR_EXT} via pear.." >> ${_logdir}/pear_install.log echo "# -" >> ${_logdir}/pear_install.log echo "${PREFIX_PHP}/bin/pear install \"$PEAR_EXT\"" >> ${_logdir}/pear_install.log echononl "\tInstall ${PEAR_EXT} via pear.." if [[ "$PHP_MAIN_VERSION" = "5.4" ]]; then echo "${PREFIX_PHP}/bin/pear install \"$PEAR_EXT-1.4.1\"" >> ${_logdir}/pear_install.log ${PREFIX_PHP}/bin/pear install "$PEAR_EXT-1.4.1" >> ${_logdir}/pear_install.log 2>&1 else echo "${PREFIX_PHP}/bin/pear install \"$PEAR_EXT\"" >> ${_logdir}/pear_install.log ${PREFIX_PHP}/bin/pear install "$PEAR_EXT" >> ${_logdir}/pear_install.log 2>&1 fi if [ "$?" = "0" ]; then echo_ok else echo_failed echo "" >> ${_logdir}/pear_install.log echo "# - Try to download and install '${PEAR_EXT}' manually.." >> ${_logdir}/pear_install.log echo "# -" >> ${_logdir}/pear_install.log echononl "\t Try to download and install '${PEAR_EXT}' manually.." DIST=master echo "rm -rf /tmp/${PEAR_EXT}-${DIST}.zip /tmp/${PEAR_EXT}-${DIST}" >> ${_logdir}/pear_install.log rm -rf /tmp/${PEAR_EXT}-${DIST}.zip /tmp/${PEAR_EXT}-${DIST} _failed=false echo "wget -O /tmp/${PEAR_EXT}-${DIST}.zip https://github.com/pear/${PEAR_EXT}/archive/${DIST}.zip" >> ${_logdir}/pear_install.log wget -O /tmp/${PEAR_EXT}-${DIST}.zip https://github.com/pear/${PEAR_EXT}/archive/${DIST}.zip >> ${_logdir}/pear_install.log 2>&1 if [[ $? -gt 0 ]] ; then _err_msg="Download from '${PEAR_EXT}-${DIST}.zip' https://github.com/pear' failed!" DIST=trunk echo "wget -O /tmp/${PEAR_EXT}-${DIST}.zip https://github.com/pear/${PEAR_EXT}/archive/${DIST}.zip" >> ${_logdir}/pear_install.log wget -O /tmp/${PEAR_EXT}-${DIST}.zip https://github.com/pear/${PEAR_EXT}/archive/${DIST}.zip >> ${_logdir}/pear_install.log 2>&1 if [[ $? -gt 0 ]] ; then _failed=true echo_failed error "$_err_msg \n\t Download from '${PEAR_EXT}-${DIST}.zip' https://github.com/pear' failed! \n\t See logfile '${_logdir}/pear_install.log'" fi fi if ! $_failed ; then echo "unzip -o -d /tmp /tmp/${PEAR_EXT}-${DIST}.zip" >> ${_logdir}/pear_install.log unzip -o -d /tmp /tmp/${PEAR_EXT}-${DIST}.zip >> ${_logdir}/pear_install.log 2>&1 if [[ $? -gt 0 ]] ; then echo_failed error "Unpacking downloaded pear extension '${PEAR_EXT}' failed! \n\t See logfile '${_logdir}/pear_install.log'" else pear install /tmp/${PEAR_EXT}-${DIST}/package.xml >> ${_logdir}/pear_install.log 2>&1 if [[ $? -gt 0 ]] ; then echo_failed error "'pear install /tmp/${PEAR_EXT}-master/package.xml' failed! \n\t See logfile '${_logdir}/pear_install.log'" else echo_ok fi fi fi fi PEAR_EXT="Net_IDNA2" echo "" >> ${_logdir}/pear_install.log echo "# - Install ${PEAR_EXT} via pear.." >> ${_logdir}/pear_install.log echo "# -" >> ${_logdir}/pear_install.log echo "${PREFIX_PHP}/bin/pear install \"$PEAR_EXT\"" >> ${_logdir}/pear_install.log echononl "\tInstall ${PEAR_EXT} via pear.." ${PREFIX_PHP}/bin/pear install "$PEAR_EXT" >> ${_logdir}/pear_install.log 2>&1 if [ "$?" = "0" ]; then echo_ok else echo_try_beta_version echo "" >> ${_logdir}/pear_install.log echo "# Install (beta) Net_IDNA2-${Net_IDNA2_beta_version} via pear.." >> ${_logdir}/pear_install.log echo "${PREFIX_PHP}/bin/pear install channel://pear.php.net/${PEAR_EXT}-${Net_IDNA2_beta_version}" >> ${_logdir}/pear_install.log Net_IDNA2_beta_version="0.2.0" echononl "\tInstall (beta) Net_IDNA2-${Net_IDNA2_beta_version} via pear.." echo "${PREFIX_PHP}/bin/pear install channel://pear.php.net/${PEAR_EXT}-${Net_IDNA2_beta_version}" >> ${_logdir}/pear_install.log ${PREFIX_PHP}/bin/pear install channel://pear.php.net/${PEAR_EXT}-${Net_IDNA2_beta_version} >> ${_logdir}/pear_install.log 2>&1 if [ "$?" = "0" ]; then echo_ok else echo_try_from_src echo "" >> ${_logdir}/pear_install.log echo "# - Try to download and install '${PEAR_EXT}' manually.." >> ${_logdir}/pear_install.log echo "# -" >> ${_logdir}/pear_install.log echononl "\t Try to download and install '${PEAR_EXT}' manually.." DIST=master echo "rm -rf /tmp/${PEAR_EXT}-${DIST}.zip /tmp/${PEAR_EXT}-${DIST}" >> ${_logdir}/pear_install.log rm -rf /tmp/${PEAR_EXT}-${DIST}.zip /tmp/${PEAR_EXT}-${DIST} _failed=false echo "wget -O /tmp/${PEAR_EXT}-${DIST}.zip https://github.com/pear/${PEAR_EXT}/archive/${DIST}.zip" >> ${_logdir}/pear_install.log wget -O /tmp/${PEAR_EXT}-${DIST}.zip https://github.com/pear/${PEAR_EXT}/archive/${DIST}.zip >> ${_logdir}/pear_install.log 2>&1 if [[ $? -gt 0 ]] ; then _err_msg="Download from '${PEAR_EXT}-${DIST}.zip' https://github.com/pear' failed!" DIST=trunk echo "wget -O /tmp/${PEAR_EXT}-${DIST}.zip https://github.com/pear/${PEAR_EXT}/archive/${DIST}.zip" >> ${_logdir}/pear_install.log wget -O /tmp/${PEAR_EXT}-${DIST}.zip https://github.com/pear/${PEAR_EXT}/archive/${DIST}.zip >> ${_logdir}/pear_install.log 2>&1 if [[ $? -gt 0 ]] ; then _failed=true echo_failed error "$_err_msg \n\t Download from '${PEAR_EXT}-${DIST}.zip' https://github.com/pear' failed! \n\t See logfile '${_logdir}/pear_install.log'" fi fi if ! $_failed ; then echo "unzip -o -d /tmp /tmp/${PEAR_EXT}-master.zip" >> ${_logdir}/pear_install.log unzip -o -d /tmp /tmp/${PEAR_EXT}-master.zip >> ${_logdir}/pear_install.log 2>&1 if [[ $? -gt 0 ]] ; then echo_failed error "Unpacking download pear extension failed! \n\t See logfile '${_logdir}/pear_install.log'" else pear install /tmp/${PEAR_EXT}-master/package.xml >> ${_logdir}/pear_install.log 2>&1 if [[ $? -gt 0 ]] ; then echo_failed error "'pear install /tmp/${PEAR_EXT}-master/package.xml' failed! \n\t See logfile '${_logdir}/pear_install.log'" else echo_ok fi fi fi fi fi for PEAR_EXT in Console_CommandLine Auth Auth_SASL Mail Mail_Mime Mail_mimeDecode MDB2 MDB2_Driver_pgsql Crypt_GPG ; do echo "" >> ${_logdir}/pear_install.log echo "# - Install ${PEAR_EXT} via pear.." >> ${_logdir}/pear_install.log echo "# -" >> ${_logdir}/pear_install.log echo "${PREFIX_PHP}/bin/pear install \"$PEAR_EXT\"" >> ${_logdir}/pear_install.log echononl "\tInstall ${PEAR_EXT} via pear.." ${PREFIX_PHP}/bin/pear install "$PEAR_EXT" >> ${_logdir}/pear_install.log 2>&1 if [ "$?" = "0" ]; then echo_ok else echo_failed echo "" >> ${_logdir}/pear_install.log echo "# - Try to download and install '${PEAR_EXT}' manually.." >> ${_logdir}/pear_install.log echo "# -" >> ${_logdir}/pear_install.log DIST=master echo "rm -rf /tmp/${PEAR_EXT}-${DIST}.zip /tmp/${PEAR_EXT}-${DIST}" >> ${_logdir}/pear_install.log rm -rf /tmp/${PEAR_EXT}-${DIST}.zip /tmp/${PEAR_EXT}-${DIST} echononl "\t Try to download and install '${PEAR_EXT}' manually.." _failed=false echo "wget -O /tmp/${PEAR_EXT}-${DIST}.zip https://github.com/pear/${PEAR_EXT}/archive/${DIST}.zip" >> ${_logdir}/pear_install.log wget -O /tmp/${PEAR_EXT}-${DIST}.zip https://github.com/pear/${PEAR_EXT}/archive/${DIST}.zip >> ${_logdir}/pear_install.log 2>&1 if [[ $? -gt 0 ]] ; then _err_msg="Download from '${PEAR_EXT}-${DIST}.zip' https://github.com/pear' failed!" if [[ "$PEAR_EXT" = "Mail_mimeDecode" ]]; then DIST="PHP_4_0_7" else DIST=trunk fi echo "wget -O /tmp/${PEAR_EXT}-${DIST}.zip https://github.com/pear/${PEAR_EXT}/archive/${DIST}.zip" >> ${_logdir}/pear_install.log wget -O /tmp/${PEAR_EXT}-${DIST}.zip https://github.com/pear/${PEAR_EXT}/archive/${DIST}.zip >> ${_logdir}/pear_install.log 2>&1 if [[ $? -gt 0 ]] ; then _failed=true echo_failed error "$_err_msg \n\t Download from '${PEAR_EXT}-${DIST}.zip' https://github.com/pear' failed! \n\t See logfile '${_logdir}/pear_install.log'" fi fi if ! $_failed ; then echo "unzip -o -d /tmp /tmp/${PEAR_EXT}-${DIST}.zip" >> ${_logdir}/pear_install.log unzip -o -d /tmp /tmp/${PEAR_EXT}-${DIST}.zip >> ${_logdir}/pear_install.log 2>&1 if [[ $? -gt 0 ]] ; then echo_failed error "Unpacking downloaded pear extension '${PEAR_EXT}' failed! \n\t See logfile '${_logdir}/pear_install.log'" else echo "pear install /tmp/${PEAR_EXT}-${DIST}/package.xml" >> ${_logdir}/pear_install.log pear install /tmp/${PEAR_EXT}-${DIST}/package.xml >> ${_logdir}/pear_install.log 2>&1 if [[ $? -gt 0 ]] ; then echo_failed error "'pear install /tmp/${PEAR_EXT}-${DIST}/package.xml' failed! \n\t See logfile '${_logdir}/pear_install.log'" else echo_ok fi fi fi fi done ## - Configure php.ini (base) ## - echo "" echo "" echo -e "\t---" echo -e "\t--- Configure php.ini (base)" echo -e "\t---" echo "" ## - set date.timezon = "Europe/Berlin" ## - echononl "\tphp.ini: date.timezone = \"Europe/Berlin\"" _key="date.timezone" _val="Europe/Berlin" if grep -e "^\s*${_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then perl -i -n -p -e "s#^(\s*${_key}\s*=.*)#;\1\n${_key} = \"${_val}\"#" $PHP_INI_FILE _retval=$? elif grep -e "^\s*;\s*${_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then sed -i "0,/^\([ \t]*;[ \t]*${_key}[ \t]*=.*\)/ s##\1\n${_key} = \"${_val}\"\n#" $PHP_INI_FILE #perl -i -n -p -e "s#^(\s*;\s*${_key}\s*=.*)#\1\n${_key} = ${_val}#" $PHP_INI_FILE _retval=$? fi if [ "$_retval" = "0" ]; then echo_ok else echo_failed fi ## - set short_open_tag = On ## - echononl "\tphp.ini: short_open_tag = On" _key="short_open_tag" _val="Off" if grep -e "^\s*${_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then perl -i -n -p -e "s#^(\s*${_key}\s*=.*)#;\1\n${_key} = ${_val}#" $PHP_INI_FILE _retval=$? elif grep -e "^\s*;\s*${_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then sed -i "0,/^\([ \t]*;[ \t]*${_key}[ \t]*=.*\)/ s##\1\n${_key} = \"${_val}\"\n#" $PHP_INI_FILE #perl -i -n -p -e "s#^(\s*;\s*${_key}\s*=.*)#\1\n${_key} = ${_val}#" $PHP_INI_FILE _retval=$? fi if [ "$_retval" = "0" ]; then echo_ok else echo_failed fi ## - set memory_limit = $MEMORY_LIMIT ## - echononl "\tphp.ini: memory_limit = $MEMORY_LIMIT" _key="memory_limit" _val=$MEMORY_LIMIT if grep -e "^\s*${_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then perl -i -n -p -e "s#^(\s*${_key}\s*=.*)#;\1\n${_key} = ${_val}#" $PHP_INI_FILE _retval=$? elif grep -e "^\s*;\s*${_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then sed -i "0,/^\([ \t]*;[ \t]*${_key}[ \t]*=.*\)/ s##\1\n${_key} = \"${_val}\"\n#" $PHP_INI_FILE #perl -i -n -p -e "s#^(\s*;\s*${_key}\s*=.*)#\1\n${_key} = ${_val}#" $PHP_INI_FILE _retval=$? fi if [ "$_retval" = "0" ]; then echo_ok else echo_failed fi ## - set max_execution_time = $MAX_EXECUTION_TIME ## - echononl "\tphp.ini: max_execution_time = $MAX_EXECUTION_TIME" _key="max_execution_time" _val=$MAX_EXECUTION_TIME if grep -e "^\s*${_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then perl -i -n -p -e "s#^(\s*${_key}\s*=.*)#;\1\n${_key} = ${_val}#" $PHP_INI_FILE _retval=$? elif grep -e "^\s*;\s*${_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then sed -i "0,/^\([ \t]*;[ \t]*${_key}[ \t]*=.*\)/ s##\1\n${_key} = \"${_val}\"\n#" $PHP_INI_FILE #perl -i -n -p -e "s#^(\s*;\s*${_key}\s*=.*)#\1\n${_key} = ${_val}#" $PHP_INI_FILE _retval=$? fi if [ "$_retval" = "0" ]; then echo_ok else echo_failed fi ## - set max_input_time = $MAX_INPUT_TIME ## - echononl "\tphp.ini: max_input_time = $MAX_INPUT_TIME" _key="max_input_time" _val=$MAX_INPUT_TIME if grep -e "^\s*${_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then perl -i -n -p -e "s#^(\s*${_key}\s*=.*)#;\1\n${_key} = ${_val}#" $PHP_INI_FILE _retval=$? elif grep -e "^\s*;\s*${_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then sed -i "0,/^\([ \t]*;[ \t]*${_key}[ \t]*=.*\)/ s##\1\n${_key} = \"${_val}\"\n#" $PHP_INI_FILE #perl -i -n -p -e "s#^(\s*;\s*${_key}\s*=.*)#\1\n${_key} = ${_val}#" $PHP_INI_FILE _retval=$? fi if [ "$_retval" = "0" ]; then echo_ok else echo_failed fi ## - set error_log = ${FPM_LOG_DIR}/php_errors.log ## - echononl "\tphp.ini: error_log = ${FPM_LOG_DIR}/php_errors.log" _key="error_log" _val="${FPM_LOG_DIR}/php_errors.log" if grep -e "^\s*${_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then perl -i -n -p -e "s#^(\s*${_key}\s*=.*)#;\1\n${_key} = ${_val}#" $PHP_INI_FILE _retval=$? elif grep -e "^\s*;\s*${_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then sed -i "0,/^\([ \t]*;[ \t]*${_key}[ \t]*=.*\)/ s##\1\n${_key} = \"${_val}\"\n#" $PHP_INI_FILE #perl -i -n -p -e "s#^(\s*;\s*${_key}\s*=.*)#\1\n${_key} = ${_val}#" $PHP_INI_FILE _retval=$? fi if [ "$_retval" = "0" ]; then echo_ok else echo_failed fi if [[ ! -d "$(dirname "$_val")" ]] ; then echononl "\tCretae directory '$(dirname "$_val")'.." mkdir "$(dirname "$_val")" > /dev/null 2>&1 if [[ $? -eq 0 ]] ; then echo_ok else echo_failed fi fi touch $_val chown ${HTTPD_USER}:$HTTPD_GROUP $_val ## - set upload_max_filesize = $UPLOAD_MAX_FILESIZE ## - echononl "\tphp.ini: upload_max_filesize = $UPLOAD_MAX_FILESIZE" _key="upload_max_filesize" _val="$UPLOAD_MAX_FILESIZE" if grep -e "^\s*${_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then perl -i -n -p -e "s#^(\s*${_key}\s*=.*)#;\1\n${_key} = ${_val}#" $PHP_INI_FILE _retval=$? elif grep -e "^\s*;\s*${_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then sed -i "0,/^\([ \t]*;[ \t]*${_key}[ \t]*=.*\)/ s##\1\n${_key} = \"${_val}\"\n#" $PHP_INI_FILE #perl -i -n -p -e "s#^(\s*;\s*${_key}\s*=.*)#\1\n${_key} = ${_val}#" $PHP_INI_FILE _retval=$? fi if [ "$_retval" = "0" ]; then echo_ok else echo_failed fi ## - set post_max_size = $POST_MAX_SIZE ## - echononl "\tphp.ini: post_max_size = $POST_MAX_SIZE" _key="post_max_size" _val="$POST_MAX_SIZE" if grep -e "^\s*${_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then perl -i -n -p -e "s#^(\s*${_key}\s*=.*)#;\1\n${_key} = ${_val}#" $PHP_INI_FILE _retval=$? elif grep -e "^\s*;\s*${_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then sed -i "0,/^\([ \t]*;[ \t]*${_key}[ \t]*=.*\)/ s##\1\n${_key} = \"${_val}\"\n#" $PHP_INI_FILE #perl -i -n -p -e "s#^(\s*;\s*${_key}\s*=.*)#\1\n${_key} = ${_val}#" $PHP_INI_FILE _retval=$? fi if [ "$_retval" = "0" ]; then echo_ok else echo_failed fi ## - set max_file_uploads = 50 ## - echononl "\tphp.ini: max_file_uploads = 50" _key="max_file_uploads" _val=50 if grep -e "^\s*${_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then perl -i -n -p -e "s#^(\s*${_key}\s*=.*)#;\1\n${_key} = ${_val}#" $PHP_INI_FILE _retval=$? elif grep -e "^\s*;\s*${_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then sed -i "0,/^\([ \t]*;[ \t]*${_key}[ \t]*=.*\)/ s##\1\n${_key} = \"${_val}\"\n#" $PHP_INI_FILE #perl -i -n -p -e "s#^(\s*;\s*${_key}\s*=.*)#\1\n${_key} = ${_val}#" $PHP_INI_FILE _retval=$? fi if [ "$_retval" = "0" ]; then echo_ok else echo_failed fi ## - set always_populate_raw_post_data = -1 ## - echononl "\tphp.ini: always_populate_raw_post_data = -1" _key="always_populate_raw_post_data" _val=-1 if grep -e "^\s*${_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then perl -i -n -p -e "s#^(\s*${_key}\s*=.*)#;\1\n${_key} = ${_val}#" $PHP_INI_FILE _retval=$? elif grep -e "^\s*;\s*${_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then sed -i "0,/^\([ \t]*;[ \t]*${_key}[ \t]*=.*\)/ s##\1\n${_key} = \"${_val}\"\n#" $PHP_INI_FILE #perl -i -n -p -e "s#^(\s*;\s*${_key}\s*=.*)#\1\n${_key} = ${_val}#" $PHP_INI_FILE _retval=$? fi if [ "$_retval" = "0" ]; then echo_ok else echo_failed fi ## - set expose_php = Off ## - _key="expose_php" _val="Off" echononl "\tphp.ini: $_key = $_val" if grep -e "^\s*${_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then perl -i -n -p -e "s#^(\s*${_key}\s*=.*)#;\1\n${_key} = ${_val}#" $PHP_INI_FILE _retval=$? elif grep -e "^\s*;\s*${_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then sed -i "0,/^\([ \t]*;[ \t]*${_key}[ \t]*=.*\)/ s##\1\n${_key} = \"${_val}\"\n#" $PHP_INI_FILE #perl -i -n -p -e "s#^(\s*;\s*${_key}\s*=.*)#\1\n${_key} = ${_val}#" $PHP_INI_FILE _retval=$? fi if [ "$_retval" = "0" ]; then echo_ok else echo_failed fi ## ----- ## - END: Configure php.ini (base) ## ----- ## ----- ## - configure OPCache ## ----- zend_extension_opcache=$(find ${PREFIX_PHP}/lib/php/extensions -name opcache.so -print) if [[ -n "$zend_extension_opcache" ]];then echononl "\tphp.ini: zend_extension = \"$zend_extension_opcache\" .." perl -i -n -p -e "s#^(\s*\[PHP\]\s*)#\1\nzend_extension = ${zend_extension_opcache}\n#" $PHP_INI_FILE #sed -i "s/^/\nzend_extension = ${zend_extension_opcache}\n\n/" $PHP_INI_FILE if [ "$?" = "0" ]; then echo_ok else echo_failed fi ## - set opcache.error_log="/var/log/apache2/ ## - echononl "\tphp.ini: opcache.error_log = /var/log/apache2/opcache_errors.log" _key="opcache.error_log" _val="/var/log/apache2/opcache_errors.log" if grep -e "^\s*${_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then perl -i -n -p -e "s#^(\s*${_key}\s*=.*)#;\1\n${_key} = ${_val}#" $PHP_INI_FILE _retval=$? elif grep -e "^\s*;\s*${_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then sed -i "0,/^\([ \t]*;[ \t]*${_key}[ \t]*=.*\)/ s##\1\n${_key} = \"${_val}\"\n#" $PHP_INI_FILE #perl -i -n -p -e "s#^(\s*;\s*${_key}\s*=.*)#\1\n${_key} = ${_val}#" $PHP_INI_FILE _retval=$? fi if [ "$_retval" = "0" ]; then echo_ok else echo_failed fi if [[ ! -d "$(dirname "$_val")" ]] ; then echononl "\tCretae directory '$(dirname "$_val")'.." mkdir "$(dirname "$_val")" > /dev/null 2>&1 if [[ $? -eq 0 ]] ; then echo_ok else echo_failed fi fi touch $_val chown ${HTTPD_USER}:$HTTPD_GROUP $_val ## - set opcache.enable=1 ## - echononl "\tphp.ini: opcache.enable = 1 .." opcache_key="opcache.enable" opcache_val=1 if grep -e "^\s*${opcache_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then perl -i -n -p -e "s#^(\s*${opcache_key}\s*=.*)#;\1\n*${opcache_key} = ${opcache_val}#" $PHP_INI_FILE _retval=$? elif grep -e "^\s*;\s*${opcache_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then perl -i -n -p -e "s#^(\s*;${opcache_key}\s*=.*)#\1\n${opcache_key} = ${opcache_val}#" $PHP_INI_FILE _retval=$? fi if [ "$_retval" = "0" ]; then echo_ok else echo_failed fi ## - set opcache.enable_cli=1 ## - echononl "\tphp.ini: opcache.enable_cli = 1 .." opcache_key="opcache.enable_cli" opcache_val=1 if grep -e "^\s*${opcache_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then perl -i -n -p -e "s#^(\s*${opcache_key}\s*=.*)#;\1\n*${opcache_key} = ${opcache_val}#" $PHP_INI_FILE _retval=$? elif grep -e "^\s*;\s*${opcache_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then perl -i -n -p -e "s#^(\s*;${opcache_key}\s*=.*)#\1\n${opcache_key} = ${opcache_val}#" $PHP_INI_FILE _retval=$? fi if [ "$_retval" = "0" ]; then echo_ok else echo_failed fi ## - set opcache.interned_strings_buffer=8 ## - echononl "\tphp.ini: opcache.interned_strings_buffer = 8 .." opcache_key="opcache.interned_strings_buffer" opcache_val=8 if grep -e "^\s*${opcache_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then perl -i -n -p -e "s#^(\s*${opcache_key}\s*=.*)#;\1\n*${opcache_key} = ${opcache_val}#" $PHP_INI_FILE _retval=$? elif grep -e "^\s*;\s*${opcache_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then perl -i -n -p -e "s#^(\s*;${opcache_key}\s*=.*)#\1\n${opcache_key} = ${opcache_val}#" $PHP_INI_FILE _retval=$? fi if [ "$_retval" = "0" ]; then echo_ok else echo_failed fi ## - set opcache.max_accelerated_files=4000 ## - echononl "\tphp.ini: opcache.max_accelerated_files = 10000 .." opcache_key="opcache.max_accelerated_files" opcache_val=10000 if grep -e "^\s*${opcache_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then perl -i -n -p -e "s#^(\s*${opcache_key}\s*=.*)#;\1\n*${opcache_key} = ${opcache_val}#" $PHP_INI_FILE _retval=$? elif grep -e "^\s*;\s*${opcache_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then perl -i -n -p -e "s#^(\s*;${opcache_key}\s*=.*)#\1\n${opcache_key} = ${opcache_val}#" $PHP_INI_FILE _retval=$? fi if [ "$_retval" = "0" ]; then echo_ok else echo_failed fi ## - set opcache.validate_timestamps=1 ## - echononl "\tphp.ini: opcache.validate_timestamps = 1 .." opcache_key="opcache.validate_timestamps" opcache_val=1 if grep -e "^\s*${opcache_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then perl -i -n -p -e "s#^(\s*${opcache_key}\s*=.*)#;\1\n*${opcache_key} = ${opcache_val}#" $PHP_INI_FILE _retval=$? elif grep -e "^\s*;\s*${opcache_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then perl -i -n -p -e "s#^(\s*;${opcache_key}\s*=.*)#\1\n${opcache_key} = ${opcache_val}#" $PHP_INI_FILE _retval=$? fi if [ "$_retval" = "0" ]; then echo_ok else echo_failed fi ## - set opcache.memory_consumption=128 ## - echononl "\tphp.ini: opcache.memory_consumption = 1 .." opcache_key="opcache.memory_consumption" opcache_val=128 if grep -e "^\s*${opcache_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then perl -i -n -p -e "s#^(\s*${opcache_key}\s*=.*)#;\1\n*${opcache_key} = ${opcache_val}#" $PHP_INI_FILE _retval=$? elif grep -e "^\s*;\s*${opcache_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then perl -i -n -p -e "s#^(\s*;${opcache_key}\s*=.*)#\1\n${opcache_key} = ${opcache_val}#" $PHP_INI_FILE _retval=$? fi if [ "$_retval" = "0" ]; then echo_ok else echo_failed fi ## - set opcache.save_comments=1 ## - echononl "\tphp.ini: opcache.save_comments = 1 .." opcache_key="opcache.save_comments" opcache_val=1 if grep -e "^\s*${opcache_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then perl -i -n -p -e "s#^(\s*${opcache_key}\s*=.*)#;\1\n*${opcache_key} = ${opcache_val}#" $PHP_INI_FILE _retval=$? elif grep -e "^\s*;\s*${opcache_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then perl -i -n -p -e "s#^(\s*;${opcache_key}\s*=.*)#\1\n${opcache_key} = ${opcache_val}#" $PHP_INI_FILE _retval=$? fi if [ "$_retval" = "0" ]; then echo_ok else echo_failed fi ## - set opcache.revalidate_freq=1 ## - echononl "\tphp.ini: opcache.revalidate_freq = 1 .." opcache_key="opcache.revalidate_freq" opcache_val=1 if grep -e "^\s*${opcache_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then perl -i -n -p -e "s#^(\s*${opcache_key}\s*=.*)#;\1\n*${opcache_key} = ${opcache_val}#" $PHP_INI_FILE _retval=$? elif grep -e "^\s*;\s*${opcache_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then perl -i -n -p -e "s#^(\s*;${opcache_key}\s*=.*)#\1\n${opcache_key} = ${opcache_val}#" $PHP_INI_FILE _retval=$? fi if [ "$_retval" = "0" ]; then echo_ok else echo_failed fi ## - set opcache.fast_shutdown=0 ## - ## - setting opcache.fast_shutdown=1 causes the following error in apache error_log: ## - ## - zend_mm_heap corrupted ## - ## - sometimes un conjunction with ## - ## - [Sun May 11 23:02:25.120263 2014] [core:warn] [pid 11566:tid 139746681894656] ## - AH00045: child process 28405 still did not exit, sending a SIGTERM ## - echononl "\tphp.ini: opcache.fast_shutdown = 0 .." opcache_key="opcache.fast_shutdown" opcache_val=0 if grep -e "^\s*${opcache_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then perl -i -n -p -e "s#^(\s*${opcache_key}\s*=.*)#;\1\n*${opcache_key} = ${opcache_val}#" $PHP_INI_FILE _retval=$? elif grep -e "^\s*;\s*${opcache_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then perl -i -n -p -e "s#^(\s*;${opcache_key}\s*=.*)#\1\n${opcache_key} = ${opcache_val}#" $PHP_INI_FILE _retval=$? fi if [ "$_retval" = "0" ]; then echo_ok else echo_failed fi fi ## ----- ## - END: configure OPCache ## ----- ## ----- ## - Reenable crontab ## ----- echo echononl "\tReenable crontab for user root .." crontab -u root $_CRONTAB_BAKUP_FILE > $tmp_err_msg 2>&1 if [ "$?" = "0" ]; then echo_ok else echo_failed error "$(cat $tmp_err_msg)" fi echononl "\tRemove crontab backup file .." rm -f $_CRONTAB_BAKUP_FILE > $tmp_err_msg 2>&1 if [ "$?" = "0" ]; then echo_ok else echo_failed error "$(cat $tmp_err_msg)" fi ## ----- ## - End: Reenable crontab ## ----- ## ----- ## - Start PHP-FPM Engine if requested ## ----- echo "" echononl "\tStarting PHP-FPM Engine (v${PHP_MAIN_VERSION}).." if $ACTIVATE_PHP_FPM_INIT_SCRIPT ; then if $SYSTEMD_EXISTS ; then systemctl start php-${PHP_MAIN_VERSION}-fpm > /dev/null 2>&1 if [[ "$?" = "0" ]]; then echo_ok else echo_failed error "Starting PHP-FPM Engine failed!" fi else $FPM_INIT_SCRIPT start > /dev/null 2>&1 if [[ "$?" = "0" ]]; then echo_ok else echo_failed error "Starting PHP-FPM Engine failed!" fi fi fi ## ----- ## - Rename /etc/mysql/my.cnf if MySQL was not installed from debian package system. ## ----- if [[ -d "/usr/local/mysql" ]]; then if [[ -f "/etc/mysql/my.cnf" ]] && [[ ! -h "/etc/mysql/my.cnf" ]]; then echo echononl "\tRename '/etc/mysql/my.cnf' to '/etc/mysql/my.cnf.DEBIAN'.." mv "/etc/mysql/my.cnf" "/etc/mysql/my.cnf.DEBIAN" > $tmp_err_msg 2>&1 if [[ $? -eq 0 ]]; then echo_ok else echo_failed error "$(cat $tmp_err_msg)" fi fi fi cd $pwd cat<