php教程 swoole如何安装(全纪录分享)

 所属分类:php教程

 浏览:224次-  评论: 0次-  更新时间:2022-06-02
描述:这是一篇php教程 swoole如何安装(全纪录分享)的说明内容,如果你想学习查找类似的文章,可以进入php教程获得最新优质资料。 今天swoole...
这是一篇php教程 swoole如何安装(全纪录分享)的说明内容,如果你想学习查找类似的文章,可以进入php教程获得最新优质资料。 今天swoole栏目带大家分享swoole安装的全纪录,有需要的朋友可以看看,了解了解,有问题欢迎留言讨论。

Ondřej Surý 的 PHP PPA 为 Ubuntu 16.04/14.04 提供了 PHP7.2 版本,软件源安装的 PHP 默认以 Unix Socket 的状态运行在 /run/php/php7.2-fpm.sock,比使用 TCP 以 localhost:9000 的方式性能更好。

1、安装软件源拓展工具:

apt -y install software-properties-common apt-transport-https lsb-release ca-certificates

2、添加PHP PPA 源 并更新缓存

add-apt-repository ppa:ondrej/php & apt update

3、安装php7.2及基础相关拓展

apt install php7.2-fpm php7.2-mysql php7.2-curl php7.2-gd php7.2-mbstring php7.2-xml php7.2-xmlrpc php7.2-zip php7.2-opcache php7.2-dev -y

4、查看当前PPA源有哪些可供直接安装的源

apt-cache search php7.2
php-radis - radis client library for PHP
php-http - PECL HTTP module for PHP Extended HTTP Support
php-uploadprogress - file upload progress tracking extension for PHP
php-yaml - YAML-1.1 parser and emitter for PHP
php-mongodb - MongoDB driver for PHP
php-apcu - APC User Cache for PHP
php-imagick - Provides a wrapper to the ImageMagick library
php-ssh2 - Bindings for the libssh2 library
php-redis - PHP extension for interfacing with Redis
php-memcached - memcached extension module for PHP, uses libmemcached
php-apcu-bc - APCu Backwards Compatibility Module
php-rrd - PHP bindings to rrd tool system
php-uuid - PHP UUID extension
php-memcache - memcache extension module for PHP
php-zmq - ZeroMQ messaging bindings for PHP
php-igbinary - igbinary PHP serializer
php-msgpack - PHP extension for interfacing with MessagePack
php-geoip - GeoIP module for PHP
php-tideways - Tideways PHP Profiler Extension
php-yac - YAC (Yet Another Cache) for PHP
php-mailparse - Email message manipulation for PHP
php-oauth - OAuth 1.0 consumer and provider extension
php-gnupg - PHP wrapper around the gpgme library
php-propro - propro module for PHP
php-raphf - raphf module for PHP
php-solr - PHP extension for communicating with Apache Solr server
php-stomp - Streaming Text Oriented Messaging Protocol (STOMP) client module for PHP
php-gearman - PHP wrapper to libgearman
php-phalcon - full-stack PHP framework delivered as a C-extension
php-ds - PHP extension providing efficient data structures for PHP 7
php-sass - PHP bindings to libsass - fast, native Sass parsing in PHP
php-lua - PHP Embedded lua interpreter
libapache2-mod-php7.2 - server-side, HTML-embedded scripting language (Apache 2 module)
libphp7.2-embed - HTML-embedded scripting language (Embedded SAPI library)
php7.2-bcmath - Bcmath module for PHP
php7.2-bz2 - bzip2 module for PHP
php7.2-cgi - server-side, HTML-embedded scripting language (CGI binary)
php7.2-cli - command-line interpreter for the PHP scripting language
php7.2-common - documentation, examples and common module for PHP
php7.2-curl - CURL module for PHP
php7.2-dba - DBA module for PHP
php7.2-dev - Files for PHP7.2 module development
php7.2-enchant - Enchant module for PHP
php7.2-fpm - server-side, HTML-embedded scripting language (FPM-CGI binary)
php7.2-gd - GD module for PHP
php7.2-gmp - GMP module for PHP
php7.2-imap - IMAP module for PHP
php7.2-interbase - Interbase module for PHP
php7.2-intl - Internationalisation module for PHP
php7.2-json - JSON module for PHP
php7.2-ldap - LDAP module for PHP
php7.2-mbstring - MBSTRING module for PHP
php7.2-mysql - MySQL module for PHP
php7.2-odbc - ODBC module for PHP
php7.2-opcache - Zend OpCache module for PHP
php7.2-pgsql - PostgreSQL module for PHP
php7.2-phpdbg - server-side, HTML-embedded scripting language (PHPDBG binary)
php7.2-pspell - pspell module for PHP
php7.2-readline - readline module for PHP
php7.2-recode - recode module for PHP
php7.2-snmp - SNMP module for PHP
php7.2-soap - SOAP module for PHP
php7.2-sqlite3 - SQLite3 module for PHP
php7.2-sybase - Sybase module for PHP
php7.2-tidy - tidy module for PHP
php7.2-xml - DOM, SimpleXML, WDDX, XML, and XSL module for PHP
php7.2-xmlrpc - XMLRPC-EPI module for PHP
php7.2-zip - Zip module for PHP
php7.2-xsl - XSL module for PHP (dummy)
php7.2 - server-side, HTML-embedded scripting language (metapackage)
php7.2-sodium - libsodium module for PHP

5、选择安装 redis igbinary pear扩展

php7后每个扩展都是一个独立的ini文件
本次安装的php扩展都在/etc/php/7.2/mods-available下
apt install php-redis php-igbinary php-pear
ls /etc/php/7.2/mods-available
calendar.ini fileinfo.ini igbinary.ini opcache.ini readline.ini
sysvmsg.ini xml.ini zip.ini ctype.ini ftp.ini
json.ini pdo.ini redis.ini
sysvsem.ini xmlreader.ini
curl.ini gd.ini mbstring.ini pdo_mysql.ini shmop.ini
sysvshm.ini xmlrpc.ini
dom.ini gettext.ini mysqli.ini phar.ini simplexml.ini
tokenizer.ini xmlwriter.ini
exif.ini iconv.ini mysqlnd.ini posix.ini sockets.ini
wddx.ini xsl.ini

6、安装nghttp2库

apt install nghttp2 libnghttp2-dev

7、安装redis官方异步拓展hiredis,如报错需要增加系统gcc支持

git clone https://github.com/redis/hire...
cd hiredis
make -j
如果报错 尝试安装gcc
apt install gcc
重新编译
make -j
make install
ldconfig

8、swoole拓展编译安装,不推荐使用pecl install swoole

pecl的安装方式没有编译http2与hiredis支持
gcc-4.4 或更高版本
make
autoconf
pcre (centos系统可以执行命令:yum install pcre-devel)
git clone https://gitee.com/swoole/swoo...
cd swoole
phpize
./configure --enable-http2 --enable-async-redis
make && make install

9、添加swoole扩展到php环境中

echo 'extension=swoole.so' >> /etc/php/7.2/mods-available/swoole.ini
cd /etc/php/7.2/cli/conf.d/ && ln -s ../../mods-available/swoole.ini 20-swoole.ini
cd /etc/php/7.2/fpm/conf.d/ && ln -s ../../mods-available/swoole.ini 20-swoole.ini

10、查看是否引用成功

php --ri swoole
swoole support => enabled
Version => 2.1.2-alpha
Author => tianfeng.han[email: mikan.tenny@gmail.com]
coroutine => enabled
epoll => enabled
eventfd => enabled
timerfd => enabled
signalfd => enabled
cpu affinity => enabled
spinlock => enabled
rwlock => enabled
async redis client => enabled
async http/websocket client => enabled
openssl => enabled
http2 => enabled
Linux Native AIO => enabled
pcre => enabled
mutex_timedlock => enabled
pthread_barrier => enabled
futex => enabled

Directive => Local Value => Master Value
swoole.aio_thread_num => 2 => 2
swoole.display_errors => On => On
swoole.use_namespace => On => On
swoole.use_shortname => On => On
swoole.fast_serialize => Off => Off
swoole.unixsock_buffer_size => 8388608 => 8388608

至此完整全部完成

更多swoole技术文章,请访问swoole教程栏目!

以上就是swoole如何安装(全纪录分享)的详细内容,更多请关注zzsucai.com其它相关文章!

 标签:
积分说明:注册即送10金币,每日签到可获得更多金币,成为VIP会员可免金币下载! 充值积分充值会员更多说明»

讨论这个素材(0)回答他人问题或分享使用心得奖励金币

〒_〒 居然一个评论都没有……

表情  文明上网,理性发言!