2021-03-12

你遇到过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加载顺序问题吗的详细内容,更多请关注php中文网其它相关文章!

php中文网最新课程二维码

  • 相关标签:php extension
  • 本文转载于:51yip,如有侵犯,请联系a@php.cn删除
  • https://www.php.cn/php-weizijiaocheng-472102.html

    发表回复

    Your email address will not be published. Required fields are marked *