Weekend busy, play Swoole, so the following this article is mainly to introduce you in PHP 7 installation swoole and Yar,yaf method tutorial, the article introduced in very detailed, for everyone has a certain reference learning value, the need for friends below to see together.
This article develops the bad environment:
Installing PECL
PHP version > 7$ wget http://pear.php.net/go-pear.phar$ php go-pear.phar//php version < 7$ yum Install php-pear//otherwise it will error PHP Pars E error:syntax error, unexpected//' new ' (t_new) in/usr/share/pear/pear/frontend.php on//line 91
Installing Swoole
$ sudo pecl install swoole//error as follows//warning:invalid argument supplied for foreach () in//command.php on line 249vi ' which p ECL '//Find last line 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 "$@" Remove the-n mark//error as follows//running:phpize//can ' t find PHP headers In/usr/includ e/php//installation Php-develsudo Yum install Php70w-devel success! Build process completed successfully//installing '/usr/lib64/php/modules/swoole.so '//install ok:channel:// pecl.php.net/swoole-1.9.8
Configure PHP.ini
$ php-i | grep php.ini//Modify or add extension=swoole.so
Installing Yar and YAF
$ sudo./pecl install Msgpack//pecl/yar requires PHP (version >= 5.2.0, version <= 5.6.99), installed version is 7.0 .16//note PHP7, to use yar-2.0.2$ sudo./pecl Install yar-2.0.2//Note yar-2.0.2 Version//Add, json.so to put in front. Otherwise it will be reported//php warning:php startup:unable to load Dynamic Library '/usr/lib64/php/modules/yar.so '-/usr/lib64/php/modules/y ar.so:undefined symbol:php_json_decode_ex in Unknown on line 0extension=json.so//Put front extension=msgpack.soextension= yar.so//Restart PHP service sudo systemctl restart php-fpm.service//other error//perl:warning:setting locale failed.//perl:warning: Please check this your locale//settings://LANGUAGE = (unset),//Lc_all = (unset),//LANG = "en_US. UTF-8 "$ localedef-v-c-i en_us-f UTF-8 en_US. utf-8//other error//checking for CURL in default path ... not found//configure:error:please reinstall the Libcurl distribution- Easy.h should is in <curl-dir>/include/curl/$ sudo yum-y install curl-devel//installation yaf$ sudo./PECL installed yaf//update php . iniextension=yaf.so//Restart Service $ sudo systemctL Restart php-fpm.service//installation scaffolding $ git clone http://pecl.php.net/package/yaf$ cd php-yaf/tools/cg$ php YAF-CG app//Configuration project directory Point to app/index.php//Access configuration host
Nginx Configuration
server {Listen * * *; server_name domain.com; root document_root; index index.php index.html index.htm; if (!-e $request _filename) {rewrite ^/(. *)/index.php/$1 last;}}
Enjoy it!