简体   繁体   English

Docker:PHP 启动:无法加载动态库“pgsql”

[英]Docker: PHP Startup: Unable to load dynamic library 'pgsql'

I'm trying to run a CodeIgniter application (PHP framework) on a Docker container and I'm getting this error:我正在尝试在 Docker 容器上运行 CodeIgniter 应用程序(PHP 框架),但出现此错误:

Message: PHP Startup: Unable to load dynamic library 'pgsql' 
(tried: /usr/local/lib/php/extensions/no-debug-non-zts-20190902/pgsql 
(/usr/local/lib/php/extensions/no-debug-non-zts-20190902/pgsql: 
cannot open shared object file: No such file or directory), 
/usr/local/lib/php/extensions/no-debug-non-zts-20190902/pgsql.so 
(/usr/local/lib/php/extensions/no-debug-non-zts-20190902/pgsql.so:
 cannot open shared object file: No such file or directory))

And therefor, this one:因此,这个:

Message: Call to undefined function pg_pconnect()

This is my Dockerfile:这是我的 Dockerfile:

FROM php:7.4.1-apache
RUN apt-get update && apt-get install -y libpq-dev
RUN docker-php-ext-configure pgsql -with-pgsql=/usr/local/lib/php/extension/pgsql
RUN docker-php-ext-install pdo pdo_pgsql

COPY . /var/www/html
COPY php.ini-production /usr/local/etc/php/php.ini

RUN service apache2 restart

EXPOSE 80

On the php.ini I have the extension enabled like this:在 php.ini 上,我启用了这样的扩展:

;extension=pdo_odbc
extension=pdo_pgsql
;extension=pdo_sqlite
extension=pgsql
;extension=shmop

And if I visit my info.php site, I see the extensions are enabled:如果我访问我的 info.php 站点,我看到扩展已启用:

在此处输入图像描述

I also see, that my php.ini is saved correctly:我还看到,我的 php.ini 已正确保存:

在此处输入图像描述

I have tried a lot of suggestions from different posts, but havn't been successful at all.我尝试了很多来自不同帖子的建议,但根本没有成功。

Does someone know where the issue might be?有人知道问题可能出在哪里吗?

Thanks,谢谢,

How I wrote into the comment you need add pgsql :我如何写到您需要添加pgsql的评论中:

FROM php:7.4.1-apache
RUN apt-get update && apt-get install -y libpq-dev
RUN docker-php-ext-install pgsql pdo pdo_pgsql

COPY . /var/www/html/

RUN service apache2 restart

EXPOSE 80

I checked this config it's work fine.我检查了这个配置它工作正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM