你遇到过php extension加载顺序问题吗

php extension 加载顺序问题

有的php扩展,加载是有先后顺序的,如果搞错了,会导致扩展无法加载。

1,pdo_sqlsrv是sqlserver扩展,如果在pdo扩展之前加载就会报以下错误

PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_sqlsrv.so' (tried: /usr/lib64/php/modules/pdo_sqlsrv.so (/usr/lib64/php/modules/pdo_sqlsrv.so: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/pdo_sqlsrv.so.so (/usr/lib64/php/modules/pdo_sqlsrv.so.so: undefined symbol: php_pdo_register_driver)) in Unknown on line 0

解决办法:

extension=pdo.so  
extension=pdo_sqlsrv.so   //放到pdo后面

2,swoole扩展依赖sockets扩展,在sockets扩展之前加载就会报以下错误

PHP Warning: PHP Startup: Unable to load dynamic library 'swoole.so' (tried: /usr/lib64/php/modules/swoole.so (/usr/lib64/php/modules/swoole.so: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/swoole.so.so (/usr/lib64/php/modules/swoole.so.so: undefined symbol: php_sockets_le_socket)) in Unknown on line 0

解决办法:

extension=sockets.so  
extension=swoole.so   //放到pdo后面

加载完后,重新启动,php-fpm就好

【推荐学习:PHP视频教程】

以上就是你遇到过php extension加载顺序问题吗的详细内容,更多请关注其它相关文章!