php扩展swoole编译安装openssl报错

PHP / 348人浏览 / 0人评论

php扩展swoole编译安装openssl报错,github.com/swoole,php扩展swoole编译安装openssl报错,error: openssl/ssl.h: No such file or directory,make: *** [Makefile:192: php_swoole_cxx.lo] Error 1

php扩展swoole编译安装openssl报错

环境简介

基系统 windows10
虚拟机 docker
虚拟机 系统debain

php安装(docker-compose.yml)

version: '1.0'
services:
  php-seven-four:
    image: php:7.4-fpm
    ports:
      - "9000:9000"
    volumes:
      - "./html:/usr/share/nginx/html"
    networks:
      - app_net
networks:
  app_net:
    driver: bridge

php版本(php -v)

make: * [Makefile:192: php_swoole_cxx.lo] Error 1
root@php-seven-four:/swoole-src-4.4.26# php -v
PHP 7.4.33 (cli) (built: Nov 15 2022 06:05:55) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies

编译安装swoole

swoole 版本 4.4.26
解压swoole进入目录

编译命令

phpize && \
    ./configure \
    --enable-openssl  \
    --enable-http2  \
    --enable-async-redis \
    --enable-mysqlnd && \
    make && make install

编译安装swoole报错

configure: WARNING: unrecognized options: --enable-async-redis
/bin/bash /swoole-src-4.4.26/libtool --mode=compile g++  -I. -I/swoole-src-4.4.26 -DPHP_ATOM_INC -I/swoole-src-4.4.26/include -I/swoole-src-4.4.26/main -I/swoole-src-4.4.26 -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/swoole-src-4.4.26 -I/swoole-src-4.4.26/include -I/swoole-src-4.4.26/thirdparty/hiredis  -DHAVE_CONFIG_H  -g -O2 -Wall -Wno-unused-function -Wno-deprecated -Wno-deprecated-declarations -std=c++11   -c /swoole-src-4.4.26/php_swoole_cxx.cc -o php_swoole_cxx.lo 
mkdir .libs
 g++ -I. -I/swoole-src-4.4.26 -DPHP_ATOM_INC -I/swoole-src-4.4.26/include -I/swoole-src-4.4.26/main -I/swoole-src-4.4.26 -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/swoole-src-4.4.26 -I/swoole-src-4.4.26/include -I/swoole-src-4.4.26/thirdparty/hiredis -DHAVE_CONFIG_H -g -O2 -Wall -Wno-unused-function -Wno-deprecated -Wno-deprecated-declarations -std=c++11 -c /swoole-src-4.4.26/php_swoole_cxx.cc  -fPIC -DPIC -o .libs/php_swoole_cxx.o
In file included from /swoole-src-4.4.26/php_swoole.h:53,
                 from /swoole-src-4.4.26/php_swoole_cxx.h:19,
                 from /swoole-src-4.4.26/php_swoole_cxx.cc:1:
/swoole-src-4.4.26/include/swoole.h:627:10: fatal error: openssl/ssl.h: No such file or directory
  627 | #include <openssl/ssl.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:192: php_swoole_cxx.lo] Error 1

问题在缺乏基础包

安装基础包

apt-get install -y             \
        libcurl4-openssl-dev       \
        libssl-dev                 \
        supervisor                 \
        unzip                      \
        zlib1g-dev                 \
        --no-install-recommends

启用swoole扩展

docker-php-ext-enable swoole

转载注明:

扩展查找

0 条评论

还没有人发表评论

发表评论 取消回复

记住我的信息,方便下次评论
有人回复时邮件通知我