环境:
[root@localhost php.d]# cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core)
[root@localhost php.d]# php -v
PHP 7.2.10 (cli) (built: Sep 15 2018 07:10:58) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans
为php安装event扩展,搜索下:yum search php | grep event
[root@localhost php.d]# yum search php | grep event
php-evenement.noarch : Événement is a very simple event dispatching library for
php-ezc-EventLog.noarch : Allows you to log events or audit trails
php-kdyby-events.noarch : Events for Nette Framework
php-pecl-event.x86_64 : Provides interface to libevent library
php-react-event-loop.noarch : Event loop abstraction layer that libraries can
: use for evented I/O
php-react-http.noarch : Library for building an evented http server
php-sabre-event.noarch : Lightweight library for event-based programming
php-symfony-event-dispatcher.noarch : Symfony EventDispatcher Component
感觉没有合适的包,改用: pecl search event搜索, 找到了event和libevent包,我选择安装event
安装: pecl install event
安装完成后,将"extension=event.so"加入php.ini文件,但是遇到了标题中描述的错误,如下:
[root@localhost php.d]# php -m
PHP Warning: PHP Startup: Unable to load dynamic library 'event.so' (tried: /usr/lib64/php/modules/event.so (/usr/lib64/php/modules/event.so: undefined symbol: php_sockets_le_socket), /usr/lib64/php/modules/event.so.so (/usr/lib64/php/modules/event.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
[PHP Modules]
修改:sockets.ini, 如下:
[root@localhost php.d]# cat sockets.ini
; Enable sockets extension module
extension=sockets.so
extension=event.so
问题解决,似乎是加载顺序导致的!因为event.so依赖于sockets.so!