1、命令进入容器中

docker exec -it php sh(基于alpine的命令,如果是centos则使用bash)

2、安装redis、swoole扩展

#安装pecl
wget http://pear.php.net/go-pear.phar -O go-pear.php
php go-pear.php
##回车默认安装

#使用pcel命令安装
pcel install redis
pcel install swoole

如果出现以下错误,说明没有安装autoconf

接下来安装autoconf

#1、基于alpine系统安装autoconf
安装 autoconf(无configure脚本时):apk add --no-cache -U autoconf
安装 C 编译器:apk add --no-cache -U gcc
安装 make
安装 linux 内核文件头 linux-headers:apk add --no-cache -U linux-headers
报:
/usr/lib/gcc/x86_64-alpine-linux-musl/8.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find Scrt1.o: No such file or directory

/usr/lib/gcc/x86_64-alpine-linux-musl/8.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find crti.o: No such file or directory

/usr/lib/gcc/x86_64-alpine-linux-musl/8.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find -lssp_nonshared

错误时需要安装 libc-dev:apk add --no-cache -U libc-dev

报 No curses library functions found,需安装 ncurses-dev:apk add --no-cache -U ncurses-dev

#2、基于centos系统安装autoconf
安装 autoconf: yum -y install autoconf
安装 C 编译器:yum -y install gcc gcc-c++ kernel-devel

#3、基于MacOS系统安装autoconf
brew install autoconf 
brew install homebrew/versions/gcc5

#4、基于Ubuntu系统安装autoconf
apt-get install autoconf 
apt-get  build-dep  gcc 

下图错误说明需要安装gcc 

 

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐