在 Bitbucket Pipeline Composer 映像中安装 PHP 扩展

发布于 2025-01-12 05:20:32 字数 2055 浏览 3 评论 0原文

在 Bitbucket 管道中安装和启用 PHP 扩展的正确方法是什么?


我们的 bitbucket-pipelines.yml 使用 image:composer:2.0 ,它工作得很好,直到添加了需要 php-gd 的单元测试。

gd 需要 zlib,但安装 zlib 似乎会从错误的位置运行 phpize,从而出现错误:

Executing busybox-1.32.1-r6.trigger
OK: 336 MiB in 92 packages
Cannot find config.m4. 
Make sure that you run '/usr/local/bin/phpize' in the top level source directory of the module

完全错误对于安装步骤 docker-php-ext-install zlib gd bcmath json 。

+ docker-php-ext-install zlib gd bcmath json
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/community/x86_64/APKINDEX.tar.gz
(1/28) Upgrading musl (1.2.2-r0 -> 1.2.2-r1)
(2/28) Installing m4 (1.4.18-r2)
(3/28) Installing perl (5.32.0-r0)
(4/28) Installing perl-error (0.17029-r1)
(5/28) Installing perl-git (2.30.2-r0)
(6/28) Installing git-perl (2.30.2-r0)
(7/28) Installing autoconf (2.69-r3)
(8/28) Installing pkgconf (1.7.3-r0)
(9/28) Installing dpkg-dev (1.20.6-r0)
(10/28) Installing dpkg (1.20.6-r0)
(11/28) Installing libmagic (5.39-r0)
(12/28) Installing file (5.39-r0)
(13/28) Installing libgcc (10.2.1_pre1-r3)
(14/28) Installing libstdc++ (10.2.1_pre1-r3)
(15/28) Installing binutils (2.35.2-r1)
(16/28) Installing libgomp (10.2.1_pre1-r3)
(17/28) Installing libatomic (10.2.1_pre1-r3)
(18/28) Installing libgphobos (10.2.1_pre1-r3)
(19/28) Installing gmp (6.2.1-r0)
(20/28) Installing isl22 (0.22-r0)
(21/28) Installing mpfr4 (4.1.0-r0)
(22/28) Installing mpc1 (1.2.0-r0)
(23/28) Installing gcc (10.2.1_pre1-r3)
(24/28) Installing musl-dev (1.2.2-r1)
(25/28) Installing libc-dev (0.7.2-r3)
(26/28) Installing g++ (10.2.1_pre1-r3)
(27/28) Installing re2c (1.3-r1)
(28/28) Installing .phpize-deps (20220307.110146)
Executing busybox-1.32.1-r6.trigger
OK: 336 MiB in 92 packages
Cannot find config.m4. 
Make sure that you run '/usr/local/bin/phpize' in the top level source directory of the module

What is the correct way to install and enable PHP Extensions in a Bitbucket Pipeline?


Our bitbucket-pipelines.yml uses image: composer:2.0 which worked fine until a unit test was added that requires php-gd.

gd requires zlib, but installing zlib appears to run phpize from the wrong location giving us the error:

Executing busybox-1.32.1-r6.trigger
OK: 336 MiB in 92 packages
Cannot find config.m4. 
Make sure that you run '/usr/local/bin/phpize' in the top level source directory of the module

Full error for install step docker-php-ext-install zlib gd bcmath json.

+ docker-php-ext-install zlib gd bcmath json
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/community/x86_64/APKINDEX.tar.gz
(1/28) Upgrading musl (1.2.2-r0 -> 1.2.2-r1)
(2/28) Installing m4 (1.4.18-r2)
(3/28) Installing perl (5.32.0-r0)
(4/28) Installing perl-error (0.17029-r1)
(5/28) Installing perl-git (2.30.2-r0)
(6/28) Installing git-perl (2.30.2-r0)
(7/28) Installing autoconf (2.69-r3)
(8/28) Installing pkgconf (1.7.3-r0)
(9/28) Installing dpkg-dev (1.20.6-r0)
(10/28) Installing dpkg (1.20.6-r0)
(11/28) Installing libmagic (5.39-r0)
(12/28) Installing file (5.39-r0)
(13/28) Installing libgcc (10.2.1_pre1-r3)
(14/28) Installing libstdc++ (10.2.1_pre1-r3)
(15/28) Installing binutils (2.35.2-r1)
(16/28) Installing libgomp (10.2.1_pre1-r3)
(17/28) Installing libatomic (10.2.1_pre1-r3)
(18/28) Installing libgphobos (10.2.1_pre1-r3)
(19/28) Installing gmp (6.2.1-r0)
(20/28) Installing isl22 (0.22-r0)
(21/28) Installing mpfr4 (4.1.0-r0)
(22/28) Installing mpc1 (1.2.0-r0)
(23/28) Installing gcc (10.2.1_pre1-r3)
(24/28) Installing musl-dev (1.2.2-r1)
(25/28) Installing libc-dev (0.7.2-r3)
(26/28) Installing g++ (10.2.1_pre1-r3)
(27/28) Installing re2c (1.3-r1)
(28/28) Installing .phpize-deps (20220307.110146)
Executing busybox-1.32.1-r6.trigger
OK: 336 MiB in 92 packages
Cannot find config.m4. 
Make sure that you run '/usr/local/bin/phpize' in the top level source directory of the module

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

蘸点软妹酱 2025-01-19 05:20:32

运行 phpize 需要位于扩展源目录的顶层(此源目录应包含文件名 config.m4,因为错误也指出了。)

参考:< a href="http://php.net/manual/en/install.pecl.phpize.php" rel="nofollow noreferrer">http://php.net/manual/en/install.pecl.phpize.php 了解更多信息。

您可能想要更改管道脚本中的目录。

Running phpize requires to be on the top level of an extension source dir (this source dir should contain a file name config.m4 as the error also points.)

Reference : http://php.net/manual/en/install.pecl.phpize.php for more information.

You may want to change the directory in pipeline script.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文