当我试图从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因为我得到了这种类型的错误,如-pel7.2-sp:命令未找到
从文档一节中可以清楚地看到,它已被废弃,从安全的角度来看,它将不再可用--从那时起,从PHP7.2.X的发行版开始。
但是,一些项目需要这些依赖项,以便在必要时执行所需的功能。我需要如何解决上述问题?
更新:
TL;DR:
从投票到贴出的答案,我得到了很多回应。答案需要根据OS体系结构级别进行分类。由于我使用共享服务器进行托管,有多个项目驻留在它上面&这些项目是用PHP5.X.x版本编码的,因此我决定将PHP 7.1.X降级为PHP7.1.X,默认情况下在基于Debian的操作系统中支持mcrypt扩展。
正如我在在PHP7.2上安装mcrypt扩展的链接中已经提到的,由服务器试点社区。这些人告诉我们,一个更新版本的pel-7.2可以在PHP-7.2上安装mcrypt。不幸的是,它以挂起的已执行命令的pecl7.2-sp: command not found结束。稍后,网站页面得到了更新,因此那里的命令与执行时尝试的命令不匹配。
最后,无论哪种解决方案适合您的OS体系结构级别,只需使用它!
或
如果下面的方法不能解决根本原因的话,.
或者,您可以选择PHP7.1.X版本,默认情况下它支持mcrypt扩展。
发布于 2018-02-15 02:53:08
我按照以下步骤使用密室 PECL为PHP7.2安装。
apt-获取安装php-pecl
apt-get安装libmcrypt-dev li威libreadline
安装mcrypt-1.0.1
应该将"extension=mcrypt.so“添加到php.ini中
如果您需要任何帮助,请在下面评论。:-)
重要! 根据php.net引用,在PHP7.1.0时,许多(所有) mcrypt函数都被弃用了。对这一职能的依赖是非常不鼓励的。
发布于 2018-04-13 11:34:00
Mcrypt 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.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发布于 2018-04-12 13:10:03
@praneeth-nidarshan几乎涵盖了所有的台阶,除了一些:
$ sudo apt-get install php-pear
sh: phpize:找不到 错误:“`phpize”失败
$ sudo apt-get install php7.2-dev
$ sudo pecl install mcrypt-1.0.1
extension=mcrypt.so添加到您的php.ini配置文件中;如果您不知道它在哪里,请使用以下内容进行搜索:$ sudo php -i | grep 'Configuration File'
https://stackoverflow.com/questions/48275494
复制相似问题