#!/bin/bash # Blake3 PHP Extension Installation Script # Für EspoCRM Docker Container set -e # Beende bei Fehler echo "=========================================" echo "Blake3 PHP Extension Installation" echo "=========================================" # Schritt 1: Build-Tools installieren echo "" echo "Schritt 1: Installiere Build-Tools..." apt-get update apt-get install -y \ git \ build-essential \ autoconf \ automake \ libtool \ pkg-config \ curl \ libcurl4-openssl-dev # PHP-Dev ist bereits im Image vorhanden echo "PHP Development headers: $(php-config --version)" # Schritt 2: Blake3 C-Bibliothek klonen echo "" echo "Schritt 2: Lade Blake3 C-Bibliothek..." cd /tmp rm -rf BLAKE3 php-blake3 git clone https://github.com/BLAKE3-team/BLAKE3.git cd BLAKE3/c gcc -shared -O3 -o libblake3.so blake3.c blake3_dispatch.c blake3_portable.c blake3_sse2_x86-64_unix.S blake3_sse41_x86-64_unix.S blake3_avx2_x86-64_unix.S blake3_avx512_x86-64_unix.S -fPIC cp libblake3.so /usr/local/lib/ ldconfig # Schritt 3: PHP Blake3 Extension klonen und kompilieren echo "" echo "Schritt 3: Kompiliere PHP Blake3 Extension..." cd /tmp git clone https://github.com/cypherbits/php-blake3.git cd php-blake3 phpize ./configure make make install # Schritt 4: Extension aktivieren echo "" echo "Schritt 4: Aktiviere Blake3 Extension..." PHP_INI_DIR=$(php -i | grep "Scan this dir for additional .ini files" | cut -d'>' -f2 | xargs) if [ -z "$PHP_INI_DIR" ]; then PHP_INI_DIR="/usr/local/etc/php/conf.d" fi echo "extension=blake3.so" > ${PHP_INI_DIR}/99-blake3.ini # Schritt 5: Verifizierung echo "" echo "Schritt 5: Verifiziere Installation..." php -m | grep -i blake3 if [ $? -eq 0 ]; then echo "✅ Blake3 Extension erfolgreich installiert!" php -r "echo 'Test Hash: ' . hash('blake3', 'test') . PHP_EOL;" else echo "❌ Blake3 Extension nicht geladen!" exit 1 fi # Cleanup echo "" echo "Schritt 6: Aufräumen..." cd / rm -rf /tmp/BLAKE3 /tmp/php-blake3 echo "" echo "=========================================" echo "✅ Installation abgeschlossen!" echo "=========================================" echo "" echo "Nächste Schritte:" echo "1. Starte PHP-FPM neu: service php8.4-fpm restart || pkill -USR2 php-fpm" echo "2. Überprüfe: php -m | grep blake3" echo "3. Teste: php -r \"echo hash('blake3', 'test');\""