dockerfile安装php遇到的坑

Posted 会学习的猪

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了dockerfile安装php遇到的坑相关的知识,希望对你有一定的参考价值。

fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
(1/42) Installing m4 (1.4.18-r0)
(2/42) Installing libbz2 (1.0.6-r6)
(3/42) Installing perl (5.26.2-r1)
(4/42) Installing autoconf (2.69-r0)
(5/42) Installing pkgconf (1.3.10-r0)
(6/42) Installing dpkg-dev (1.18.24-r0)
(7/42) Installing dpkg (1.18.24-r0)
(8/42) Installing libmagic (5.32-r0)
(9/42) Installing file (5.32-r0)
(10/42) Installing libgcc (6.4.0-r5)
(11/42) Installing libstdc++ (6.4.0-r5)
(12/42) Installing binutils-libs (2.30-r1)
(13/42) Installing binutils (2.30-r1)
(14/42) Installing gmp (6.1.2-r1)
(15/42) Installing isl (0.18-r0)
(16/42) Installing libgomp (6.4.0-r5)
(17/42) Installing libatomic (6.4.0-r5)
(18/42) Installing mpfr3 (3.1.5-r1)
(19/42) Installing mpc1 (1.0.3-r1)
(20/42) Installing gcc (6.4.0-r5)
(21/42) Installing musl-dev (1.1.18-r3)
(22/42) Installing libc-dev (0.7.1-r0)
(23/42) Installing g++ (6.4.0-r5)
(24/42) Installing make (4.2.1-r0)
(25/42) Installing re2c (1.0.2-r0)
(26/42) Installing libattr (2.4.47-r6)
(27/42) Installing libacl (2.2.52-r3)
(28/42) Installing coreutils (8.28-r0)
(29/42) Installing curl-dev (7.61.1-r1)
(30/42) Installing ncurses-terminfo-base (6.0_p20171125-r1)
(31/42) Installing ncurses-terminfo (6.0_p20171125-r1)
(32/42) Installing ncurses-libs (6.0_p20171125-r1)
(33/42) Installing ncurses-dev (6.0_p20171125-r1)
(34/42) Installing libedit (20170329.3.1-r3)
(35/42) Installing libedit-dev (20170329.3.1-r3)
(36/42) Installing libressl-dev (2.6.5-r0)
(37/42) Installing zlib-dev (1.2.11-r1)
(38/42) Installing libxml2 (2.9.8-r1)
(39/42) Installing libxml2-dev (2.9.8-r1)
(40/42) Installing sqlite-libs (3.21.0-r1)
(41/42) Installing sqlite-dev (3.21.0-r1)
(42/42) Installing .build-deps (0)
Executing busybox-1.27.2-r11.trigger
OK: 242 MiB in 64 packages
+ export CFLAGS=-fstack-protector-strong -fpic -fpie -O2 CPPFLAGS=-fstack-protector-strong -fpic -fpie -O2 LDFLAGS=-Wl,-O1 -Wl,--hash-style=both -pie
+ docker-php-source extract
/bin/sh: docker-php-source: not found
The command ‘/bin/sh -c set -xe         && apk add --no-cache --virtual .build-deps             $PHPIZE_DEPS            coreutils               curl-dev            libedit-dev             libressl-dev            libxml2-dev             sqlite-dev              && export CFLAGS="$PHP_CFLAGS"          CPPFLAGS="$PHP_CPPFLAGS"            LDFLAGS="$PHP_LDFLAGS"  && docker-php-source extract    && cd /usr/src/php      && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"    && ./configure              --build="$gnuArch"              --with-config-file-path="$PHP_INI_DIR"          --with-config-file-scan-dir="$PHP_INI_DIR/conf.d"                           --enable-option-checking=fatal                          --with-mhash                            --enable-ftp            --enable-mbstring               --enable-mysqlnd                            --with-curl             --with-libedit          --with-openssl          --with-zlib                             $(test "$gnuArch" = ‘s390x-linux-gnu‘ && echo ‘--without-pcre-jit‘)                                 $PHP_EXTRA_CONFIGURE_ARGS       && make -j "$(nproc)"   && make install     && { find /usr/local/bin /usr/local/sbin -type f -perm +0111 -exec strip --strip-all ‘{}‘ + || true; }  && make clean           && cp -v php.ini-* "$PHP_INI_DIR/"          && cd /         && docker-php-source delete             && runDeps="$(          scanelf --needed --nobanner --format ‘%n#p‘ --recursive /usr/local                  | tr ‘,‘ ‘
‘                   | sort -u                       | awk ‘system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }‘         )"  && apk add --no-cache --virtual .php-rundeps $runDeps           && apk del .build-deps          && pecl update-channels         && rm -rf /tmp/pear ~/.pearrc‘ returned a non-zero code: 127

  

/bin/sh: docker-php-source: not found进入当前容器,发现docker-php-source文件存在但是也无法执行~
纠结办法编辑docker-php-source文件发现惊天大秘密


#!/bin/sh^M

在linux下,不可避免的会用VIM打开一些windows下编辑过的文本文件。我们会发现文件的每行结尾都会有一个^M符号,这是因为 DOS下的编辑器和Linux编辑器对文件行末的回车符处理不一致, 
对于回车符的定义: 
windows:0D0A 
unixlinux: 0A 
MAC: 0D 
比较快捷的去除这些符号的方法有这么几种: 
(1)是用VI的命令: 
    使用vi打开文本文件 
    vi dos.txt 
    命令模式下输入 
    :set fileformat=unix 
    :w 
(2) VI下使用正则表达式替换 
   g/^M/s/^M// 
    或者 
   %s/^M//g 
(3)使用sed 工具 
    sed ’s/^M//’ filename > tmp_filename 
(4)既然window下的回车符多了‘ ’,那么当然通过删除‘ ’ ,也可以实现: 
    tr -d ‘ ‘ 
(5)最后一个方法是本人最常用的方法,个人觉得最方便 
    在终端下敲命令: 
    $ dos2unix filename 
    直接转换成unix格式,就OK了!~  




























以上是关于dockerfile安装php遇到的坑的主要内容,如果未能解决你的问题,请参考以下文章

php5.5.32编译安装imagick-2.3.0php扩展插件遇到的坑

php安装swoole扩展支持openssl和wss遇到的坑

LINUX 安装PHP GD库遇到的坑

我在elasticsearch遇到的坑

Linux安装composer遇到的坑

安装Xampp-配置appche,mysql运行环境遇到的坑(转)