您当前的位置: 首页 > 慢生活 > 程序人生 网站首页程序人生
为workerman安装支持更大并发数所需的event扩展
发布时间:2021-11-27 20:44:18编辑:雪饮阅读()
我的linux环境:
[root@localhost sockets]# cat /etc/redhat-release
CentOS Linux release 7.8.2003 (Core)
安装event扩展依赖的libevent-devel包
yum install libevent-devel -y
pecl config-set php_bin /usr/local/php734/bin/php
pecl config-set ext_dir /usr/local/php734/lib/php/ext
pecl config-set php_ini /usr/local/php734/lib/php/php.ini
[root@localhost workerman]# pecl install event
WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
Could not download from "https://pecl.php.net/get/event-3.0.6.tar", cannot download "pecl/event" (Connection to `ssl://pecl.php.net:443' failed: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?)
Error: cannot download "pecl/event"
Download failed
install failed
安装openssl扩展(php源代码目录中找)
cd /usr/local/php-7.3.4/ext/openssl
/usr/local/php734/bin/phpize
./configure --with-php-config=/usr/local/php734/bin/php-config
[root@localhost openssl]# ls /usr/local/php734/lib/php/extensions/no-debug-non-zts-20180731/
opcache.a opcache.so openssl.so redis.so
php.ini中extension那一片新增配置:
extension=/usr/local/php734/lib/php/extensions/no-debug-non-zts-20180731/openssl.so
如果还是这样:
[root@localhost workerman]# pecl install event
WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
Could not download from "https://pecl.php.net/get/event-3.0.6.tar", cannot download "pecl/event" (Connection to `ssl://pecl.php.net:443' failed: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?)
Error: cannot download "pecl/event"
Download failed
install failed
则可以按其提示自己下载自己编译:
[root@localhost ext]# wget https://pecl.php.net/get/event-3.0.6.tar
--2021-11-27 07:13:59-- https://pecl.php.net/get/event-3.0.6.tar
Resolving pecl.php.net (pecl.php.net)... 104.236.228.160
Connecting to pecl.php.net (pecl.php.net)|104.236.228.160|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1255424 (1.2M) [application/octet-stream]
Saving to: ‘event-3.0.6.tar’
100%[==================================================================================================================================================================>] 1,255,424 6.35KB/s in 3m 14s
2021-11-27 07:17:23 (6.31 KB/s) - ‘event-3.0.6.tar’ saved [1255424/1255424]
编译event扩展
tar -xvf event-3.0.6.tar
cd event-3.0.6
/usr/local/php734/bin/phpize
./configure --with-php-config=/usr/local/php734/bin/php-config
这里可能提示你大概意思是你需要有sockets扩展安装,同样这个扩展也在源代码目录中能找到
cd /usr/local/php-7.3.4/ext/sockets
/usr/local/php734/bin/phpize
./configure --with-php-config=/usr/local/php734/bin/php-config
make && make install
同样php.ini中extension段要新增:
extension=/usr/local/php734/lib/php/extensions/no-debug-non-zts-20180731/sockets.so
然后回到上面没有编译成功的event目录再次编译安装:
./configure --with-php-config=/usr/local/php734/bin/php-config
make && make install
那么同样的,最后再增加extension:
extension=/usr/local/php734/lib/php/extensions/no-debug-non-zts-20180731/event.so
至此evetn扩展就有了
[root@localhost workerman]# php -c /usr/local/php734/lib/php/php.ini -m
[PHP Modules]
Core
ctype
date
dom
event
fileinfo
filter
hash
iconv
json
libxml
mbstring
openssl
pcntl
pcre
PDO
pdo_sqlite
Phar
posix
redis
Reflection
session
SimpleXML
sockets
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
[Zend Modules]
关键字词:workerman,event,并发