Home > Article > Operation and Maintenance > centos php pecl installation method
centos php pecl installation method: first update the yum source and install php7; then install PECL through the "yum install" command; finally configure the "php.ini" file.
Recommended: "centos Getting Started Tutorial"
centos Installation pecl
1. Update the yum source and install 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 installation php7.0: (optional expansion)
yum install php70w-common php70w-fpm php70w-opcache php70w-gd php70w-mysqlnd php70w-mbstring php70w-pecl-memcached php70w-devel
The above command installs the following extensions!
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
2. Install 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
3. Install 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
4. Configure 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>
5. Uninstall the extension
Delete extension=swoole.so
in php.ini and switch to the PHP installation directory bin
./pecl uninstall swoole (take swoole as an example)
The above is the detailed content of centos php pecl installation method. For more information, please follow other related articles on the PHP Chinese website!