mod_php_install.sh: add channel update for 'pear.php.net' befor installing pear extensions.

This commit is contained in:
2026-01-10 01:53:07 +01:00
parent e062c4cb79
commit fc1cf962bd

View File

@@ -19,7 +19,7 @@ _HTTPD_USER=www-data
_srcdir=$(dirname $(realpath $0))
_pwd=`pwd`
CUR_PWD="$(pwd)"
cert_URL_php_net="https://curl.haxx.se/ca/cacert.pem"
_default_cert_file=""
@@ -260,7 +260,7 @@ _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
@@ -282,7 +282,7 @@ _required_base_packages="$_required_base_packages
libqdbm-dev libgdbm-dev libpspell-dev
libjpeg-dev libxpm-dev libfreetype6-dev
libwmf-dev libtiff-dev libpaper-dev
libmagic-dev
libmagic-dev
libmagick-dev libgraphics-magick-perl
libgraphicsmagick++1-dev libgraphicsmagick1-dev
libgraphviz-dev libgsf-1-dev libilmbase-dev
@@ -293,7 +293,7 @@ _required_base_packages="$_required_base_packages
re2c
sqlite3
exif libexiv2-dev
netpbm
netpbm
libnetpbm-dev
libmcrypt-dev mcrypt
libwebp-dev
@@ -303,7 +303,7 @@ _required_base_packages="$_required_base_packages
libicu-dev
libtidy-dev
libmm-dev libgmp-dev libkrb5-dev libldap-dev
libmhash-dev
libmhash-dev
libapr1-dev libaprutil1-dev
liblua5.1-0 liblua5.1-0-dev
libsctp-dev
@@ -322,7 +322,7 @@ if [[ "$os_dist" = "debian" ]] && [[ $os_version -lt 13 ]] ; then
libc-client-dev"
fi
# Package libpcre3-dev is not availabl at debian 13, but libpcre2-dev is
# Package libpcre3-dev is not availabl at debian 13, but libpcre2-dev is
# available there.
#
if [[ "$os_dist" = "debian" ]] && [[ $os_version -lt 13 ]] ; then
@@ -332,7 +332,7 @@ else
_required_base_packages="$_required_base_packages
libpcre2-dev"
fi
# - Package libgraphicsmagick++3 is not available at ubunru 18.04"
# -
@@ -960,7 +960,7 @@ if $WITH_PHP_FPM_SUPPORT ; then
# Get existing FPM pool definitions
#
for _file in $(ls "/usr/local/php-${PHP_MAIN_VERSION}/etc/fpm.d/") ; do
for _file in $(ls "/usr/local/php-${PHP_MAIN_VERSION}/etc/fpm.d/") ; do
[[ "${_file}" =~ conf$ ]] || continue
[[ "${_file}" = "www-${PHP_MAIN_VERSION}.php-fpm.conf" ]] && continue
php_fpm_pool_definition_file_arr+=("${_file}")
@@ -1310,7 +1310,7 @@ echo ""
echo ""
echo -e "Set value for Parameter \033[32m${_key}\033[m (int)"
echo ""
echo " How often to check script timestamps for updates, in seconds."
echo " How often to check script timestamps for updates, in seconds."
echo " 0 will result in OPcache checking for updates on every request."
echo ""
echo " This configuration directive is ignored if opcache.validate_timestamps"
@@ -1345,7 +1345,7 @@ echo ""
echo ""
echo -e "Set value for Parameter \033[32m${_key}\033[m (bool)"
echo ""
echo " If enabled, OPcache will check for updated scripts every opcache.revalidate_freq seconds."
echo " If enabled, OPcache will check for updated scripts every opcache.revalidate_freq seconds."
echo " When this directive is disabled, you must reset OPcache manually via opcache_reset(),"
echo " opcache_invalidate() or by restarting the Web server for changes to the filesystem"
echo " to take effect."
@@ -1396,7 +1396,7 @@ echo ""
echo ""
echo -e "Set value for Parameter \033[32m${_key}\033[m (bool)"
echo ""
echo " If enabled, OPcache will check for updated scripts every opcache.revalidate_freq seconds."
echo " If enabled, OPcache will check for updated scripts every opcache.revalidate_freq seconds."
echo " When this directive is disabled, you must reset OPcache manually via opcache_reset(),"
echo " opcache_invalidate() or by restarting the Web server for changes to the filesystem"
echo " to take effect."
@@ -1491,13 +1491,13 @@ echo ""
echononl "Eingabe: "
while [[ -z "$_CHOOSE" ]]; do
read OPTION
[[ -z "$OPTION" ]] && OPTION=$__higlighted
[[ -z "$OPTION" ]] && OPTION=$__higlighted
case $OPTION in
1)
1)
_CHOOSE=1
OPCACHE_ERROR_LOG="/var/log/apache2/opcache_errors.log"
;;
2)
2)
_CHOOSE=2
OPCACHE_ERROR_LOG="/var/log/nginx/opcache_errors.log"
;;
@@ -1872,7 +1872,7 @@ fi
echo ""
if [ ! -h /usr/local/php-${PHP_MAIN_VERSION} ] ; then
SYMLINK_PHP_MAIN_VERSION=true
SYMLINK_PHP_MAIN_VERSION=true
echo "Symlink /usr/local/php-$PHP_MAIN_VERSION -> `basename $PREFIX_PHP` will be set."
else
OK=""
@@ -1961,7 +1961,7 @@ FPM_DEFAULT_POOL_ACCESS_FORMAT="\"%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo
FPM_ULIMIT_MAX_FILES=`su -c "ulimit -H -n" -s /bin/bash $_PHP_FPM_USER`
echo ""
@@ -2301,7 +2301,7 @@ if $WITH_PHP_FPM_SUPPORT ; then
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"
@@ -2332,7 +2332,7 @@ if $SYMLINK_PHP_MAIN_VERSION -o $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`"
echo " /usr/local/php-$PHP_MAIN_VERSION -> `basename $PREFIX_PHP`"
fi
fi
echo ""
@@ -2405,7 +2405,7 @@ if $WITH_PHP_FPM_SUPPORT ; then
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
if [[ "$(basename "$_file")" = "${FPM_DEFAULT_POOL}.php-fpm.conf" ]]; then
FPM_DEFAULT_POOL_DEFINITION_EXISTS=true
fi
existing_fpm_definition_arr+=("$(realpath "$_file")")
@@ -2416,7 +2416,7 @@ if $WITH_PHP_FPM_SUPPORT ; then
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
if [[ "$(basename "$_file")" = "${FPM_DEFAULT_POOL}.php-fpm.conf" ]]; then
FPM_DEFAULT_POOL_DEFINITION_EXISTS=true
fi
existing_fpm_definition_arr+=("$(realpath "$_file")")
@@ -2632,7 +2632,7 @@ if $_install_freetype && [[ ! -d /usr/local/freetype-$FREETYPE_VERSION ]]; then
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
@@ -2851,7 +2851,7 @@ if $_install_icu4c && [[ ! -d /usr/local/icu4c-$ICU4C_VERSION ]]; then
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
@@ -3113,7 +3113,7 @@ if $_install_python2 && [[ ! -d /usr/local/python-$PYTHON2_VERSION ]]; then
done
[[ $OK = "yes" ]] || fatal "Interupted by user"
fi
echononl "\tGoing to compile python v${PYTHON2_VERSION} .."
make > ${_logdir}/python2-make.log 2>&1
if [ "$?" = "0" ]; then
@@ -3335,7 +3335,7 @@ if $_install_libxml2 && [[ ! -d /usr/local/libxml2-$LIBXML2_VERSION ]]; then
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
@@ -3438,7 +3438,7 @@ if $_install_openssl1 && [[ ! -d /usr/local/openssl-$OPENSSL1_VERSION ]]; then
_NAME="openssl"
_VERSION="${OPENSSL1_VERSION}"
_archive_file="openssl-${_VERSION}.tgz"
_download_url="https://www.openssl.org/source/openssl-${_VERSION}.tar.gz"
@@ -3588,7 +3588,7 @@ if $_install_openssl1 && [[ ! -d /usr/local/openssl-$OPENSSL1_VERSION ]]; then
fi
fi
echononl "\tGoing to compile ${_NAME} ${_VERSION} .."
make > ${_logdir}/${_NAME}-make.log 2>&1
if [ "$?" = "0" ]; then
@@ -3678,7 +3678,7 @@ fi
## - Set Symlink
## - Set Symlink
## - /usr/include/x86_64-linux-gnu/gmp.h -> /usr/include/gmp.h
## - if not exists
## -
@@ -3694,7 +3694,7 @@ if [ -f "/usr/include/x86_64-linux-gnu/gmp.h" -a ! -e "/usr/include/gmp.h" ]; th
echo ""
fi
## - Set Symlink
## - Set Symlink
## - /usr/lib/x86_64-linux-gnu/libldap.so -> /usr/lib/libldap.so
## - if not exists
## -
@@ -3710,7 +3710,7 @@ if [ -f "/usr/lib/x86_64-linux-gnu/libldap.so" -a ! -e "/usr/lib/libldap.so" ];
echo ""
fi
## - Set Symlink
## - Set Symlink
## - /usr/lib/x86_64-linux-gnu/libXpm.so -> /usr/lib/libXpm.so
## - if not exists
## -
@@ -3726,7 +3726,7 @@ if [ -f "/usr/lib/x86_64-linux-gnu/libXpm.so" -a ! -e "/usr/lib/libXpm.so" ]; th
echo ""
fi
## - Set Symlink
## - Set Symlink
## - /usr/include/x86_64-linux-gnu/curl -> /usr/include/curl
## - if not exists
## -
@@ -3899,7 +3899,7 @@ if [ ! -f ${_srcdir}/php-$VERSION.tar.bz2 ]; then
[[ $OK = "yes" ]] || fatal "Interupted by user"
fi
fi
fi
else
echo_failed
error "Cannot add certificates to ca-certificates file."
@@ -3964,7 +3964,7 @@ if [[ "$os_dist" = "debian" ]] && [[ $os_version -gt 11 ]] && [[ $PHP_MAJOR_VER
fatal "Can't find patchfile '${_srcdir}/PHP-7.4-OpenSSL-3.0-compatibility.patch'"
fi
elif [[ "$os_dist" = "debian" ]] && [[ $os_version -gt 11 ]] && ([[ $PHP_MAJOR_VERSION -eq 8 ]] \
&& [[ $PHP_MINOR_VERSION -eq 0 ]]); then
&& [[ $PHP_MINOR_VERSION -eq 0 ]]); then
if [[ -f ${_srcdir}/PHP-8.0-OpenSSL-3.0-compatibility.patch ]] ; then
patch -d $_builddir/ext -p 0 < ${_srcdir}/PHP-8.0-OpenSSL-3.0-compatibility.patch > $tmp_err_msg 2>&1
if [[ $? -eq 0 ]]; then
@@ -3998,7 +3998,7 @@ cd $_builddir || exit 1
echononl "\tGoing to configure.."
# : ${_arch:=i686}
# : ${_arch:=athlon}
# : ${_arch:=athlon}
# : ${_arch:=k8} ## --> x86-64 instructionset
##_cflags="-O2 -march=$_arch "
@@ -4103,7 +4103,7 @@ else
--with-jpeg-dir
--with-xpm-dir
--enable-zip
--enable-wddx
--enable-wddx
"
if [[ "$os_dist" = "debian" ]] && [[ $os_version -lt 10 ]] ; then
config_params="$config_params
@@ -4137,9 +4137,9 @@ if $SYSTEMD_EXISTS ; then
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.
## -
## - '--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
@@ -4229,7 +4229,7 @@ fi
## --with-memcache \
## --with-xml \
echononl "\tGoing to compile.."
make > ${_logdir}/php-make.log 2>&1
if [ "$?" = "0" ]; then
@@ -4314,7 +4314,7 @@ if [[ "${FPM_RUN_DIR}" =~ ^/run/ ]] ; then
# systemd tmpfile settings for php fpm
d $FPM_RUN_DIR 0755 $FPM_DEFAULT_POOL_USER $FPM_DEFAULT_POOL_GROUP -
EOF" >> ${_logdir}/main.log
cat <<EOF > /etc/tmpfiles.d/php-fpm.conf
cat <<EOF > /etc/tmpfiles.d/php-fpm.conf
# systemd tmpfile settings for php fpm
d $FPM_RUN_DIR 0755 $FPM_DEFAULT_POOL_USER $FPM_DEFAULT_POOL_GROUP -
EOF
@@ -4373,7 +4373,7 @@ if ! $WITHOUT_APACHE_MOD_PHP ; then
echo_failed
fi
fi
fi
@@ -4686,7 +4686,7 @@ if $WITH_PHP_FPM_SUPPORT ; then
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
@@ -4697,7 +4697,7 @@ if $WITH_PHP_FPM_SUPPORT ; then
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
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
@@ -5251,11 +5251,11 @@ EOF
# - 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
cp "$_file" "${PREFIX_PHP}/etc/${FPM_POOL_CONF_DIR}/" > /dev/null 2>&1
if [ "$?" = "0" ]; then
echo_ok
else
@@ -5291,7 +5291,7 @@ EOF
else
echo_failed
fi
key="pm.min_spare_servers"
value="$FPM_POOL_MIN_SPARE"
echononl "\tPHP FPM Pool - Set Definition '${key}'.."
@@ -5942,7 +5942,7 @@ if [[ $PHP_MAJOR_VERSION -lt 7 ]] ; then
echo_failed
error "See log file: ${_logdir}/pecl_install.log"
fi
else
echo "" >> ${_logdir}/pecl_install.log
@@ -6320,7 +6320,7 @@ if [[ -z "$_MagickWand_config" ]] || [[ ! -f "$(realpath "$_MagickWand_config")"
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
@@ -6359,7 +6359,7 @@ else
_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
@@ -6612,7 +6612,7 @@ if ([[ "$PHP_MAJOR_VERSION" -eq 7 ]] && [[ "$PHP_MINOR_VERSION" -ge 2 ]]) \
else
echo_skipped
fi
fi
@@ -6908,7 +6908,7 @@ if [[ $PHP_MAJOR_VERSION -lt 7 ]] ; then
else
echo_failed
fi
else
printf "\n" | ${PREFIX_PHP}/bin/pecl install raphf >> "${_logdir}/pecl_install.log" 2>&1
if [ "$?" = "0" ]; then
@@ -6991,7 +6991,7 @@ if ([[ "$PHP_MAJOR_VERSION" -eq 8 ]] && [[ "$PHP_MINOR_VERSION" -ge 4 ]]) \
warn "The imap plugin cannot be installed - no imap library was found. "
fi
else
echo_skipped
fi
@@ -7033,7 +7033,7 @@ if [[ $PHP_MAJOR_VERSION -lt 7 ]] ; then
else
echo_failed
fi
else
echo "printf \"\\n\" | ${PREFIX_PHP}/bin/pecl install propro" >> ${_logdir}/pecl_install.log
@@ -7071,7 +7071,7 @@ else
_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
@@ -7287,7 +7287,7 @@ if [[ $PHP_MAJOR_VERSION -lt 7 ]] ; then
else
echo_failed
fi
elif [[ $PHP_MAJOR_VERSION -lt 8 ]] ; then
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
@@ -7531,7 +7531,7 @@ else
echo_failed
fi
info "Enable xdebug extension by commenting in the apropriate line at top of php.ini file"
info "Enable xdebug extension by commenting in the apropriate line at top of php.ini file"
## -----
## - END: Install xdebug
@@ -7548,6 +7548,54 @@ echo ""
> ${_logdir}/pear_install.log
echo "" >> ${_logdir}/pear_install.log
echo "# - Change into TMP dir '/tmp'" >> ${_logdir}/pear_install.log
echo "# -" >> ${_logdir}/pear_install.log
echo "cd /tmp" >> ${_logdir}/pear_install.log
echononl "\tChange into TMP dir '/tmp'.."
cd /tmp >> ${_logdir}/pear_install.log 2>&1
if [[ $? -gt 0 ]] ; then
echo_failed
error "Changinginto TMP dir '/tmp' failed! \n\t See logfile '${_logdir}/pear_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/no]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Interupted by user"
else
echo_ok
fi
echo "" >> ${_logdir}/pear_install.log
echo "# - Update channel 'pear.php.net'.." >> ${_logdir}/pear_install.log
echo "# -" >> ${_logdir}/pear_install.log
echo "${PREFIX_PHP}/bin/pear channel-update pear.php.net" >> ${_logdir}/pear_install.log
echononl "\tUpdate channel 'pear.php.net'.."
${PREFIX_PHP}/bin/pear channel-update pear.php.net >> ${_logdir}/pear_install.log 2>&1
if [[ $? -gt 0 ]] ; then
echo_failed
error "Updating channel 'pear.php.net' failed! \n\t See logfile '${_logdir}/pear_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/no]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Interupted by user"
else
echo_ok
fi
PEAR_EXT="Net_Socket"
echo "" >> ${_logdir}/pear_install.log
echo "# - Install ${PEAR_EXT} via pear.." >> ${_logdir}/pear_install.log
@@ -8369,7 +8417,7 @@ if [[ -n "$zend_extension_opcache" ]];then
## -
## - sometimes un conjunction with
## -
## - [Sun May 11 23:02:25.120263 2014] [core:warn] [pid 11566:tid 139746681894656]
## - [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 .."
@@ -8490,18 +8538,18 @@ if [[ -d "/usr/local/mysql" ]]; then
error "$(cat $tmp_err_msg)"
fi
fi
fi
fi
cd $pwd
cd ${CUR_PWD}
cat<<EOF
php.ini
php.ini
=======
You may edit your php.ini file "$PHP_INI_FILE"
to set more PHP options.
You may edit your php.ini file "$PHP_INI_FILE"
to set more PHP options.
EOF