PHP安裝Swoole支持DTLS協議步驟

升級GCC

  • 安裝centos-release-scl
sudo yum install centos-release-scl
  • 安裝devtoolset
sudo yum install devtoolset-8-gcc*
  • 激活對應的devtoolset
scl enable devtoolset-8 bash
  • 查看版本
gcc -v

安裝新版Openssl

  • 下載新版Openssl
wget https://github.com/openssl/openssl/archive/OpenSSL_1_1_1-stable.zip
unzip OpenSSL_1_1_1-stable.zip
  • 進入目錄,指定安裝路徑,編譯
./configure --prefix=/usr/local/openssl // 指定安裝路徑
make && make install
  • 替換當前系統的舊版本 openssl 「先保存原來的」
mv /usr/bin/openssl /usr/bin/openssl.old
mv /usr/lib64/openssl /usr/lib64/openssl.old
mv /usr/lib64/libssl.so /usr/lib64/libssl.so.old
ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl
ln -s /usr/local/openssl/include/openssl /usr/include/openssl
ln -s /usr/local/openssl/lib/libssl.so /usr/lib64/libssl.so
echo "/usr/local/openssl/lib" >> /etc/ld.so.conf
ldconfig -v 
  • 查看版本
openssl version

安裝新版PHP 7.3.16

  • 下載php7.3.16, 解壓縮wget

點擊下載

  • 進入目錄,指定安裝目錄編譯

./configure –prefix=/usr/local/php7 –with-openssl-dir=/usr/local/openssl/ –with-openssl –enable-fpm –disable-fileinfo –with-config-file-path=/usr/local/php7/etc –with-config-file-scan-dir=/usr/local/php7/etc/php.d

  • Make && Make Install
make && make install
  • 配置

php-fpmcd /usr/local/php7/etc/ mv php-fpm.conf.default php-fpm.conf cd php-fpm.d mv www.conf.default www.conf

配置php.ini

cd ~/php-7.3.16  #進入php包目錄
cp php.ini-production  /usr/local/php7/etc/php.ini
  • 開啟php-fpm
/usr/local/php7/sbin/php-fpm

安裝Swoole 4.5.0

  • 下載新版Swoole
git clone https://github.com/swoole/swoole-src.git
  • 進入目錄編譯

 /usr/local/php7/bin/phpize && ./configure –with-openssl-dir=/usr/local/openssl/ –with-php-config=/usr/local/php7/bin/php-config && make && sudo make install

  • 添加extension=swoole.so到php.ini
vi /usr/local/php7/etc/php.ini
extension=swoole.so
  • 查看安裝的swoole情況
/usr/local/php7/bin/php --ri swoole
[root@localhost swoole-src]# /usr/local/php7/bin/php --ri swoole
swoole
Swoole => enabled
Author => Swoole Team <[email protected]>
Version => 4.5.0-alpha
Built => Apr  2 2020 01:37:54
coroutine => enabled
epoll => enabled
eventfd => enabled
signalfd => enabled
cpu_affinity => enabled
spinlock => enabled
rwlock => enabled
openssl => OpenSSL 1.1.1d  10 Sep 2019
pcre => enabled
zlib => 1.2.7
mutex_timedlock => enabled
pthread_barrier => enabled
futex => enabled
async_redis => enabled
Directive => Local Value => Master Value
swoole.enable_coroutine => On => On
swoole.enable_library => On => On
swoole.enable_preemptive_scheduler => Off => Off
swoole.display_errors => On => On
swoole.use_shortname => On => On
swoole.unixsock_buffer_size => 8388608 => 8388608

以上就是PHP安裝Swoole支持DTLS協議步驟的詳細內容,更多關於PHP安裝Swoole支持DTLS的資料請關註WalkonNet其它相關文章!

推薦閱讀: