首页 > 解决方案 > PHP 8 调用未定义函数 Illuminate\Encryption\openssl_cipher_iv_length()

问题描述

我最近遇到了我无法弄清楚的 Laravel 设置问题。不知何故,每当我加载我的网站时,我都会遇到错误;

    Call to undefined function Illuminate\Encryption\openssl_cipher_iv_length()

正在调用该函数vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php:85

我已经尝试了很多已在 SO 上发布的修复,没有任何变化。例如composer install composer update

我已经加载00_openssl.ini到我/etc/php8/conf.d的目录中,其中的内容是

extension=openssl.so

加载的模块如下;

/etc/php8/conf.d # php -m
[PHP Modules]
bcmath
Core
ctype
curl
date
dom
fileinfo
filter
gd
hash
iconv
intl
json
libxml
mbstring
openssl
pcntl
pcre
PDO
pdo_pgsql
Phar
posix
readline
Reflection
session
SimpleXML
sodium
SPL
standard
tokenizer
xdebug
xml
xmlreader
xmlwriter
Zend OPcache
zip
zlib

[Zend Modules]
Xdebug
Zend OPcache

如果我查看 OpenSSL 的 php.ini 文件,我会得到以下信息;

/etc/php8/conf.d # php -i | grep openssl
Configure Command =>  './configure'  '--build=x86_64-alpine-linux-musl' '--host=x86_64-alpine-linux-musl' '--prefix=/usr' '--program-suffix=8' '--libdir=/usr/lib/php8' '--datadir=/usr/share/php8' '--sysconfdir=/etc/php8' '--localstatedir=/var' '--with-layout=GNU' '--with-pic' '--with-pear=/usr/share/php8' '--with-config-file-path=/etc/php8' '--with-config-file-scan-dir=/etc/php8/conf.d' '--disable-short-tags' '--enable-bcmath=shared' '--with-bz2=shared' '--enable-calendar=shared' '--enable-ctype=shared' '--with-curl=shared' '--enable-dba=shared' '--with-dbmaker=shared' '--with-gdbm' '--with-lmdb' '--enable-dom=shared' '--with-enchant=shared' '--enable-exif=shared' '--with-ffi=shared' '--enable-fileinfo=shared' '--enable-ftp=shared' '--enable-gd=shared' '--with-freetype' '--with-jpeg' '--with-webp' '--with-xpm' '--disable-gd-jis-conv' '--with-gettext=shared' '--with-gmp=shared' '--with-iconv=shared' '--with-imap=shared' '--with-imap-ssl' '--enable-intl=shared' '--with-kerberos' '--with-ldap=shared' '--with-ldap-sasl' '--with-libedit' '--with-libxml' '--enable-mbstring=shared' '--with-mysqli=shared,mysqlnd' '--with-mysql-sock=/run/mysqld/mysqld.sock' '--enable-mysqlnd=shared' '--enable-opcache=shared' '--with-openssl=shared' '--with-system-ciphers' '--with-password-argon2' '--enable-pcntl=shared' '--with-external-pcre' '--enable-pdo=shared' '--with-pdo-dblib=shared' '--with-pdo-mysql=shared,mysqlnd' '--with-pdo-odbc=shared,unixODBC,/usr' '--with-pdo-pgsql=shared' '--with-pdo-sqlite=shared' '--with-pgsql=shared' '--enable-phar=shared' '--enable-posix=shared' '--with-pspell=shared' '--without-readline' '--enable-session=shared' '--enable-shmop=shared' '--enable-simplexml=shared' '--with-snmp=shared' '--enable-soap=shared' '--with-sodium=shared' '--enable-sockets=shared' '--with-sqlite3=shared' '--enable-sysvmsg=shared' '--enable-sysvsem=shared' '--enable-sysvshm=shared' '--with-tidy=shared' '--enable-tokenizer=shared' '--with-unixODBC=shared,/usr' '--enable-xml=shared' '--enable-xmlreader=shared' '--enable-xmlwriter=shared' '--with-xsl=shared' '--with-zip=shared' '--with-zlib' '--disable-phpdbg' '--enable-fpm' '--enable-embed' '--enable-litespeed' 'build_alias=x86_64-alpine-linux-musl' 'host_alias=x86_64-alpine-linux-musl'
Openssl default config => /etc/ssl/openssl.cnf
openssl.cafile => no value => no value
openssl.capath => no value => no value

我做的任何事情都无法解决问题。任何帮助将不胜感激。

标签: phplinuxlaravelopenssl

解决方案


推荐阅读