You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu 22.04环境下PHP 8.1.2安装Sodium扩展及Laravel 9启动报错问题求助

Ubuntu 22.04环境下PHP 8.1.2安装Sodium扩展及Laravel 9启动报错问题求助

大家好,我现在遇到个棘手的问题,想请教下各位大佬:

我在Google Cloud上跑着一台Ubuntu 22.04的服务器,搭的是标准LAMP栈,PHP版本是8.1.2,上面部署了几个用Laravel 8开发的网站。

最近把其中一个网站升级到Laravel 9之后,直接弹出了这个错误:

Class 'Facade\Ignition\IgnitionServiceProvider' not found

我查了下资料,说是PHP的Sodium扩展缺失导致的这个问题。于是我在终端运行php -i | grep sodium检查扩展状态,结果输出如下:

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

sodium

sodium support => enabled

libsodium headers version => 1.0.18

libsodium library version => 1.0.18

PWD => /home/thomasadam83/libsodium-stable

$_SERVER['PWD'] => /home/thomasadam83/libsodium-stable

看起来sodium是启用状态,但又提示找不到动态库?我试着用sudo apt install php-sodium安装扩展,结果又遇到了这个问题:

Reading package lists... Done

Building dependency tree... Done

Reading state information... Done

E: Unable to locate package php-sodium

更麻烦的是,现在我在终端运行任何PHP命令,开头都会弹出那个找不到sodium动态库的警告,太影响排查了。

我翻了好多相关帖子,都没找到和我情况完全匹配的可行解决方案,有没有大佬能帮我解决这个问题呀?

备注:内容来源于stack exchange,提问作者Adam

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.23 08:32:46