php 扩展安装 pecl pear composer
pecl
The PHP Extension Community Library
pecl 是php社区扩展库。
Pecl 扩展库的包(package)是使用 C、C++ 编写的动态链接库扩展,在编译安装后通过 php.ini 加载,随 PHP 进程被装入内存。比如多线程 、异步 。
pear
PHP Extension and Application Repository
pear PHP扩展和应用仓库。
pear 的扩展使用 php 代码写的,属于应用层的扩展。
Pear 仓库代码是以包(package)分区,每一个 Pear package 都是一个独立的项目有着自己独立的开发团队、版本控制、文档和其他包的依赖关系信息。Pear package 以 phar、tar 或 zip 发布。
Pear2
Pear2 是下一代的 Pear 代码仓库,在使用性、速度、安全上都有改进。Pear2 的包管理器 Pyrus 是下一代的 Pear installer,使用 PHP 编写,以 phar 格式发布。
Composer
Composer 是 PHP 中的应用程序级的包依赖管理器。用来管理(安装/更新)你项目中申明的依赖库。Composer 的包信息存储库是 Packagist。
php(源代码安装的)
cd /usr/local/php/bin
phar
phar.phar
php
php-config
phpdbg
phpize
pecl 安装的步骤
wget http://pear.php.net/go-pear.phar -O go-pear.php ./php go-pear.php
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) : /usr/local/php
2. Temporary directory for processing : /tmp/pear/install
3. Temporary directory for downloads : /tmp/pear/install
4. Binaries directory : /usr/local/php/bin
5. PHP code directory ($php_dir) : /usr/local/php/share/pear
6. Documentation directory : /usr/local/php/docs
7. Data directory : /usr/local/php/data
8. User-modifiable configuration files directory : /usr/local/php/cfg
9. Public Web Files directory : /usr/local/php/www
10. System manual pages directory : /usr/local/php/man
11. Tests directory : /usr/local/php/tests
12. Name of configuration file : /usr/local/php/etc/pear.conf
pecl 已经安装
ls
pear
peardev
pecl
phar
phar.phar
php
php-config
phpdbg
phpize
pecl 查询 swoole
pecl search swoole
pecl 安装 swoole
pecl install swoole
查找相应的扩展
通过搜索进入扩展包页面 https://pecl.php.net
找到需要安装的版本
安装指定版本 pecl install https://pecl.php.net/get/rdkafka-4.1.1.tgz
配置php.ini引用swoole.so然后重启php即可
扩展与包
PHP的扩展(extension)这里应称为“模块(module)”是 C、C++ 编写的功能合集,而包(package)是 PHP 编写的功能合集
PHP的包(package)以动态链接 .dll、.so 形式加载,而包则是直接引入通过 require/include 方式加載
出错信息
Warning: popen() has been disabled for security reasons in OS/Guess.php on line 241
...
找到php.ini
注掉:disable_functions
然后保存退出
/etc/init.d/php-fpm restart
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?