PHP 警告:PHP 启动:无法加载动态库“mcrypt.so" [英] PHP Warning: PHP Startup: Unable to load dynamic library 'mcrypt.so'

查看:115
本文介绍了PHP 警告:PHP 启动:无法加载动态库“mcrypt.so"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 ubuntu 06.04 上使用 composer update 更新 laravel,但每次我运行 composer update 时总是出现此警告.

I am trying to update laravel using composer update on ubuntu 06.04 but everytime i run composer update this warning always comes up.

PHP Warning:  PHP Startup: Unable to load dynamic library 'mcrypt.so' (tried: /usr/lib/php/20170718/mcrypt.so (/usr/lib/php/20170718/mcrypt.so: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/mcrypt.so.so (/usr/lib/php/20170718/mcrypt.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

有人知道怎么处理吗?

我使用的是 php7.2

I am using php7.2

推荐答案

我在 Ubuntu 18 上安装 Php7.2 时遇到了类似的问题.虽然我已经使用 PECL 安装了 mcrypt,但我仍然收到问题中提到的错误.

I faced similar issue when I installed Php7.2 on Ubuntu 18. Though I had installed mcrypt using PECL still I get the error mentioned in the question.

我做了以下修复它

sudo apt-get install php-pear php7.2-dev

然后卸载

pecl uninstall mcrypt

现在重新安装 mcrypt

Now reinstall mcrypt

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] 自动检测.

Press [Enter] to autodetect.

使用pecl安装mcrypt成功后,需要在php.ini中添加mcrypt.so扩展名.

After success installing mcrypt using pecl, you should add mcrypt.so extension to 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

现在重启Apache

sudo service apache2 restart

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

Grab installing path and add to cli and apache2 php.ini configuration.

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 警告:PHP 启动:无法加载动态库“mcrypt.so"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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