宝塔环境下php7.4安装pecl,并使用pecl安装seaslog和amqp扩展

admin 2023-10-10 11:41:43 2021

宝塔环境下的PHP7.4版本是默认不带pecl扩展包的。7.3带。。。。。很烦,自己弄吧。把遇到的问题记录一下

首先wget pear.php.net/go-pear.phar

sudo 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.

Installation base ($prefix)                   : /www/server/php/74

Temporary directory for processing            : /tmp/pear/install

Temporary directory for downloads             : /tmp/pear/install

Binaries directory                            : /www/server/php/74/bin

PHP code directory ($php_dir)                 : /www/server/php/74/share/pear

Documentation directory                       : /www/server/php/74/docs

Data directory                                : /www/server/php/74/data

User-modifiable configuration files directory : /www/server/php/74/cfg

Public WEB Files directory                    : /www/server/php/74/www

System manual pages directory                 : /www/server/php/74/man

Tests directory                               : /www/server/php/74/tests

Name of configuration file                    : /www/server/php/74/etc/pear.conf

1-12, 'all' or Enter to continue:

一路回车,出现y/n的地方y就行了


安装扩展

sudo pecl install seaslog

Build process completed successfully
Installing '/www/server/php/74/lib/php/extensions/no-debug-non-zts-20190902/seaslog.so'
install ok: channel://pecl.php.net/SeasLog-2.2.0
configuration option "php_ini" is not set to php.ini location
You should add "extension=seaslog.so" to php.ini

等待即可安装完成,然后自己配置到php.int里


sudo pecl install amqp

这里你会遇到问题,无非就是你还没安装rabbitmq的原因

先安装rabbitmq服务端,这时候你发现还是安装不上。

这时候你需要安装这个

sudo apt install librabbitmq-dev

安装完成后再执行 “sudo pecl install amqp”即可

75772 920 -rwxr-xr-x 1 root root 939192 Oct 10 11:40 /tmp/pear/install/pear-build-rootHHKBHi/install-amqp-2.1.0/www/server/php/74/lib/php/extensions/no-debug-non-zts-20190902/amqp.so

Build process completed successfully
Installing '/www/server/php/74/lib/php/extensions/no-debug-non-zts-20190902/amqp.so'
install ok: channel://pecl.php.net/amqp-2.1.0
configuration option "php_ini" is not set to php.ini location
You should add "extension=amqp.so" to php.ini

若依然报错,可能是php禁用函数导致的。解除下列函数的禁用

popen putenv 

最后于 1月前 被admin编辑 ,原因:
可爱猫?Telegram电报群 https://t.me/ikeaimao

社区声明 1、本站提供的一切软件、教程和内容信息仅限用于学习和研究目的
2、本站资源为用户分享,如有侵权请邮件与我们联系处理敬请谅解!
3、本站信息来自网络,版权争议与本站无关。您必须在下载后的24小时之内,从您的电脑或手机中彻底删除上述内容
最新回复 (0)

您可以在 登录 or 注册 后,对此帖发表评论!

返回