Compare commits

...

2 Commits

Author SHA1 Message Date
221371c23b remove 'install-php56.sh'. 2026-03-04 15:23:50 +01:00
918dcc2912 mod_php_install.sh: Simplify if then else clauses. 2026-03-04 15:23:26 +01:00
2 changed files with 208 additions and 133 deletions

View File

@@ -1,74 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
# Konfiguration
PHP_VERSION="5.6.40"
PHP_SRC="/usr/local/src/php/php-$PHP_VERSION"
ZLIB_PREFIX="/usr/local/zlib-1.2.11"
INSTALL_PREFIX="/usr/local/php56"
# 1. Quelle herunterladen
mkdir -p /usr/local/src/php
cd /usr/local/src/php
if [ ! -f "php-$PHP_VERSION.tar.bz2" ]; then
wget https://www.php.net/distributions/php-$PHP_VERSION.tar.bz2
fi
# 2. Entpacken
if [ ! -d "$PHP_SRC" ]; then
tar -xjf php-$PHP_VERSION.tar.bz2
fi
cd "$PHP_SRC"
# 3. Patches erstellen (Unix-LF)
cat > php56-fileinfo-fix.patch << 'EOF'
--- ext/fileinfo/libmagic/funcs.c
+++ ext/fileinfo/libmagic/funcs.c
@@ -439,7 +439,7 @@
-file_replace(struct magic_set *ms, const char *pat, const char *rep)
+void file_replace(struct magic_set *ms, const char *pat, const char *rep)
EOF
cat > php56-zlib-fix.patch << 'EOF'
--- ext/zlib/zlib.c
+++ ext/zlib/zlib.c
@@
-static void zm_globals_ctor_zlib(zend_zlib_globals *zlib_globals)
+static void zm_globals_ctor_zlib(void *zlib_globals)
+{
+ zend_zlib_globals *globals = (zend_zlib_globals *) zlib_globals;
+ globals->output_compression_default = 0;
+ globals->output_compression = 0;
+ globals->output_handler = NULL;
+}
EOF
cat > php56-mbfl-fix.patch << 'EOF'
--- ext/mbstring/libmbfl/mbfilter/mbfilter.c
+++ ext/mbstring/libmbfl/mbfilter/mbfilter.c
@@
-int mbfl_mbchar_bytes(int c)
+int mbfl_mbchar_bytes(unsigned int c)
EOF
# 4. Sicherstellen, dass Unix-Zeilenenden vorhanden sind
dos2unix php56-fileinfo-fix.patch
dos2unix php56-zlib-fix.patch
dos2unix php56-mbfl-fix.patch
# 5. Patches einspielen
patch -p0 < php56-fileinfo-fix.patch
patch -p0 < php56-zlib-fix.patch
patch -p0 < php56-mbfl-fix.patch
# 6. Configure & Build
make clean || true
./configure --prefix="$INSTALL_PREFIX" --with-zlib="$ZLIB_PREFIX" \
--enable-mbstring --with-openssl --enable-soap --enable-zip
make -j$(nproc)
make install
echo "PHP $PHP_VERSION wurde erfolgreich installiert in $INSTALL_PREFIX"
echo "Führe '$INSTALL_PREFIX/bin/php -v' aus, um die Version zu prüfen."

View File

@@ -114,33 +114,53 @@ 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
detect_os_1() {
if [[ -r /etc/os-release ]]; then
. /etc/os-release
os_dist=$ID
os_version=${os_version_ID}
os_dist="$ID"
os_version="$VERSION_ID"
# Familie bestimmen
if [[ "$ID" == "debian" ]] || [[ "$ID_LIKE" == *"debian"* ]]; then
os_family="debian"
elif [[ "$ID" == "rhel" ]] || [[ "$ID_LIKE" == *"rhel"* ]]; then
os_family="rhel"
elif [[ "$ID" == "arch" ]] || [[ "$ID_LIKE" == *"arch"* ]]; then
os_family="arch"
else
os_family="$ID"
fi
# remove whitespace from os_dist and os_version
os_dist="${os_dist// /}"
os_version="${os_version// /}"
elif which lsb_release > /dev/null 2>&1 ; then
local dist version
dist=$(lsb_release -is 2>/dev/null | tr '[:upper:]' '[:lower:]')
version=$(lsb_release -rs 2>/dev/null | cut -d. -f1) # Major Version
os_dist="$dist"
os_version="$version"
case "$dist" in
debian|ubuntu|linuxmint)
os_family="debian"
;;
rhel|centos|rocky|fedora)
os_family="rhel"
;;
arch)
os_family="arch"
;;
*)
os_family="$dist"
;;
esac
fi
# Nur Major-Version extrahieren (z.B. 12 aus 12.5)
os_version=${os_version%%.*}
}
## ---
## --- END: functions
@@ -258,7 +278,7 @@ fi
# - Set variable
# - os_dist
# - os_version
# - os_codename
# - os_family
# -
detect_os_1
@@ -367,20 +387,15 @@ _required_base_packages="$_required_base_packages
vpx-tools"
# libcroco3-dev
# libc-client-dev is no longer available on debian 13
#
if [[ "$os_dist" = "debian" ]] && [[ $os_version -lt 13 ]] ; then
_required_base_packages="$_required_base_packages
libc-client-dev"
fi
#
# Package libpcre3-dev is not availabl at debian 13, but libpcre2-dev is
# available there.
#
if [[ "$os_dist" = "debian" ]] && [[ $os_version -lt 13 ]] ; then
if [[ "$os_dist" == "debian" ]] && (( os_version < 13 )); then
_required_base_packages="$_required_base_packages
libc-client-dev
libpcre3-dev"
else
_required_base_packages="$_required_base_packages
@@ -395,7 +410,7 @@ if [[ "$os_dist" != "ubuntu" ]] ; then
libgraphicsmagick++3"
fi
if [[ "$os_dist" = "debian" ]] && [[ $os_version -lt 9 ]] ; then
if [[ "$os_dist" == "debian" ]] && (( os_version < 9 )); then
_required_base_packages="$_required_base_packages
libjasper-dev
libpng12-dev"
@@ -410,7 +425,8 @@ else
fi
fi
if [[ "$os_dist" = "debian" ]] && [[ $os_version -eq 7 ]] ; then
if [[ "$os_dist" == "debian" ]] && (( os_version == 7 )); then
_required_base_packages="$_required_base_packages
libgd2-xpm-dev
libdb5.1 libdb5.1++ libdb5.1++-dev libdb5.1-dev"
@@ -509,18 +525,146 @@ PHP_MAIN_VERSION=`echo $VERSION | cut -d '.' -f1,2`
declare -i PHP_MAJOR_VERSION=`echo $VERSION | cut -d '.' -f1`
declare -i PHP_MINOR_VERSION=`echo $VERSION | cut -d '.' -f2`
declare -i PHP_PATCH_LEVEL=`echo $VERSION | cut -d '.' -f3`
declare -i PHP_MAIN_VERSION_NUM=$((PHP_MAJOR_VERSION * 100 + PHP_MINOR_VERSION * 10))
declare -i PHP_VERSION_NUM=$((PHP_MAJOR_VERSION * 100 + PHP_MINOR_VERSION * 10 + PHP_PATCH_LEVEL))
#echo ""
#echo "PHP_MAIN_VERSION_NUM: $PHP_MAIN_VERSION_NUM"
#echo "PHP_VERSION_NUM: $PHP_VERSION_NUM"
#echo ""
# besser so:
#
# declare -i PHP_VERSION_NUM=$((10#$major * 10000 + 10#$minor * 100 + 10#$patch))
#
# '10#' verhindert Probleme mit führenden Nullen
#
# Bemerkung:
#
# um 2-stellige minor versionen korrekt zu behandeln, nehmen wir die major version * 10000
#
# versionen:
# 8.10.1
# 8.9.15
#
# mit 1000 ergibt sich
# 8.10.1 -> 8*1000 + 10*10 + 1 = 8101
# 8.9.15 -> 8*1000 + 9*10 + 15 = 8105
#
# 8101 < 8105 aber tatsächlich ist 8.10.1 > 8.9.15
#
# mit 10000 ergibt sich:
# 8.10.1 -> 8*10000 + 10*10 + 1 = 81001
# 8.9.15 -> 8*10000 + 9*10 + 15 = 80915
#
# 8101 < 8105 aber tatsächlich ist 8.10.1 > 8.9.15
# und damit (richtigerweise): 81001 > 80915
#
IFS='.' read -r major minor patch <<< "$VERSION"
declare -i PHP_VERSION_NUM=$((10#$major * 10000 + 10#$minor * 100 + 10#$patch))
declare -i PHP_MAIN_VERSION_NUM=$((10#$major * 10000 + 10#$minor * 100))
# version helper scripts
#
version_to_number() {
local a b c
IFS='.' read -r a b c <<< "$1"
echo $((10#$a * 10000 + 10#$b * 100 + 10#${c:-0}))
}
version_eq() {
local v1=$(version_to_number "$1")
local v2=$(version_to_number "$2")
(( v1 == v2 ))
}
version_lt() {
local v1=$(version_to_number "$1")
local v2=$(version_to_number "$2")
(( v1 < v2 ))
}
version_le() {
local v1=$(version_to_number "$1")
local v2=$(version_to_number "$2")
(( v1 <= v2 ))
}
version_gt() {
local v1=$(version_to_number "$1")
local v2=$(version_to_number "$2")
(( v1 > v2 ))
}
version_ge() {
local v1=$(version_to_number "$1")
local v2=$(version_to_number "$2")
(( v1 >= v2 ))
}
main_version_eq() {
local a b x y
IFS='.' read -r a b _ <<< "$1"
IFS='.' read -r x y _ <<< "$2"
local v1=$((10#$a * 100 + 10#$b))
local v2=$((10#$x * 100 + 10#$y))
(( v1 == v2 ))
}
main_version_lt() {
local a b x y
IFS='.' read -r a b _ <<< "$1"
IFS='.' read -r x y _ <<< "$2"
local v1=$((10#$a * 100 + 10#$b))
local v2=$((10#$x * 100 + 10#$y))
(( v1 < v2 ))
}
main_version_le() {
local a b x y
IFS='.' read -r a b _ <<< "$1"
IFS='.' read -r x y _ <<< "$2"
local v1=$((10#$a * 100 + 10#$b))
local v2=$((10#$x * 100 + 10#$y))
(( v1 <= v2 ))
}
main_version_gt() {
local a b x y
IFS='.' read -r a b _ <<< "$1"
IFS='.' read -r x y _ <<< "$2"
local v1=$((10#$a * 100 + 10#$b))
local v2=$((10#$x * 100 + 10#$y))
(( v1 > v2 ))
}
main_version_ge() {
local a b x y
IFS='.' read -r a b _ <<< "$1"
IFS='.' read -r x y _ <<< "$2"
local v1=$((10#$a * 100 + 10#$b))
local v2=$((10#$x * 100 + 10#$y))
(( v1 <= v2 ))
}
# --- Hauptversion in numerischer Form (Major*100 + Minor)
main_version_num() {
local a b
IFS='.' read -r a b _ <<< "$1"
echo $((10#$a * 100 + 10#$b))
}
# --- Vollständige Version in numerischer Form (Major*10000 + Minor*100 + Patch)
version_num() {
version_to_number "$1"
}
# 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
#if (( PHP_MAIN_VERSION_NUM >= 70400 )); then
if version_ge "$VERSION" "7.4.0"; then
needed_debian_packages="$needed_debian_packages
libsqlite3-dev
libonig-dev"
@@ -528,19 +672,21 @@ fi
# - A hack, because configure don't work with systemd on version 5.4.x
## -
if [[ "$PHP_MAIN_VERSION" = "5.4" ]]; then
#if (( PHP_MAIN_VERSION_NUM == 50400 )) ; then
if main_version_eq "${VERSION}" "5.4"; then
SYSTEMD_EXISTS=false
fi
## - Let make use multiple cores (-j<number of cores +1>)
## -
if [[ "$PHP_MAIN_VERSION" != "5.4" ]]; then
if ! main_version_eq "$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 12 ]]; then
if main_version_eq "$VERSION" "5.6" &&
(( os_version >= 13 )) &&
[[ "$os_dist" == "debian" ]] ; then
warn "For php version 5.6 at debian 13 and above, you need manual installation of
@@ -555,16 +701,20 @@ if [[ "$PHP_MAIN_VERSION" = "5.6" ]] && [[ $os_version -gt 12 ]]; then
\t cyrus-sasl compiled against openssl 1.1
\t openldap compiled against cyrus-sasl"
elif [[ "$PHP_MAIN_VERSION" = "5.6" ]] && [[ $os_version -gt 11 ]]; then
elif main_version_eq "$VERSION" "5.6" &&
(( os_version >= 12 )) &&
[[ "$os_dist" == "debian" ]] ; then
warn "For php version 5.6 at debian 12 and above, you need manual installation of
\t freetype (libfreetype6-dev)
\t libxml2
\t icu4c (libicu)
\t openssl v 1.1.1 "
\t openssl v 1.1.1"
elif [[ "$PHP_MAIN_VERSION" = "5.6" ]] && [[ $os_version -gt 9 ]]; then
elif main_version_eq "$VERSION" "5.6" &&
(( os_version >= 10 )) &&
[[ "$os_dist" == "debian" ]] ; then
warn "For php version 5.6 at debian 10 and above, you need manual installation of
@@ -5917,7 +6067,7 @@ fi
_patch_file="php-5.6-zlib-1.2.11.patch"
echononl "\tApply ${_patch_file}"
if (( PHP_VERSION_NUM < 704 && os_version >= 13 )); then
if main_version_le "$VERSION" "7.3" && (( os_version >= 13 )); then
if [[ -f "${_srcdir}/${_patch_file}" ]] ; then
patch -d $_builddir -p0 < ${_srcdir}/${_patch_file} > $tmp_err_msg 2>&1
if [[ $? -eq 0 ]]; then
@@ -5958,7 +6108,7 @@ fi
_patch_file="php-5.6-libmagic.patch"
echononl "\tApply ${_patch_file}"
if (( PHP_VERSION_NUM < 704 && os_version >= 13 )); then
if main_version_le "$VERSION" "7.3" && (( os_version >= 13 )); then
if [[ -f "${_srcdir}/${_patch_file}" ]] ; then
patch -d $_builddir -p0 < ${_srcdir}/${_patch_file} > $tmp_err_msg 2>&1
if [[ $? -eq 0 ]]; then
@@ -5999,7 +6149,7 @@ fi
_patch_file="php-5.6-mbfl_encoding.patch"
echononl "\tApply ${_patch_file}"
if (( PHP_VERSION_NUM < 704 && os_version >= 13 )); then
if main_version_le "$VERSION" "7.3" && (( os_version >= 13 )); then
if [[ -f "${_srcdir}/${_patch_file}" ]] ; then
patch -d $_builddir -p0 < ${_srcdir}/${_patch_file} > $tmp_err_msg 2>&1
if [[ $? -eq 0 ]]; then
@@ -6040,7 +6190,7 @@ fi
_patch_file="php-5.6-mbfl_put_invalid_char.patch"
echononl "\tApply ${_patch_file}"
if (( PHP_VERSION_NUM < 704 && os_version >= 13 )); then
if main_version_le "$VERSION" "7.3" && (( os_version >= 13 )); then
if [[ -f "${_srcdir}/${_patch_file}" ]] ; then
patch -d $_builddir -p0 < ${_srcdir}/${_patch_file} > $tmp_err_msg 2>&1
if [[ $? -eq 0 ]]; then
@@ -6081,7 +6231,7 @@ fi
_patch_file="php-5.6-session.patch"
echononl "\tApply ${_patch_file}"
if (( PHP_VERSION_NUM < 704 && os_version >= 13 )); then
if main_version_le "$VERSION" "7.3" && (( os_version >= 13 )); then
if [[ -f "${_srcdir}/${_patch_file}" ]] ; then
patch -d $_builddir -p0 < ${_srcdir}/${_patch_file} > $tmp_err_msg 2>&1
if [[ $? -eq 0 ]]; then
@@ -6122,7 +6272,7 @@ fi
_patch_file="php-5.6-wddx.patch"
echononl "\tApply ${_patch_file}"
if (( PHP_VERSION_NUM < 704 && os_version >= 13 )); then
if main_version_le "$VERSION" "7.3" && (( os_version >= 13 )); then
if [[ -f "${_srcdir}/${_patch_file}" ]] ; then
patch -d $_builddir -p0 < ${_srcdir}/${_patch_file} > $tmp_err_msg 2>&1
if [[ $? -eq 0 ]]; then
@@ -6163,7 +6313,7 @@ fi
_patch_file="php-5.6-mkstemp.patch"
echononl "\tApply ${_patch_file}"
if (( PHP_VERSION_NUM < 704 && os_version >= 13 )); then
if main_version_le "$VERSION" "7.3" && (( os_version >= 13 )); then
if [[ -f "${_srcdir}/${_patch_file}" ]] ; then
patch -d $_builddir -p0 < ${_srcdir}/${_patch_file} > $tmp_err_msg 2>&1
if [[ $? -eq 0 ]]; then
@@ -6204,7 +6354,7 @@ fi
_patch_file="php-5.6-reentrancy.patch"
echononl "\tApply ${_patch_file}"
if (( PHP_VERSION_NUM < 704 && os_version >= 13 )); then
if main_version_le "$VERSION" "7.3" && (( os_version >= 13 )); then
if [[ -f "${_srcdir}/${_patch_file}" ]] ; then
patch -d $_builddir -p0 < ${_srcdir}/${_patch_file} > $tmp_err_msg 2>&1
if [[ $? -eq 0 ]]; then
@@ -6245,7 +6395,7 @@ fi
_patch_file="php-5.6-cast.patch"
echononl "\tApply ${_patch_file}"
if (( PHP_VERSION_NUM < 704 && os_version >= 13 )); then
if main_version_le "$VERSION" "7.3" && (( os_version >= 13 )); then
if [[ -f "${_srcdir}/${_patch_file}" ]] ; then
patch -d $_builddir -p0 < ${_srcdir}/${_patch_file} > $tmp_err_msg 2>&1
if [[ $? -eq 0 ]]; then
@@ -6315,7 +6465,7 @@ echononl "\tGoing to configure.."
## CPP="/usr/bin/cpp-3.4" \
## CFLAGS="$_cflags" LDFLAGS="-s" \
#if (( PHP_VERSION_NUM < 704 && os_version >= 13 )); then
#if main_version_le "$VERSION" "7.3" && (( os_version >= 13 )); then
# export CFLAGS="-O2 -fno-strict-aliasing -Wno-error=incompatible-pointer-types"
#fi
if $_install_openldap ; then
@@ -6356,7 +6506,6 @@ config_params="
--with-xsl
--with-mhash
--enable-cgi
--with-ldap=shared
--with-xmlrpc"
@@ -6402,7 +6551,7 @@ else
--with-curl"
fi
if (( PHP_VERSION_NUM < 704 && os_version >= 13 )); then
if main_version_le "$VERSION" "7.3" && (( os_version >= 13 )); then
if $_install_openldap ; then
config_params="${config_params}
--with-ldap"