Docker Alpine映像上的PHP HTTP扩展 [英] PHP HTTP extension on Docker alpine image

查看:223
本文介绍了Docker Alpine映像上的PHP HTTP扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的PHP高山映像上安装/启用PHP http扩展.

I am trying to install/enable the PHP http extension on my PHP alpine image.

我的应用程序composer.json文件包含"ext-http": "*",因此是我的目标.

My composer.json file for my application contains "ext-http": "*", hence my goal.

我的Dockerfile(相关部分)如下:

My Dockerfile (relevant portions) is as follows:

# PHP-FPM Base Image
FROM php:7.2.26-fpm-alpine

# Install PHP extensions
RUN apk add --update --virtual .build-deps autoconf g++ make zlib-dev curl-dev \
  && pecl install raphf propro \
  && docker-php-ext-enable raphf propro \
  && pecl install pecl_http \
  && echo -e "extension=raphf.so\nextension=propro.so\nextension=http.so" > /usr/local/etc/php/conf.d/docker-php-ext-http.ini \
  && rm -rf /usr/local/etc/php/conf.d/docker-php-ext-raphf.ini \
  && rm -rf /usr/local/etc/php/conf.d/docker-php-ext-propro.ini \
  && apk del .build-deps \
  && rm -rf /tmp/*

但是在运行composer update时,出现以下警告:

However when running composer update, I get the following warning:

PHP Warning:  PHP Startup: Unable to load dynamic library 'http.so' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20170718/http.so (Error relocating /usr/local/lib/php/extensions/no-debug-non-zts-20170718/http.so: uidna_IDNToASCII: symbol not found), /usr/local/lib/php/extensions/no-debug-non-zts-20170718/http.so.so (Error loading shared library /usr/local/lib/php/extensions/no-debug-non-zts-20170718/http.so.so: No such file or directory)) in Unknown on line 0

此后,composer update命令失败:

The requested PHP extension ext-http * is missing from your system. Install or enable PHP's http extension.

警告的http.so.so部分使我停顿了一下,使我觉得正在错误的位置查找文件.

The http.so.so part of the warning gives me pause, making me think the file is being looked for in an incorrect location.

我的参考是以下Dockerfile: https://hub.docker. com/r/realpaul/docker-php/dockerfile

My reference is the following Dockerfile: https://hub.docker.com/r/realpaul/docker-php/dockerfile

有人可以帮助我调试此问题吗?谢谢!

Can someone please help me debug this issue? Thank you!

推荐答案

该错误消息的一部分内容为:

A part of that error message reads:

http.so:uidna_IDNToASCII:未找到符号

http.so: uidna_IDNToASCII: symbol not found

根据已安装PECL_HTTP,但不起作用,此错误消息指出iconv.so不可用.请尝试通过回显/usr/local/etc/php/conf.d/docker-php-ext-http.ini来启用该功能.

According to PECL_HTTP is installed, but does not work, this error message points to iconv.so not being available. Please try to enable that also through echo'ing to /usr/local/etc/php/conf.d/docker-php-ext-http.ini.

此外,如果假定http.so不在PHP期望的位置,则应尝试在运行的容器中启动bash,以查看该文件是否存在.但是,由于该文件引发错误,您可以假定它在那里.

Additionally, if you assume that http.so is not placed at the position PHP is expecting, you should try to start a bash in your running container to see whether that file is there or not. But as that file throws an error, you can assume it's there

这篇关于Docker Alpine映像上的PHP HTTP扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆