dongrenshi0889 2019-03-28 09:20
浏览 96
已采纳

用php5.6安装debian stretch

We are using laravel based on php version 5.6, few days ago Debian removed jessie version (8) so we need to upgrade that to 9, but the issue is its hard to use Debian 9 without php5.6 as scripts like docker-php-ext-install does not seem to work there. i attach my section of the installation in the docker-file. Would appreciate if there is a solution to this

I have tried to install the pdo_mysql without the docker-php-ext-install but it fails cannot locate that..

FROM debian:9.0
RUN apt-get update \
&& apt-get -y install \
    apt-transport-https apt-utils \
    lsb-release \
    ca-certificates \
    wget \
    mcrypt \
    libmcrypt-dev \
    git-core \
    unzip \
&& wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg \
&& echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list \
&& apt-get update \
&& apt-get -y install gnupg2 php5.6-cli php5.6-fpm \
&& apt-get update \
&& docker-php-ext-install \
    mbstring \
    pdo_mysql \
    mcrypt bcmath\
&& update-alternatives --install /usr/bin/php php /usr/bin/php5.6 90 \
&& update-alternatives --set php /usr/bin/php5.6

And this is the end of the build call :

Reading package lists...
/bin/sh: 1: docker-php-ext-install: not found
  • 写回答

1条回答 默认 最新

  • doqvzh345334 2019-03-30 14:41
    关注

    docker-php-ext-install is a command provided by official php images. You will find it only on those images or images based on those.

    Official docker php images providing php 5.6 still exist on the docker hub:

    wget -qO- https://registry.hub.docker.com/v1/repositories/php/tags | jq '.[].name' | grep -P '^"5\.6(?!\.)'
    
    "5.6"
    "5.6-alpine"
    "5.6-alpine3.4"
    "5.6-alpine3.7"
    "5.6-alpine3.8"
    "5.6-apache"
    "5.6-apache-jessie"
    "5.6-apache-stretch"
    "5.6-cli"
    "5.6-cli-alpine"
    "5.6-cli-alpine3.4"
    "5.6-cli-alpine3.7"
    "5.6-cli-alpine3.8"
    "5.6-cli-jessie"
    "5.6-cli-stretch"
    "5.6-fpm"
    "5.6-fpm-alpine"
    "5.6-fpm-alpine3.4"
    "5.6-fpm-alpine3.7"
    "5.6-fpm-alpine3.8"
    "5.6-fpm-jessie"
    "5.6-fpm-stretch"
    "5.6-jessie"
    "5.6-stretch"
    "5.6-zts"
    "5.6-zts-alpine"
    "5.6-zts-alpine3.4"
    "5.6-zts-alpine3.7"
    "5.6-zts-alpine3.8"
    "5.6-zts-jessie"
    "5.6-zts-stretch"
    

    Furthermore, those images are built on top of debian 9:

    docker run --rm php:5.6 cat /etc/os-release
    
    PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
    NAME="Debian GNU/Linux"
    VERSION_ID="9"
    VERSION="9 (stretch)"
    ID=debian
    HOME_URL="https://www.debian.org/"
    SUPPORT_URL="https://www.debian.org/support"
    BUG_REPORT_URL="https://bugs.debian.org/"
    

    and provide the docker-php-ext-install command:

    docker run --rm php:5.6 which docker-php-ext-install
    
    /usr/local/bin/docker-php-ext-install
    

    I suggest you use one of those official image as the base for your Dockerfile.

    FROM php:5.6-fpm
    RUN apt-get update \
        && apt-get -y install \
            libmcrypt-dev \
            mcrypt \
        && docker-php-ext-install \
            bcmath \
            mbstring \
            mcrypt \
            pdo_mysql
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 请问各位,如何在Jetson nano主控板的Ubuntu系统中安装PyQt5
  • ¥15 MAC安装佳能LBP2900驱动的网盘提取码
  • ¥400 微信停车小程序谁懂的来
  • ¥15 ATAC测序到底用什么peak文件做Diffbind差异分析
  • ¥15 安装ubantu过程中第一个vfat 文件挂载失败
  • ¥20 GZ::CTF如何兼容一些靶机?
  • ¥15 etcd集群部署问题
  • ¥20 谁可以帮我一下问一下各位
  • ¥15 为何重叠加权后love图的SMD与svyCreateTableOne函数绘制基线表的不一致
  • ¥150 求 《小魔指》街机游戏机整合模拟软件