75 lines
2.0 KiB
Bash
Executable File
75 lines
2.0 KiB
Bash
Executable File
#!/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."
|
|
|