安装 php7.2-mcrypt 的问题 [英] Issue in installing php7.2-mcrypt

查看:25
本文介绍了安装 php7.2-mcrypt 的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因为我正在尝试从 PHP 7.2.X 版本加载 mcrypt 扩展模块.
所以我尝试使用与我的 PHP 的当前版本兼容的 PECL 库,以便安装并点击此链接:在安装过程中在 PHP 7.2 上安装 mcrypt

以下是在终端执行某些命令后得到的结果.

root@YYY:/var/www/html/orocrm# apt install php-pear阅读包裹清单...完成构建依赖树读取状态信息...完成以下软件包已自动安装,不再需要:libllvm4.0使用 'sudo apt autoremove' 将其删除.将安装以下新软件包:php-梨0 个升级,1 个新安装,0 个删除,14 个未升级.需要获得 285 kB 的档案.此操作后,将使用 2,107 kB 的额外磁盘空间.获取: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]1 秒内获取 285 kB (230 kB/s)选择以前未选择的包 php-pear.(正在读取数据库...当前安装的 215503 个文件和目录.)准备解压.../php-pear_1%3a1.10.5+submodules+notgz-1+ubuntu16.04.1+deb.sury.org+1_all.deb ...解压php-pear (1:1.10.5+submodules+notgz-1+ubuntu16.04.1+deb.sury.org+1) ...处理 man-db (2.7.5-1) 的触发器...设置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] YYY 的密码:阅读包裹清单...完成构建依赖树读取状态信息...完成注意,选择libc6-dev"而不是libc-dev"gcc 已经是最新版本 (4:5.3.1-1ubuntu1).make 已经是最新版本 (4.1-6).pkg-config 已经是最新版本 (0.29.1-0ubuntu1).libc6-dev 已经是最新版本 (2.23-0ubuntu9).以下软件包已自动安装,不再需要:libllvm4.0使用 'sudo apt autoremove' 将其删除.推荐套餐:autoconf-archive gnu-standards autoconf-doc libtool将安装以下新软件包:autoconf automake autotools-dev libsigsegv2 m40 升级,5 新安装,0 删除和 14 未升级.需要获得 1,079 kB 的档案.此操作后,将使用 3,998 kB 的额外磁盘空间.获取:1 http://in.archive.ubuntu.com/ubuntu xenial/main amd64 libsigsegv2 amd64 2.10-4 [14.1 kB]获取:2 http://in.archive.ubuntu.com/ubuntu xenial/main amd64 m4 amd64 1.4.17-5 [195 kB]获取:3 http://in.archive.ubuntu.com/ubuntu xenial/main amd64 autoconf all 2.69-9 [321 kB]获取:4 http://in.archive.ubuntu.com/ubuntu xenial/main amd64 autotools-dev all 20150820.1 [39.8 kB]获取:5 http://in.archive.ubuntu.com/ubuntu xenial/main amd64 automake all 1:1.15-4ubuntu1 [510 kB]在 2 秒内获取 1,079 kB (447 kB/s)选择以前未选择的包 libsigsegv2:amd64.(正在读取数据库...当前安装了 215198 个文件和目录.)准备解压 .../libsigsegv2_2.10-4_amd64.deb ...解压 libsigsegv2:amd64 (2.10-4) ...选择以前未选择的包 m4.准备解压 .../archives/m4_1.4.17-5_amd64.deb ...开箱 m4 (1.4.17-5) ...选择以前未选择的包 autoconf.准备解压 .../autoconf_2.69-9_all.deb ...解压 autoconf (2.69-9) ...选择以前未选择的包 autotools-dev.准备解压.../autotools-dev_20150820.1_all.deb ...解压 autotools-dev (20150820.1) ...选择以前未选择的包 automake.准备解压.../automake_1%3a1.15-4ubuntu1_all.deb ...解压 automake (1:1.15-4ubuntu1) ...处理安装信息的触发器 (6.1.0.dfsg.1-5) ...处理 man-db (2.7.5-1) 的触发器...处理 doc-base (0.10.7) 的触发器...正在处理 1 个添加的文档库文件...设置 libsigsegv2:amd64 (2.10-4) ...设置 m4 (1.4.17-5) ...设置自动配置 (2.69-9) ...设置 autotools-dev (20150820.1) ...设置 automake (1:1.15-4ubuntu1) ...update-alternatives: 使用/usr/bin/automake-1.15 在自动模式下提供/usr/bin/automake (automake)处理 libc-bin (2.23-0ubuntu9) 的触发器...YYY@YYY:/var/www/html/orocrm$ sudo apt-get -y install libmcrypt-dev阅读包裹清单...完成构建依赖树读取状态信息...完成以下软件包已自动安装,不再需要:libllvm4.0使用 'sudo apt autoremove' 将其删除.将安装以下新软件包:libmcrypt-dev0 个升级,1 个新安装,0 个删除,14 个未升级.需要获得 83.7 kB 的档案.此操作后,将使用 438 kB 的额外磁盘空间.获取:1 http://in.archive.ubuntu.com/ubuntu xenial/universe amd64 libmcrypt-dev amd64 2.5.8-3.3 [83.7 kB]在 0 秒内获取 83.7 kB (105 kB/s)选择以前未选择的软件包 libmcrypt-dev.(正在读取数据库...当前安装了 215484 个文件和目录.)准备解压.../libmcrypt-dev_2.5.8-3.3_amd64.deb ...解压 libmcrypt-dev (2.5.8-3.3) ...处理 man-db (2.7.5-1) 的触发器...设置 libmcrypt-dev (2.5.8-3.3) ...YYY@YYY:/var/www/html/orocrm$ sudo pecl7.2-sp install --nodeps mcrypt-snapshot须藤:pecl7.2-sp:找不到命令

当我收到这种类型的错误 pecl7.2-sp: command not found

从文档部分,已经明确指出它已被弃用,从安全角度来看将不再可用——从那时起,从 PHP 7.2.X 的发布版本开始.

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

<小时>

更新:

TL;DR:

我对已发布的答案的投票做出了很多回应.需要根据操作系统架构级别对答案进行分类.由于我使用共享服务器进行托管,因此有多个项目驻留在它上面&用 PHP 5.X.X 版本编码,所以我决定降级到 PHP 7.1.X在我的基于 Debian 的操作系统中默认支持 mcrypt 扩展.

正如我在链接中已经提到的,在 PHP 7.2 上安装 mcrypt 扩展,由 Server Pilot 社区提供.这些人告诉过一个新版本的 pecl-7.2 可以在 PHP-7.2 上安装 mcrypt.不幸的是,它以pecl7.2-sp: command not found 来自已执行的命令.后来网站页面更新了,所以那里的命令与执行时尝试的命令不匹配.

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

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

解决方案

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

  1. 安装 PECL

<块引用>

apt-get 安装 php-pecl

  1. 在安装 MCRYPT 之前,您必须安装 libmcrypt

<块引用>

apt-get install libmcrypt-dev libreadline-dev

  1. 使用 PECL 安装MCRYPT 1.0.1

<块引用>

pecl 安装 mcrypt-1.0.1

  1. 安装成功后

<块引用>

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

如果您需要任何帮助,请在下方评论.:-)

<块引用>

重要提示!

根据 php.net 引用了许多(所有)mcrypt 函数有自 PHP 7.1.0 起已弃用.依靠这个功能是非常气馁.

As I'm trying to load mcrypt extension module from PHP 7.2.X version.
So I tried to make use of PECL library that is compatible to the current version of my PHP, in order to get installed and followed this link: Installing mcrypt on PHP 7.2 during installation!

These below are the result's obtained after executing certain commands on the terminal.

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

As I'm getting this type of Error as pecl7.2-sp: command not found

From the documentation section, it had been clearly stated that it had been deprecated and no longer will be available from the security point of view — since then, from the release version of PHP 7.2.X onward's.

But some of the project's need those dependencies, in order to carry out the required functionality as necessary. How do I need to solve the above issue?


UPDATE:

TL;DR:

I had a lot of response from the votes to the posted answer. The answers need to be triaged depending upon the OS Architecture level. Since I'm using the shared server for hosting, there are more than one projects residing over it & which are coded with the version of PHP 5.X.X, so I decided to downgrade to PHP 7.1.X that supports mcrypt extension by default in my Debian based OS.

As I already mentioned in the link while Installing mcrypt Extension on PHP 7.2, by Server Pilot community. These peoples had told a newer version of pecl-7.2 is available to install mcrypt on PHP-7.2. Unfortunately, it ended with pecl7.2-sp: command not found from the executed commands which were put up. Later the website page got an update, so the commands over there doesn't match the commands that were tried while executing.

Finally, whichever might be the solutions fit's to your OS Architecture level, Just go for it!.

OR

If the below approaches didn't yield to solve the root cause.
Alternatively, you can go for PHP 7.1.X version which supports mcrypt extension by default

解决方案

I followed below steps to install mcrypt for PHP7.2 using PECL.

  1. Install PECL

apt-get install php-pecl

  1. Before installing MCRYPT you must install libmcrypt

apt-get install libmcrypt-dev libreadline-dev

  1. Install MCRYPT 1.0.1 using PECL

pecl install mcrypt-1.0.1

  1. After the successful installation

You should add "extension=mcrypt.so" to php.ini

Please comment below if you need any assistance. :-)

IMPORTANT !

According to php.net reference many (all) mcrypt functions have been DEPRECATED as of PHP 7.1.0. Relying on this function is highly discouraged.

这篇关于安装 php7.2-mcrypt 的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆