Benutzer-Werkzeuge

Webseiten-Werkzeuge


  • Deutsch (German)
  • English
  • Français (French)
de:technische-dokumentationen:installationsanleitungen:mcrypt_fuer_php7_bereitstellen

Installationsanleitung - Mcrypt für php7.2 bereitstellen

Version Status Datum Author URL
0.1 Erster Entwurf 10.02.2020 Aviel Levy
0.2 Ergänzungen 08.11.2020 Egil Rüefli
1.0 Review und Freigabe 08.11.2020 Egil Rüefli
1.1 Ergänzungen 12.11.2020 Egil Rüefli

1. Kurzfassung

Mit PHP 7.2 gibt es Out of the Box die Erweiterung mcrypt als fertiges Paket für Debian, Ubuntu, etc. nicht mehr. Da der Support von PHP 5.x inzwischen ausgelaufen ist, folgen nun die Zwangsmigrationen auf neuere Versionen. Leider gibt es genügend PHP Anwendungen, welche mit PHP 7.x kompatibel sind aber mcrypt nach wie vor voraussetzen. Nachstehend eine kurze Anleitung, wie unter Ubuntu Server 18.04 LTS oder Debian 9 die Erweiterung bereitgestellt werden kann.

2. Installation

Für die automatische Installation von php7.2-mcrypt wird ein Bash-Script mit folgenden Inhalt erzeugt und danach ausgeführt:1)

##
## How to install mcrypt in php7.2 / php7.3
## Linux / MacOS / OSX
##

## https://lukasmestan.com/install-mcrypt-extension-in-php7-2/



# 
# Check version php and pecl
# 
php -v # if default php is not 7.2 then use /usr/bin/php7.2 instead php
pecl version
sudo apt-get install php-pear
sudo apt-get install php7.2-dev

# 
# Install mcrypt extension
# see http://pecl.php.net/package-info.php?package=mcrypt&version=1.0.1
# 
sudo apt-get -y install gcc make autoconf libc-dev pkg-config
sudo apt-get -y install libmcrypt-dev
sudo pecl install mcrypt-1.0.1

# 
# When you are shown the prompt
# 
# libmcrypt prefix? [autodetect] :
# Press Enter to autodetect.

# 
# After success installing mcrypt trought pecl, you should add mcrypt.so extension to php.ini,
# The output will look like this:
# 
# ...
# Build process completed successfully
# Installing '/usr/lib/php/20170718/mcrypt.so'    ---->   this is our path to mcrypt extension lib
# install ok: channel://pecl.php.net/mcrypt-1.0.1
# configuration option "php_ini" is not set to php.ini location
# You should add "extension=mcrypt.so" to php.ini

# 
# Grab installing path and add to cli and apache2 php.ini 
# 
# example:
sudo bash -c "echo extension=/usr/lib/php/20170718/mcrypt.so > /etc/php/7.2/cli/conf.d/mcrypt.ini"
sudo bash -c "echo extension=/usr/lib/php/20170718/mcrypt.so > /etc/php/7.2/fpm/conf.d/mcrypt.ini"

# check that the extension was installed with this command:
php -i | grep mcrypt

# 
# The output will look like this:
# 
# /etc/php/7.2/cli/conf.d/mcrypt.ini
# Registered Stream Filters => zlib.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk, convert.iconv.*, mcrypt.*, mdecrypt.*
# mcrypt
# mcrypt support => enabled
# mcrypt_filter support => enabled
# mcrypt.algorithms_dir => no value => no value
# mcrypt.modes_dir => no value => no value

# final step
sudo service apache2 restart

3. Testing

3.1 Test 1

Testfall Nr. #1
Beschreibung Überprüfung, ob php und pecl installiert sind
Vorgehen
php -v
pecl version
Voraussetzung Debian 9 oder Ubuntu 18.04, Apache2, php7.2
Erwartetes Resultat Versionsanzeigen der installierten Programme
OK / nicht OK OK
Aufgetretene Fehler / Bemerkungen Keine

3.2 Test 2

Testfall Nr. #2
Beschreibung Kontrolle, ob das Modul installiert ist
Vorgehen In Kommandozeile
php -i | grep mcrypt

eingeben.

Voraussetzung / Umfeld Debian 9 oder Ubuntu 18.04, Apache2, php7.2
Erwartetes Resultat
# 
# The output will look like this:
# 
# /etc/php/7.2/cli/conf.d/mcrypt.ini
# Registered Stream Filters => zlib.*, string.rot13, string.toupper, \ 
# string.tolower, string.strip_tags, convert.*, consumed, dechunk, convert.iconv.*, mcrypt.*, mdecrypt.*
# mcrypt
# mcrypt support => enabled
# mcrypt_filter support => enabled
# mcrypt.algorithms_dir => no value => no value
# mcrypt.modes_dir => no value => no value 
OK / nicht OK OK
Aufgetretene Fehler / Bemerkungen Keine

4. Auswertung

Verschiedene Anleitungen auf dem Internet, teils fehlerhaft.

5. Quellenverzeichnis

de/technische-dokumentationen/installationsanleitungen/mcrypt_fuer_php7_bereitstellen.txt · Zuletzt geändert: 2020/11/12 17:08 von e.rueefli