centos php pecl安裝方法:先更新yum來源,安裝php7;然後透過「yum install」指令安裝PECL;最後設定「php.ini」檔案即可。
推薦:《centos入門教學
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//否则会报错PHP Parse error: syntax error, unexpected //'new' (T_NEW) in /usr/share/pear/PEAR/Frontend.php on //line 91
#三、安裝swoole
$ sudo pecl install swoole
//报错如下//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 标示//报错如下//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
<code class="hljs 1c has-numbering"><span class="hljs-string"><span class="hljs-comment">//修改或者添加 extension=swoole.so<br/></span></span></code>
五、卸載擴充功能
php.ini 中刪除extension=swoole.so
卸載,切換到PHP安裝目錄下的bin
./pecl uninstall swoole(已swoole為例)
以上是centos php pecl 安裝方法的詳細內容。更多資訊請關注PHP中文網其他相關文章!