centos 安裝pecl
一、更新yum源,安裝php7
CentOS/RHEL 7.x:
1 rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
2 rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
CentOS/RHEL 6.x:
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
yum安裝php7.0:(拓展自選)
yum install php70w-common php70w-fpm php70w-opcache php70w-gd php70w-mysqlnd php70w-mbstring php70w-pecl-memcached php70w-devel
以上命令安裝了下面的拓展!
php-api, php-bz2, php-calendar, php-ctype, php-curl, php-date, php-exif, php-fileinfo, php-filter, php-ftp, php-gettext, php-gmp, php-hash, php-iconv, php-json, php-libxml, php-openssl, php-pcre, php-pecl-Fileinfo, php-pecl-phar, php-pecl-zip, php-reflection, php-session, php-shmop, php-simplexml, php-sockets, php-spl, php-tokenizer, php-zend-abi, php-zip, php-zlib
二、安裝PECL
//php版本 > 7
$ wget http://pear.php.net/go-pear.phar
$ php go-pear.phar
//php版本 < 7
$ yum install php-pear
//否則會(huì)報(bào)錯(cuò)PHP Parse error: syntax error, unexpected //'new' (T_NEW) in /usr/share/pear/PEAR/Frontend.php on //line 91
三、安裝swoole
$ sudo pecl install swoole
//報(bào)錯(cuò)如下//Warning: Invalid argument supplied for foreach() in //Command.php on line 249
vi `which pecl`
//找到最后一行
exec $PHP -C -n -q $INCARG -d date.timezone=UTC -d output_buffering=1 -d variables_order=EGPCS -d safe_mode=0 -d register_argc_argv="On" $INCDIR/peclcmd.php "$@"
去掉 -n 標(biāo)示
//報(bào)錯(cuò)如下
//running: phpize
//Can't find PHP headers in /usr/include/php
安裝 PHP devel
成功!
//Build process completed successfully
//Installing '/usr/lib64/php/modules/swoole.so'
//install ok: channel://pecl.php.net/swoole-1.9.8
四、配置 php.ini
$ php -i | grep php.ini
//修改或者添加
extension=swoole.so
五、卸載擴(kuò)展
php.ini 中刪除 extension=swoole.so
卸載,切換到PHP安裝目錄下的bin
./pecl uninstall swoole(已swoole為例)
以上文章部分內(nèi)容采集于網(wǎng)絡(luò),如有侵權(quán)請聯(lián)系創(chuàng)一網(wǎng)客服處理,謝謝!