Add PHP in Base Image List - Balena Documentation

PHP images. There isn’t any PHP variant of raspberrypi3 in balena.io bas lit
https://www.balena.io/docs/reference/base-images/base-images-ref/
Is see a way to build php from dockerhub but I’m stuck on it, re2c won’t resolve on ARM. So I use the intel-nuc image to build with and debian buster-build with php on a RaspberryPi machine.

ARG IMG_TAG
FROM library/php:${IMG_TAG:-latest} as php 
ARG DEBIAN_FRONTEND=noninteractive
FROM balenalib/intel-nuc-debian:buster-build
RUN [ "cross-build-start" ]

# prevent Debian's PHP packages from being installed
# https://github.com/docker-library/php/pull/542
RUN set -eux; \
{ \
	echo 'Package: php*'; \
	echo 'Pin: release *'; \
	echo 'Pin-Priority: -1'; \
} > /etc/apt/preferences.d/no-debian-php

# dependencies required for running "phpize"
# (see persistent deps below)
ENV PHPIZE_DEPS \
	autoconf \
	dpkg-dev \
	file \
	g++ \
	gcc \
	libc-dev \
	make \
	pkg-config \
	re2c

This is cross-build x86_64 on ARM, I would try the other way but It looks impossible due to re2c and maybe other dependencies…

Was anybody ever able to build php from balenalib images ? I wish to add basic php support to the base image pool.

I wish to add basic php support to the base image pool.

This is awesome, and I personally think it’s a good idea to support PHP.

I went a different route, and I used our Debian base-image then just apt-get install -y php7.3 ... to get a working PHP environment. Is there any reason you need to use phpize?

Without phpize, I must change my build file… Why is it sitting there, because I googled for a docker image running Apache 2 + PHP 7, which has got various extensions built-in. Apache2 is my preferred Web server, it’s easy to configure. I have to deploy a balena based image with https://www.php.net/manual/en/install.pecl.phpize.php it’s the extension installer, provided by the DockerFile: Debian php with Apache on Buster.

OK.

If re2c is not available in the ARM apt repo then I am not sure what your best course of action would be, sorry.