4

For a while now, I'm trying to install the php7-mysql driver into different PHP docker containers from php/docker with no luck.

My Dockerfile looks like this:

# Dockerfile
FROM php:7.3-rc-apache-stretch
RUN apt-get update && apt-get upgrade -y

When I attach to the container and try to run

apt-get install php7.0-mysql

Debian stretch says that it has no installation candidate.

E: Package 'php7.0-mysql' has no installation candidate

What can I do to be able to install php7.0 modules to Debian Stretch?

Thanks in advance, this really took me some pomodores now!

Dharman
  • 30,962
  • 25
  • 85
  • 135
divramod
  • 1,454
  • 2
  • 20
  • 35

2 Answers2

4

It appears you are missing the repository for php7.

  • Adding the php7 ppa:

    sudo add-apt-repository ppa:ondrej/php

  • Then update:

    sudo apt-get update

  • Now do a search to confirm php7 is there:

    sudo apt search php7

  • Now install the php7 package:

    sudo apt install php7.0-mysql

Community
  • 1
  • 1
Manish Chauhan
  • 595
  • 2
  • 7
  • 14
0

Did not work with ppa:ondrej/php but this works:

sudo apt-get update
sudo apt-get install apt-transport-https lsb-release ca-certificates
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
sudo sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
sudo apt-get update
sudo apt-get install php7.0-mysql

You can also install php7.0 from there

Stefan Pintilie
  • 677
  • 8
  • 5