当前位置: 首页 > 知识库问答 >
问题:

安装php7.2-mcrypt时出现的问题

廖诚
2023-03-14

当我试图从PHP7.2.X版本加载mcrypt扩展模块时。
因此我尝试使用与当前PHP版本兼容的PECL库,以便安装并遵循以下链接:在安装期间在PHP7.2上安装mcrypt!

以下是在终端上执行某些命令后获得的结果。

root@YYY:/var/www/html/orocrm# apt install php-pear
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following package was automatically installed and is no longer required:
  libllvm4.0
Use 'sudo apt autoremove' to remove it.
The following NEW packages will be installed:
  php-pear
0 upgraded, 1 newly installed, 0 to remove and 14 not upgraded.
Need to get 285 kB of archives.
After this operation, 2,107 kB of additional disk space will be used.
Get:1 http://ppa.launchpad.net/ondrej/php/ubuntu xenial/main amd64 php-pear all 1:1.10.5+submodules+notgz-1+ubuntu16.04.1+deb.sury.org+1 [285 kB]
Fetched 285 kB in 1s (230 kB/s)   
Selecting previously unselected package php-pear.
(Reading database ... 215503 files and directories currently installed.)
Preparing to unpack .../php-pear_1%3a1.10.5+submodules+notgz-1+ubuntu16.04.1+deb.sury.org+1_all.deb ...
Unpacking php-pear (1:1.10.5+submodules+notgz-1+ubuntu16.04.1+deb.sury.org+1) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up php-pear (1:1.10.5+submodules+notgz-1+ubuntu16.04.1+deb.sury.org+1) ...

YYY@YYY:/var/www/html/orocrm$ sudo apt-get -y install gcc make autoconf libc-dev pkg-config
[sudo] password for YYY: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'libc6-dev' instead of 'libc-dev'
gcc is already the newest version (4:5.3.1-1ubuntu1).
make is already the newest version (4.1-6).
pkg-config is already the newest version (0.29.1-0ubuntu1).
libc6-dev is already the newest version (2.23-0ubuntu9).
The following package was automatically installed and is no longer required:
  libllvm4.0
Use 'sudo apt autoremove' to remove it.
Suggested packages:
  autoconf-archive gnu-standards autoconf-doc libtool
The following NEW packages will be installed:
  autoconf automake autotools-dev libsigsegv2 m4
0 upgraded, 5 newly installed, 0 to remove and 14 not upgraded.
Need to get 1,079 kB of archives.
After this operation, 3,998 kB of additional disk space will be used.
Get:1 http://in.archive.ubuntu.com/ubuntu xenial/main amd64 libsigsegv2 amd64 2.10-4 [14.1 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu xenial/main amd64 m4 amd64 1.4.17-5 [195 kB]
Get:3 http://in.archive.ubuntu.com/ubuntu xenial/main amd64 autoconf all 2.69-9 [321 kB]
Get:4 http://in.archive.ubuntu.com/ubuntu xenial/main amd64 autotools-dev all 20150820.1 [39.8 kB]
Get:5 http://in.archive.ubuntu.com/ubuntu xenial/main amd64 automake all 1:1.15-4ubuntu1 [510 kB]
Fetched 1,079 kB in 2s (447 kB/s) 
Selecting previously unselected package libsigsegv2:amd64.
(Reading database ... 215198 files and directories currently installed.)
Preparing to unpack .../libsigsegv2_2.10-4_amd64.deb ...
Unpacking libsigsegv2:amd64 (2.10-4) ...
Selecting previously unselected package m4.
Preparing to unpack .../archives/m4_1.4.17-5_amd64.deb ...
Unpacking m4 (1.4.17-5) ...
Selecting previously unselected package autoconf.
Preparing to unpack .../autoconf_2.69-9_all.deb ...
Unpacking autoconf (2.69-9) ...
Selecting previously unselected package autotools-dev.
Preparing to unpack .../autotools-dev_20150820.1_all.deb ...
Unpacking autotools-dev (20150820.1) ...
Selecting previously unselected package automake.
Preparing to unpack .../automake_1%3a1.15-4ubuntu1_all.deb ...
Unpacking automake (1:1.15-4ubuntu1) ...
Processing triggers for install-info (6.1.0.dfsg.1-5) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for doc-base (0.10.7) ...
Processing 1 added doc-base file...
Setting up libsigsegv2:amd64 (2.10-4) ...
Setting up m4 (1.4.17-5) ...
Setting up autoconf (2.69-9) ...
Setting up autotools-dev (20150820.1) ...
Setting up automake (1:1.15-4ubuntu1) ...
update-alternatives: using /usr/bin/automake-1.15 to provide /usr/bin/automake (automake) in auto mode
Processing triggers for libc-bin (2.23-0ubuntu9) ...

YYY@YYY:/var/www/html/orocrm$ sudo apt-get -y install libmcrypt-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following package was automatically installed and is no longer required:
  libllvm4.0
Use 'sudo apt autoremove' to remove it.
The following NEW packages will be installed:
  libmcrypt-dev
0 upgraded, 1 newly installed, 0 to remove and 14 not upgraded.
Need to get 83.7 kB of archives.
After this operation, 438 kB of additional disk space will be used.
Get:1 http://in.archive.ubuntu.com/ubuntu xenial/universe amd64 libmcrypt-dev amd64 2.5.8-3.3 [83.7 kB]
Fetched 83.7 kB in 0s (105 kB/s)       
Selecting previously unselected package libmcrypt-dev.
(Reading database ... 215484 files and directories currently installed.)
Preparing to unpack .../libmcrypt-dev_2.5.8-3.3_amd64.deb ...
Unpacking libmcrypt-dev (2.5.8-3.3) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up libmcrypt-dev (2.5.8-3.3) ...

YYY@YYY:/var/www/html/orocrm$ sudo pecl7.2-sp install --nodeps mcrypt-snapshot
sudo: pecl7.2-sp: command not found

因为我得到的错误类型是pecl7.2-sp:command not found

从留档部分可以清楚地看到,它已经被弃用了,从安全的角度来看,它将不再可用——从那以后,从PHP 7.2的发布版本来看。X向前的。

但是项目的一些成员需要这些依赖项,以便在必要时执行所需的功能。我需要如何解决上述问题?

TL; DR:

我从投票中得到了很多对发布答案的回应。答案需要根据操作系统架构级别进行分类。由于我使用共享服务器托管有多个项目驻留在它

正如我在链接中已经提到的,在PHP 7.2上安装mcrypt扩展,由服务器试点社区。这些人告诉我们,一个更新版本的pcl-7.2可以在PHP-7.2上安装mcrypt。不幸的是,它以pepl7.2-sp:命令未从已执行的命令中找到结束。后来网站页面得到了更新,所以那里的命令与执行时尝试的命令不匹配。

最后,无论哪种解决方案适合您的操作系统架构级别,只管去做吧!。

如果以下方法无法解决根本原因。
或者,您可以选择默认支持mcrypt扩展的PHP7.1.X版本

共有3个答案

樊烨烨
2023-03-14

@praneth-nidarsan已经覆盖了大部分台阶,除了一些:

  • 检查是否已安装(或安装)梨:

apt-get安装php-pear

  • 如果尚未安装,请安装php7.2-dev,以避免出现错误:

sh: phpize:未找到

错误:`phpize'失败

$sudo apt get安装php7.2-dev

  • 使用pecl安装mcrypt:

$sudo pecl安装mcrypt-1.0.1

  • 在php.ini的配置文件中添加extence扩展名=mcrypt.so;如果你不知道它在哪里,请使用:

$sudo php-i|grep'配置文件'

郗河
2023-03-14

加密PECL扩展

 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

当显示提示时

 libmcrypt prefix? [autodetect] :

按[Enter]自动检测。

在成功安装mcrypt-trought-pecl之后,应该将mcrypt.so扩展添加到php.ini。

输出将如下所示:

...
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

抓取安装路径并添加到cli和apache2 php.ini配置。

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"

验证是否已安装扩展

运行命令:

php -i | grep "mcrypt"

输出将如下所示:

/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
慕容坚
2023-03-14

我按照以下步骤使用PECL安装了用于PHP7.2的mcrypt。

  1. 安装PECL

apt-get-install-php-pecl

apt get安装libmcrypt dev libreadline dev

pcl安装mcrypt-1.0.1

您应该在php.ini中添加“extension=mcrypt.so”

如果您需要任何帮助,请在下面发表评论。:-)

重要的

根据php.net参考资料,从PHP7.1.0开始,许多(所有)mcrypt函数已被弃用。非常不鼓励依赖此功能。

 类似资料:
  • 所以我一直在寻找12个小时,现在这个错误的解决方案,我在尝试安装Laravel框架的PHP。我发现了许多不同的帖子,但似乎没有一个工作。这里的问题,我通过所有的步骤得到Laravel在我的电脑,这是下载和安装作曲家到我的 /usr/local/bin/目录,然后运行这个命令: 我得到这个错误: 我已经删除并重新安装了php,我已经运行了一个脚本,查看是否安装了mcrypt,它是否运行正确,我已经尝

  • 因此,即使成功地安装了pysqlcipher3,它也没有成功。 根据我的研究,这似乎是Windows用户试图安装Sqlcipher的常见问题。 尝试#1 首先,我尝试从github下载pysqlcipher3,并通过cmd手动构建和安装它(使用和)。 在执行Python3setup.py构建时,我有一些错误(缺少几个需求,没有OPENSSL_CONF环境变量等)。),但我修复了其中的大部分。 但是

  • 我一直在努力尝试,但我无法克服这个错误。我有Ruby版本1.8.7和Gem版本2.1.11,我试图安装open project,但我总是遇到这个错误 安装json(1.8.1)gem::installer::extensionbuilderror:错误:未能构建gem本机扩展。 迈克 安装json(1.8.1)时出错,Bundler无法继续。在绑定之前,请确保成功。==>出错:(==>安装中止。

  • 我试图在Windows上安装Antlr 4.4,目的是使用pyfuzzy,这是一个模糊逻辑的Python库,它依赖于Antlr的Python运行时来运行。我曾尝试(天真地)在不安装Antlr的情况下获得Python (2.7)的Antlr运行时,当然这并不成功。 因此,我尝试按照Windows的说明安装Antlr,但每次运行时都会出现错误: antlr .jar文件位于 C:\JavaLib 中,

  • 您好,我正在安装XAMPP,MySQL端口3306有问题。 我已使用控制面板配置我的。ini并将端口设置更改为3307,但仍显示以下错误: 22:48:55[mysql]检测到问题!22:48:55[mysql]端口3306正在被“C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqld.exe”--defauls-file="C:\Program Da

  • 本文向大家介绍CentOS7yum安装PHP7.2的操作方法,包括了CentOS7yum安装PHP7.2的操作方法的使用技巧和注意事项,需要的朋友参考一下 1、如果之前已经安装我们先卸载一下 2、由于linux的yum源不存在php7.x,所以我们要更改yum源 3、yum 安装php72w和各种拓展,选自己需要的即可 以上这篇CentOS7yum安装PHP7.2的操作方法就是小编分享给大家的全部