docker容器中安装php扩展

yshir-phper 2019-10-19 10:03:51 1088 收藏
分类专栏: docker
版权
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 

 

 
————————————————
版权声明:本文为CSDN博主「yshir-phper」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_39399966/article/details/102628044

posted @ 2021-05-22 14:14  endkoo  阅读(1150)  评论(0编辑  收藏  举报