sh 安装PHP 7.2 / PHP 7.3 MCrypt扩展(请参阅https://lukasmestan.com/install-mcrypt-extension-in-php7-2/)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 安装PHP 7.2 / PHP 7.3 MCrypt扩展(请参阅https://lukasmestan.com/install-mcrypt-extension-in-php7-2/)相关的知识,希望对你有一定的参考价值。

##
## 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/apache2/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

以上是关于sh 安装PHP 7.2 / PHP 7.3 MCrypt扩展(请参阅https://lukasmestan.com/install-mcrypt-extension-in-php7-2/)的主要内容,如果未能解决你的问题,请参考以下文章

在 Mac Mojave 上将 PHP 7.2 升级到 7.3

WDCP3.3中多PHP版本安装方法,以及安装遇到的问题

sh 将PHP升级到7.2

wamp环境配置

PHP 5.6 已结束安全支持,你升级到 PHP 7 系列了吗?

sh Scriptparainstalaçãodospacotes Apache,MySQL e PHP 7.2 mais phpMyAdmin e xDebug no siste