宝塔环境下的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就行了
接下来就是安装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扩展已经加好了
今天安装nextcloud,出现问题,需要使用到pecl,但是默认的是php7.4,宝塔的php7.4不带pecl,默认的php7.3却自带,不想倒腾的换7.3即可。
wget http://pear.php.net/go-pear.phar
php go-pear.phar
然后根据提示输入即可,需要修改安装位置和文件位置,都需要修改输入all,然后修改默认位置即可,宝塔php7.4默认位置为/www/server/php/74,然后一直下一步,到要求输入pear配置文件这里,我改成了PHP目录里,可以随意。
然后一路yes和enter即可。