ToTe
ToTe

Reputation: 61

docker unable to locate package trying to install php extension mysqli

I am using the [typo3-docker-boilerplate][1]

https://github.com/webdevops/TYPO3-docker-boilerplate

and trying to install a extension I need (mysqli)

I´ve tried different approach I found here and in the internet, but I always get stuck with this error message:

E: Unable to locate package mysqli

I added this into the dockerfile:

RUN apt-get update && apt-get install -y \
    mysqli \
    && docker-php-ext-install mysqli

RUN ln -sf /opt/docker/etc/cron/crontab /etc/cron.d/docker-boilerplate \
    && chmod 0644 /opt/docker/etc/cron/crontab \
    && echo >> /opt/docker/etc/cron/crontab \
    && ln -sf /opt/docker/etc/php/development.ini /opt/docker/etc/php/php.ini

I although tried, what was written here about installing php extensions, of course without success:

https://hub.docker.com/_/php/

there is a development.ini, that will be included, which contains php instructions like:

post_max_size       = 50M
upload_max_filesize = 50M
max_input_vars      = 5001

I although tried to write this to the file

extension = php_mysqli.dll

dockerfile

FROM webdevops/php-apache-dev:ubuntu-16.04

ENV PROVISION_CONTEXT "development"

# Deploy scripts/configurations
COPY etc/             /opt/docker/etc/

RUN ln -sf /opt/docker/etc/cron/crontab /etc/cron.d/docker-boilerplate \
    && chmod 0644 /opt/docker/etc/cron/crontab \
    && echo >> /opt/docker/etc/cron/crontab \
    && ln -sf /opt/docker/etc/php/development.ini /opt/docker/etc/php/php.ini

RUN apt-get install -y \
    && docker-php-ext-install php-mysqli

#RUN apt-get update && \
#    apt-get install -y mysqli && \
#    docker-php-ext-install mysqli && \
#    docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/  &&  \
#    docker-php-ext-install gd

#RUN apt-get -qq update \
#    && apt-get -qq -y install curl \
#        php-mysqli \
#    && apt-get clean -y \
#    && docker-php-ext-install php-mysqli

# Configure volume/workdir
WORKDIR /app/

Would be thank full for any help or suggestion. Thanks

Upvotes: 2

Views: 10802

Answers (2)

Wolen
Wolen

Reputation: 904

mysqli is a part of php-src. Any extension contained in php-src doesn't need any additional packages if you use PHP docker image. You need just to use

docker-php-ext-install mysqli

@edit Some extensions require additional packages (e.g. iconv), anyway mysqli doesn't.

Upvotes: 4

sanath meti
sanath meti

Reputation: 6519

Try this

apt-get install php-mysql

Once done enable mysql extension in below file

/etc/php/7.0/apache2/php.ini

un-comment below line

extension=php_mysqli.so

Upvotes: 0

Related Questions