dtf579777 2019-03-28 11:05
浏览 65

如何禁用在Google App Engine容器上预安装和启用的某些php扩展

These extensions are pre-installed and enabled on Google App Engine php container:

  • APCu
  • Bzip2
  • cURL
  • FPM
  • GMP
  • mbstring
  • mcrypt
  • libsodium
  • Memcached
  • MySQL(PDO) (uses mysqlnd)
  • MySQLi (uses mysqlnd)
  • OPcache
  • OpenSSL
  • pcntl
  • PostgreSQL
  • PostgreSQL (PDO)
  • Readline
  • recode
  • sem
  • Sockets
  • Zip
  • Zlib

They are compiled with php and enabled by default (as you can see here https://github.com/GoogleCloudPlatform/php-docker/blob/master/package-builder/debian/rules.in)

How can I disable some of then? MySQL for example, as I'm using postgres.

Here is my Dockerfile until the moment:

FROM gcr.io/google-appengine/php72:latest

ARG ENABLE_XDEBUG
ARG COMPOSER_FLAGS='--no-scripts --no-dev --prefer-dist'
ENV COMPOSER_FLAGS=${COMPOSER_FLAGS}

RUN apt-get update -y
RUN apt-get install unzip -y
RUN apt-get install autoconf -y
RUN apt-get install build-essential -y

# php-decimal
RUN apt-get install libmpdec-dev -y
RUN pecl install decimal

# Swoole
RUN pecl install swoole-4.2.13

COPY . $APP_DIR
RUN chown -R www-data.www-data $APP_DIR
RUN /bin/bash /build-scripts/move-config-files.sh
RUN /build-scripts/composer.sh;

ENTRYPOINT ["/build-scripts/entrypoint.sh"]
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]

# Option to install xdebug
RUN echo "Will enable XDEBUG: $ENABLE_XDEBUG"
RUN if [ "$ENABLE_XDEBUG" = "true" ]; then pecl install xdebug; fi
RUN if [ "$ENABLE_XDEBUG" = "true" ]; then echo "zend_extension=/opt/php72/lib/x86_64-linux-gnu/extensions/no-debug-non-zts-20170718/xdebug.so" >> /opt/php72/lib/php.ini; fi

EXPOSE 8080
  • 写回答

1条回答 默认 最新

  • doulu3399 2019-04-10 07:55
    关注

    You can take complete control of the container and the extensions that are being loaded by mounting your own php.ini (and complete conf.d directory for that matter) into the container.

    You can start the container and then log into the container by using...

    docker exec -it [container_name] bash
    

    ...and navigate to the /opt/php72/lib directory. That, or download the php.ini directly using...

    docker cp [container_name]:/opt/php72/lib/php.ini
    

    ...,modify it and volume mount it into the container using a -v flag or add it to a docker-compose.yml file.

    Just one other thing that caught my attention in your Dockerfile is that the xdebug. So is added to the php.ini. It would be better to add a separate .ini to PHP's conf.d directory so the original file remains...well, original.

    评论

报告相同问题?

悬赏问题

  • ¥50 comsol稳态求解器 找不到解,奇异矩阵有1个空方程返回的解不收敛。没有返回所有参数步长;pid控制
  • ¥15 怎么让wx群机器人发送音乐
  • ¥15 fesafe材料库问题
  • ¥35 beats蓝牙耳机怎么查看日志
  • ¥15 Fluent齿轮搅油
  • ¥15 八爪鱼爬数据为什么自己停了
  • ¥15 交替优化波束形成和ris反射角使保密速率最大化
  • ¥15 树莓派与pix飞控通信
  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功