sprintcube / docker-compose-lamp

A basic LAMP stack environment built using Docker Compose.
MIT License
2.54k stars 1.39k forks source link

[BUG] PHP7.3 installation issues. #244

Closed boxxroom closed 8 months ago

boxxroom commented 11 months ago

Describe the bug New git clone installation. Rename and update the .env file to use php73, mariadb106

which Branch / PHP Version are you using ? main

Steps to reproduce Steps to reproduce the behavior:

  1. Git Clone
  2. rename sample.env to .env
  3. Use php73 as the PHP version, update to use mariadb106 as database
  4. docker compose up -d

Expected behaviour Successful installation of docker with PHP 73

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

bramus commented 11 months ago

That’s because Debian stretch has been abandoned. Easiest fix is to upgrade to buster. Don’t forget to update the “Install useful tools and install important libaries” section too – see the php74/Dockerfile for inspiration.

Your resulting php73/Dockerfile should start like this:

FROM php:7.3-apache-buster

# Surpresses debconf complaints of trying to install apt packages interactively
# https://github.com/moby/moby/issues/4032#issuecomment-192327844

ARG DEBIAN_FRONTEND=noninteractive

# Update
RUN apt-get -y update --fix-missing && \
    apt-get upgrade -y && \
    apt-get --no-install-recommends install -y apt-utils && \
    rm -rf /var/lib/apt/lists/*

# Install useful tools and install important libaries
RUN apt-get -y update && \
    apt-get -y --no-install-recommends install nano wget \
dialog \
libsqlite3-dev \
libsqlite3-0 && \
    apt-get -y --no-install-recommends install default-mysql-client \
zlib1g-dev \
libzip-dev \
libicu-dev && \
    apt-get -y --no-install-recommends install --fix-missing apt-utils \
build-essential \
git \
curl \
libonig-dev && \ 
    apt-get install -y iputils-ping && \
    apt-get -y --no-install-recommends install --fix-missing libcurl4 \
libcurl4-openssl-dev \
zip \
openssl && \
    rm -rf /var/lib/apt/lists/* && \
    curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

# Install xdebug
…
sebsebseb123 commented 11 months ago

Thanks for the answer @bramus ...where was this 6 hours ago!? Haha. I just spent 6 hrs trying to debug this. But at least I learned a lot about docker and sources.list files and such.

I solved it by updating the sources.list file to the archived sources. I didn't want to change the OS version in case any of the subsequent setup/config relied on "stretch".

So, in the php73 Dockerfile in ./bin/php73 I added these lines after FROM php:7.3-apache-stretch :

# Remove the old sources.list file.
RUN rm /etc/apt/sources.list

# Replace with this list.
RUN echo 'deb http://archive.debian.org/debian/ stretch main contrib non-free\ndeb http://archive.debian.org/debian/ stretch-proposed-updates main contrib non-free\ndeb http://archive.debian.org/debian-security stretch/updates main contrib non-free' >> /etc/apt/sources.list

I found these sources from https://www.geekersdigest.com/apt-etc-apt-sources-list-for-every-debian-release/

docker compose works for me now 😊

boxxroom commented 11 months ago

Thanks both for the answers here @bramus @sebsebseb123 - I will try both of them and let you know the results.

Before posting this issue, I did start to merge some PHP74/Dockerfile conf in to PHP73/Dockerfile after reading stretch had been abandoned but came across installation errors when running docker compose up -d.

I believe this issue also occurs on PHP72 and possible earlier versions. Would it be a case of using fix but with FROM php:7.2-apache-buster

@bramus @sebsebseb123 with this issue being a core issue within the repo, it might worth creating a pull-request for this fix.

boxxroom commented 11 months ago

@bramus @sebsebseb123 Just coming back to this to confirm @bramus updated php73/Dockerfile does indeed build a successful container.

MrOffline77 commented 8 months ago

Hi Guys, thanks for bringing this up. And sorry for the delay. I just added a fix with #248. Please reopen the issue if there is still an issue.