Heim  >  Artikel  >  PHP-Framework  >  So installieren Sie Swoole (vollständige Datensatzfreigabe)

So installieren Sie Swoole (vollständige Datensatzfreigabe)

藏色散人
藏色散人nach vorne
2022-01-30 05:00:314026Durchsuche

Heute wird die Kolumne swoole die vollständige Aufzeichnung der Swoole-Installation mit Ihnen teilen. Wenn Sie Fragen haben, hinterlassen Sie bitte eine Nachricht zur Diskussion.

Ondřej Surýs PHP PPA stellt die PHP7.2-Version für Ubuntu 16.04/14.04 bereit. Von der Softwarequelle installiertes PHP läuft standardmäßig im Unix-Socket-Status unter /run/php/php7.2 - fpm.sock bietet eine bessere Leistung als die Verwendung von TCP bei localhost:9000.

1. Softwarequellen-Erweiterungstool installieren:

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

2. PHP PPA-Quelle hinzufügen und Cache aktualisieren

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

3. Installieren Sie php7.2 und grundlegende verwandte Erweiterungen

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. Überprüfen Sie die aktuellen PPA-Quellen für die direkte Installation

apt-cache search php7.2
php-radis - Radis-Client-Bibliothek für PHP
php-http - PECL-HTTP-Modul für PHP Erweiterte HTTP-Unterstützung
php-uploadprogress - Datei-Upload-Fortschrittsverfolgungserweiterung für PHP
php-yaml - YAML-1.1-Parser und Emitter für PHP
php -mongodb - MongoDB Treiber für PHP
php-apcu – APC User Cache für PHP
php-imagick – Stellt einen Wrapper für die ImageMagick-Bibliothek bereit
php-ssh2 – Bindungen für die libssh2-Bibliothek
php-redis – PHP-Erweiterung für die Verbindung mit Redis
php-memcached - Memcached-Erweiterungsmodul für PHP, verwendet libmemcached
php-apcu-bc - APCu-Abwärtskompatibilitätsmodul
php-rrd - PHP-Bindungen an das RRD-Toolsystem
php-uuid - PHP-UUID-Erweiterung
php-memcache - Memcache-Erweiterungsmodul für PHP
php-zmq – ZeroMQ-Messaging-Bindungen für PHP
php-igbinary – igbinary PHP Serializer
php-msgpack – PHP-Erweiterung für die Schnittstelle mit MessagePack
php-geoip – GeoIP-Modul für PHP
php-tideways – Tideways PHP Profiler Extension
php-yac - YAC (Yet Another Cache) für PHP
php-mailparse - E-Mail-Nachrichtenmanipulation für PHP
php-oauth - OAuth 1.0 Consumer- und Provider-Erweiterung
php-gnupg - PHP-Wrapper um die gpgme-Bibliothek
php-propro - Propro-Modul für PHP
php-raphf – Raphf-Modul für PHP
php-solr – PHP-Erweiterung für die Kommunikation mit dem Apache Solr-Server
php-stomp – Streaming Text Oriented Messaging Protocol (STOMP)-Clientmodul für PHP
php-gearman – PHP-Wrapper für libgearman
php -phalcon – Full-Stack-PHP-Framework, geliefert als C-Erweiterung
php-ds – PHP-Erweiterung, die effiziente Datenstrukturen für PHP 7 bereitstellt
php-sass – PHP-Bindungen an libsass – schnelles, natives Sass-Parsing in PHP
php-lua – In PHP eingebetteter Lua-Interpreter
libapache2-mod-php7.2 – serverseitige, in HTML eingebettete Skriptsprache (Apache 2-Modul)
libphp7.2-embed – in HTML eingebettete Skriptsprache (eingebettete SAPI-Bibliothek)
php7 .2-bcmath - Bcmath-Modul für PHP
php7.2-bz2 - bzip2-Modul für PHP
php7.2-cgi - serverseitige, in HTML eingebettete Skriptsprache (CGI-Binärdatei)
php7.2-cli - Befehlszeileninterpreter für PHP Skriptsprache
php7.2-common – Dokumentation, Beispiele und allgemeines Modul für PHP
php7.2-curl – CURL-Modul für PHP
php7.2-dba – DBA-Modul für PHP
php7.2-dev – Dateien für PHP7. 2 Modulentwicklung
php7.2-enchant – Enchant-Modul für PHP
php7.2-fpm – serverseitige, in HTML eingebettete Skriptsprache (FPM-CGI-Binärdatei)
php7.2-gd – GD-Modul für PHP
php7. 2-gmp – GMP-Modul für PHP
php7.2-imap – IMAP-Modul für PHP
php7.2-interbase – Interbase-Modul für PHP
php7.2-intl – Internationalisierungsmodul für PHP
php7.2-json – JSON-Modul für PHP
php7.2-ldap – LDAP-Modul für PHP
php7.2-mbstring – MBSTRING-Modul für PHP
php7.2-mysql – MySQL-Modul für PHP
php7.2-odbc – ODBC-Modul für PHP
php7.2 -opcache – Zend OpCache-Modul für PHP
php7.2-pgsql – PostgreSQL-Modul für PHP
php7.2-phpdbg – serverseitige, in HTML eingebettete Skriptsprache (PHPDBG-Binärdatei)
php7.2-pspell – Pspell-Modul für PHP
php7.2-readline – Readline-Modul für PHP
php7.2-recode – Recode-Modul für PHP
php7.2-snmp – SNMP-Modul für PHP
php7.2-soap – SOAP-Modul für PHP
php7 .2-sqlite3 - SQLite3-Modul für PHP
php7.2-sybase - Sybase-Modul für PHP
php7.2-tidy - Tidy-Modul für PHP
php7.2-xml - DOM-, SimpleXML-, WDDX-, XML- und XSL-Modul für PHP
php7. 2-xmlrpc – XMLRPC-EPI-Modul für PHP
php7.2-zip – Zip-Modul für PHP
php7.2-xsl – XSL-Modul für PHP (Dummy)
php7.2 – serverseitige, in HTML eingebettete Skriptsprache ( metapackage)
php7.2-sodium – libsodium-Modul für PHP

5. Wählen Sie die Installation der Redis-Igbinary-Pear-Erweiterung

php7后每个扩展都是一个独立的ini文件
本次安装的php扩展都在/etc/php/7.2/mods-available下
apt install php-redis php-igbinary php-pear
ls /etc/php/7.2/ mods- verfügbar
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教程栏目!

Das obige ist der detaillierte Inhalt vonSo installieren Sie Swoole (vollständige Datensatzfreigabe). Für weitere Informationen folgen Sie bitte anderen verwandten Artikeln auf der PHP chinesischen Website!

Stellungnahme:
Dieser Artikel ist reproduziert unter:segmentfault.com. Bei Verstößen wenden Sie sich bitte an admin@php.cn löschen