广告:宝塔Linux面板高效运维的服务器管理软件 点击【 https://www.bt.cn/p/uNLv1L 】立即购买
今天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-certificates2、添加PHP PPA 源 并更新缓存
add-apt-repository ppa:ondrej/php & apt update3、安装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 -y4、查看当前PPA源有哪些可供直接安装的源
apt-cache search php7.2php-radis - radis client library for PHPphp-http - PECL HTTP module for PHP Extended HTTP Supportphp-uploadprogress - file upload progress tracking extension for PHPphp-yaml - YAML-1.1 parser and emitter for PHPphp-mongodb - MongoDB driver for PHPphp-apcu - APC User Cache for PHPphp-imagick - Provides a wrapper to the ImageMagick libraryphp-ssh2 - Bindings for the libssh2 libraryphp-redis - PHP extension for interfacing with Redisphp-memcached - memcached extension module for PHP, uses libmemcachedphp-apcu-bc - APCu Backwards Compatibility Modulephp-rrd - PHP bindings to rrd tool systemphp-uuid - PHP UUID extensionphp-memcache - memcache extension module for PHPphp-zmq - ZeroMQ messaging bindings for PHPphp-igbinary - igbinary PHP serializerphp-msgpack - PHP extension for interfacing with MessagePackphp-geoip - GeoIP module for PHPphp-tideways - Tideways PHP Profiler Extensionphp-yac - YAC (Yet Another Cache) for PHPphp-mailparse - Email message manipulation for PHPphp-oauth - OAuth 1.0 consumer and provider extensionphp-gnupg - PHP wrapper around the gpgme libraryphp-propro - propro module for PHPphp-raphf - raphf module for PHPphp-solr - PHP extension for communicating with Apache Solr serverphp-stomp - Streaming Text Oriented Messaging Protocol (STOMP) client module for PHPphp-gearman - PHP wrapper to libgearmanphp-phalcon - full-stack PHP framework delivered as a C-extensionphp-ds - PHP extension providing efficient data structures for PHP 7php-sass - PHP bindings to libsass - fast, native Sass parsing in PHPphp-lua - PHP Embedded lua interpreterlibapache2-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 PHPphp7.2-bz2 - bzip2 module for PHPphp7.2-cgi - server-side, HTML-embedded scripting language (CGI binary)php7.2-cli - command-line interpreter for the PHP scripting languagephp7.2-common - documentation, examples and common module for PHPphp7.2-curl - CURL module for PHPphp7.2-dba - DBA module for PHPphp7.2-dev - Files for PHP7.2 module developmentphp7.2-enchant - Enchant module for PHPphp7.2-fpm - server-side, HTML-embedded scripting language (FPM-CGI binary)php7.2-gd - GD module for PHPphp7.2-gmp - GMP module for PHPphp7.2-imap - IMAP module for PHPphp7.2-interbase - Interbase module for PHPphp7.2-intl - Internationalisation module for PHPphp7.2-json - JSON module for PHPphp7.2-ldap - LDAP module for PHPphp7.2-mbstring - MBSTRING module for PHPphp7.2-mysql - MySQL module for PHPphp7.2-odbc - ODBC module for PHPphp7.2-opcache - Zend OpCache module for PHPphp7.2-pgsql - PostgreSQL module for PHPphp7.2-phpdbg - server-side, HTML-embedded scripting language (PHPDBG binary)php7.2-pspell - pspell module for PHPphp7.2-readline - readline module for PHPphp7.2-recode - recode module for PHPphp7.2-snmp - SNMP module for PHPphp7.2-soap - SOAP module for PHPphp7.2-sqlite3 - SQLite3 module for PHPphp7.2-sybase - Sybase module for PHPphp7.2-tidy - tidy module for PHPphp7.2-xml - DOM, SimpleXML, WDDX, XML, and XSL module for PHPphp7.2-xmlrpc - XMLRPC-EPI module for PHPphp7.2-zip - Zip module for PHPphp7.2-xsl - XSL module for PHP (dummy)php7.2 - server-side, HTML-embedded scripting language (metapackage)php7.2-sodium - libsodium module for PHP5、选择安装 redis igbinary pear扩展
php7后每个扩展都是一个独立的ini文件本次安装的php扩展都在/etc/php/7.2/mods-available下登录后复制
apt install php-redis php-igbinary php-pearls /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.ini6、安装nghttp2库
apt install nghttp2 libnghttp2-dev7、安装redis官方异步拓展hiredis,如报错需要增加系统gcc支持
git clone https://github.com/redis/hire... cd hiredismake -j 如果报错 尝试安装gcc apt install gcc 重新编译 make -j make install ldconfig8、swoole拓展编译安装,不推荐使用pecl install swoole
pecl的安装方式没有编译http2与hiredis支持gcc-4.4 或更高版本makeautoconfpcre (centos系统可以执行命令:yum install pcre-devel)登录后复制
git clone https://gitee.com/swoole/swoo... cd swoole phpize ./configure --enable-http2 --enable-async-redis make && make install9、添加swoole扩展到php环境中
echo 'extension=swoole.so' >> /etc/php/7.2/mods-available/swoole.inicd /etc/php/7.2/cli/conf.d/ && ln -s ../../mods-available/swoole.ini 20-swoole.inicd /etc/php/7.2/fpm/conf.d/ && ln -s ../../mods-available/swoole.ini 20-swoole.ini10、查看是否引用成功
php --ri swooleswoole support => enabledVersion => 2.1.2-alphaAuthor => tianfeng.han[email: mikan.tenny@gmail.com]coroutine => enabledepoll => enabledeventfd => enabledtimerfd => enabledsignalfd => enabledcpu affinity => enabledspinlock => enabledrwlock => enabledasync redis client => enabledasync http/websocket client => enabledopenssl => enabledhttp2 => enabledLinux Native AIO => enabledpcre => enabledmutex_timedlock => enabledpthread_barrier => enabledfutex => enabledDirective => Local Value => Master Valueswoole.aio_thread_num => 2 => 2swoole.display_errors => On => Onswoole.use_namespace => On => Onswoole.use_shortname => On => Onswoole.fast_serialize => Off => Offswoole.unixsock_buffer_size => 8388608 => 8388608
至此完整全部完成
发表评论