抱歉,如果这是另一个问题的重复;我的搜索未能找到我的问题的直接解决方案。
刚刚,我的机器将 PHP 更新到了 v8.2。从那时起,我就无法运行 SQL Server 扩展了。
经过反复试验后,我将 INI 文件复制到了新文件夹,并确认如下php -i
(为简洁起见,已删减):
/etc/php/8.2/cli/conf.d/20-sockets.ini,
/etc/php/8.2/cli/conf.d/20-sqlsrv.ini,
/etc/php/8.2/cli/conf.d/20-sysvmsg.ini,
...
/etc/php/8.2/cli/conf.d/20-xsl.ini,
/etc/php/8.2/cli/conf.d/30-pdo_sqlsrv.ini
当我运行时php -i
,出现此警告:
PHP Warning: PHP Startup: Unable to load dynamic library 'sqlsrv.so' (tried: /usr/lib/php/20220829/sqlsrv.so (/usr/lib/php/20220829/sqlsrv.so: cannot open shared object file: No such file or directory), /usr/lib/php/20220829/sqlsrv.so.so (/usr/lib/php/20220829/sqlsrv.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_sqlsrv.so' (tried: /usr/lib/php/20220829/pdo_sqlsrv.so (/usr/lib/php/20220829/pdo_sqlsrv.so: cannot open shared object file: No such file or directory), /usr/lib/php/20220829/pdo_sqlsrv.so.so (/usr/lib/php/20220829/pdo_sqlsrv.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
好的...我可以手动找到这些文件:
/usr/lib/php find . -name sqlsrv*
./20210902/sqlsrv.so
/usr/lib/php find . -name pdo_sqlsrv*
./20210902/pdo_sqlsrv.so
显然它们不在 PHP 寻找的位置。但我该如何让 PHP 找到它们呢?