drghhp8706 2017-07-08 08:01
浏览 262

在php7-fpm Docker容器中安装postgre驱动程序

I've installed PHP:latest Docker container using the docker-compose command. It installed php-7.1.6-fpm in my Docker. When I tried to install php7-pgsql extension it failed to find that package, instead found pdo and pdo_pgsql packages. That will not satisfy my need. When I search for the available packages in the installed PHP container, I could not find any related pgsql packages for php7, instead, I saw php5-pgsql package, that will not work with php7-fpm.

Finally, I installed php-5.6-fpm container after removing the old one targeting to use php5-pgsql package. But now I disappointed again that I could not find php5-pgsql package in the newly installed container.

I know I'll be missing some important points. Whether Alpine Linux does not have php-pgsql extension. What are the possible ways to include this extension in my PHP container. I've also included Nginx and Postgres in my docker-compose.yml

I've only 3-day theory knowledge in Docker and first-day practical experience.

Thanks for reading.

  • 写回答

1条回答 默认 最新

  • dtkp51520 2017-07-23 11:13
    关注

    I ran into the same issue when I was settings up a new project to use pgsql.

    I am using php7, so you should be able to use it as well. On your Dockerfile ensure you're covering the following steps.

    Ensure you have the dependencies installed:

    RUN apt-get update && apt-get install -y libpq-dev
    

    Configure the extension:

    RUN docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql
    

    Install the extension:

    RUN docker-php-ext-install pdo pdo_pgsql
    

    Hope this helps ;)

    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?