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!

1
  • 2
    Hey @divramod, did you managed to fix it? Commented Mar 19, 2019 at 12:53

2 Answers 2

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

Sign up to request clarification or add additional context in comments.

2 Comments

I got this error: /bin/sh: 1: add-apt-repository: not found
@HadiRasouli in this case, you'll need to install the command first: sudo apt-get install software-properties-common
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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.