我已经在 ubuntu 20.04 服务器中从源代码编译了 php8.3。 安装过程是
./configure --prefix=/home/ubuntu/php8.3 --enable-zts --with-mysqli --disable-fileinfo --with-openssl --with-zlib --with-curl --enable-pcntl --enable-mysqlnd
make -j4
sudo make install
我已将 php.ini-product 复制到 /home/ubuntu/php8.3/lib/php.ini 并在其中启用 extension=mysqli。 但是当我跑步时
/home/ubuntu/php8.3/bin/php -v
我得到了
PHP Warning: PHP Startup: Unable to load dynamic library 'mysqli' (tried: /home/ubuntu/php8.3/lib/php/extensions/no-debug-zts-20220830/mysqli (/home/ubuntu/php8.3/lib/php/extensions/no-debug-zts-20220830/mysqli: cannot open shared object file: No such file or directory), /home/ubuntu/php8.3/lib/php/extensions/no-debug-zts-20220830/mysqli.so (/home/ubuntu/php8.3/lib/php/extensions/no-debug-zts-20220830/mysqli.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
我检查了/home/ubuntu/php8.3/lib/php/extensions/no-debug-zts-20220830/,里面只有opcache.so
输出为 /home/ubuntu/php8.3/bin/php -m
[PHP Modules]
Core
ctype
curl
date
dom
filter
hash
iconv
json
libxml
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_sqlite
Phar
posix
random
Reflection
session
SimpleXML
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
zlib
[Zend Modules]
那么问题来了,mysqli.so在哪里?我哪里错了?
谢谢大家
就我而言,我需要安装
apt install php8.3-mysql
然后可以通过php -m | grep mysqli
获得它
该警告似乎是由于尝试加载扩展两次而产生的,因此只需将其评论回来,它就会消失。