给docker里的php安装gd扩展

docker官方镜像为安装php扩展封装了函数,为开发者提供了很大的便利,以下以Dockerfile的形式演示安装gd扩展的方法,安装gd扩展需要安装几个依赖包,安装依赖包使用系统命令,安装命令根据基础镜像的不同有所不同,以下演示两种使用较多的alpine和debian系统的Dockerfile,Dockerfile中同时包含更换国内开源镜像源的内容。

1、基础镜像 php:7.2-fpm-alpine

Dockerfile如下:

FROM php:7.2-fpm-alpine

RUN sed -i ‘s/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g‘ /etc/apk/repositories     && apk update     && apk add libpng-dev freetype-dev libjpeg-turbo-dev     && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include/      && docker-php-ext-install -j$(nproc) gd

EXPOSE 9000
CMD ["php-fpm"]

2、基础镜像 php:7.2-fpm-stretch (debian 9)

Dockerfile如下:

FROM php:7.2-fpm-stretch

RUN echo "deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib" > /etc/apt/sources.list     && echo "deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib" >> /etc/apt/sources.list     && echo "deb http://mirrors.aliyun.com/debian-security stretch/updates main" >> /etc/apt/sources.list     && echo "deb-src http://mirrors.aliyun.com/debian-security stretch/updates main" >> /etc/apt/sources.list     && echo "deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib" >> /etc/apt/sources.list     && echo "deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib" >> /etc/apt/sources.list     && echo "deb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib" >> /etc/apt/sources.list     && echo "deb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib" >> /etc/apt/sources.list     && rm -f /etc/apt/sources.list.d/*     && apt-get update && apt-get install -y         libfreetype6-dev         libjpeg62-turbo-dev         libpng-dev     && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include     && docker-php-ext-install -j$(nproc) gd

EXPOSE 9000
CMD ["php-fpm"]

  

原文地址:https://www.cnblogs.com/liyuchuan/p/11718798.html

时间: 2024-08-29 06:41:21

给docker里的php安装gd扩展的相关文章

linux下安装 gd扩展和 ftp扩展

ftp拓展 1.进入PHP安装源码包,找到ext下的ftp,进入 cd /usr/local/mysql/support-files/php-7.0.12/ext/ftp 2./usr/local/php/bin/phpize 3../configure --with-php-config=/usr/local/php/bin/php-config --enable-ftp 4.make && make install 5.vim /etc/php.ini  添加 : extension=

centos系统php5.6版本安装gd扩展库

由于项目需要显示验证码登录系统,所以这里需要开启php的gd扩展 这边提供安装php5.6的yum方法扩展自选.# rpm -Uvh http://ftp.iij.ad.jp/pub/linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm # yum install --enablerepo=remi -

centos7 上为php-fpm安装gd扩展库

转自:https://blog.csdn.net/liyyzz33/article/details/89166110 首先查看自己当前php的版本 php -v PHP 5.6.40 查看yum中是否有对应版本的包 yum list | grep gd 我这里就选择对象服务器php的版本yum yum install php56-php-gd.x86_64 -y 查看gd.so的所在路径 find / -name gd.so vi /etc/php.ini #文件末尾填入 extension=/

PHP 安装MySQLi、curl_init、GD扩展

一.安装MySQLi扩展 在这里要用到phpize,phpize 命令是用来准备 PHP 扩展库编译环境,一般在你安装好PHP后,会在安装PHP的bin目录下找到这个命令. 以下指令的目录路径,请网友们根据自己系统的实际情况作相应修改. PHP源码包文件夹下的EXT文件夹就是放置着目前版本的可用扩展,CD进去看看都有哪些你需要的?应该看到mysqli文件夹了吧~~~ # cd /data/software/php-5.6.10/ext/mysqli 在当前目录下执行phpize [[email 

docker安装php扩展gd库

Docker 是一个开源的应用容器引擎,基于 Go 语言 并遵从 Apache2.0 协议开源. Docker 可以让开发者打包他们的应用以及依赖包到一个轻量级.可移植的容器中,然后发布到任何流行的 Linux(Windows,MacOS) 机器上,也可以实现虚拟化. 容器是完全使用沙箱机制,相互之间不会有任何接口,更重要的是容器性能开销极低. 一.安装nginx.php.mysql镜像 docker pull nginx:latest docker pull php:5.6-fpm docke

Docker 基于 php:7.2-apache 搭建微擎网站,及 GD 扩展开启方法 - 白又白的个人空间 - OSCHINA

原文:Docker 基于 php:7.2-apache 搭建微擎网站,及 GD 扩展开启方法 - 白又白的个人空间 - OSCHINA 下载微擎源码 http://s.we7.cc/store-static-install.html 下载稳定离线版本 解压至文件夹:/var/www/we7_test/web docker 构建 php:7.4-apache 容器 docker run -d -p 8801:80 --name we7test --link mysql:mysql -v /var/

LINUX下用PHPIZE安装PHP GD扩展

环境:LNMP in centOS 6.4. linux下PHP的扩展可以用phpize的方法,比较简单地进行启用. 以下以PHP-GD2 库安装为例子. sudo yum install php-gd2 png jpeg freetype //YUM安装扩展 cd /app/php-5.4.13/ext/gd //这里的php-5.4.13/文件夹是我当初解压PHP安装包得到的. phpize ./configure --with-png-dir --with-freetype-dir --w

【docker】为docker下的php容器安装php-redis扩展【编译安装】

原文:[docker]为docker下的php容器安装php-redis扩展[编译安装] 使用docker安装的PHPFPM容器没有Redis扩展,需要安装一下扩展. 首先进入docker的PHPFPM容器 ? 1 $ docker exec -it myphpfpm /bin/bash 依次执行下列命令 ? 1 2 3 4 5 6 7 8 9 10 11 $ curl -L -o /tmp/redis.tar.gz https://github.com/phpredis/phpredis/ar

在Docker里运行Ceph

Ceph是一个完全开源的分布式存储方案.网络块设备以及文件系统,具有高稳定性.高性能.高扩展性等特点,可应对terabyte到exabyte级别的数据量. 通过使用创新性的调度算法(CRUSH).主动存储节点.以及peer-to-peer的gossip协议,Ceph规避了传统集中控制和lookup table中的扩展性和可靠性问题. Ceph目前在整个开源社区中极受推崇,已被广泛应用与虚拟化平台(Proxmox).云计算平台(OpenStack. CloudStack.OpenNebula).容