宝塔环境下php7.4安装pecl,并安装event扩展 2022-02-22 PHP 暂无评论 3365 次阅读 宝塔环境下的php7.4版本是默认不带pecl扩展包,7.3带。 首先 ``` wget http://pear.php.net/go-pear.phar php go-pear.phar ``` 出现 ``` Below is a suggested file layout for your new PEAR installation. To change individual locations, type the number in front of the directory. Type 'all' to change all of them or simply press Enter to accept these locations. 1. Installation base ($prefix) : /www/server/php/74 2. Temporary directory for processing : /tmp/pear/install 3. Temporary directory for downloads : /tmp/pear/install 4. Binaries directory : /www/server/php/74/bin 5. PHP code directory ($php_dir) : /www/server/php/74/share/pear 6. Documentation directory : /www/server/php/74/docs 7. Data directory : /www/server/php/74/data 8. User-modifiable configuration files directory : /www/server/php/74/cfg 9. Public Web Files directory : /www/server/php/74/www 10. System manual pages directory : /www/server/php/74/man 11. Tests directory : /www/server/php/74/tests 12. Name of configuration file : /www/server/php/74/etc/pear.conf 1-12, 'all' or Enter to continue: ``` 一路回车,出现y/n的地方y就行了 以上php PEAR support安装完毕 接下来就是安装event扩展了 ``` pecl install event ``` 注意提示:`Include libevent OpenSSL support [yes] : `时输入no回车, 注意提示:`PHP Namespace for all Event classes :`时输入yes,其它直接敲回车就行 如果出现了 报错`Cannot find php-config. Please use --with-php-config=PATH` 那么就要去吧php-config加入到环境变量中 ``` echo $PATH ``` 发现php/bin目录没有 ``` vim ~/.bashrc ``` 在最后一行加上 ``` export PATH=$PATH:/www/server/php/74/bin ``` 然后重启会话窗口,重新pecl install即可 最后安装的信息 ``` Build process completed successfully Installing '/www/server/php/74/lib/php/extensions/no-debug-non-zts-20190902/event.so' install ok: channel://pecl.php.net/event-2.5.7 php.ini "/www/server/php/73/etc/php.ini" does not exist You should add "extension=event.so" to php.ini You should add "extension=event.so" to php.ini ``` 提示我们去php.ini中加上event.so 加好过后重启php,再查看`phpinfo();`发现event扩展已经加好了 转载https://blog.csdn.net/weixin_39765100/article/details/112877141 标签: bt 本作品采用 知识共享署名-相同方式共享 4.0 国际许可协议 进行许可。