PHP is a server-side scripting language designed for web development, but which can also be used as a general-purpose programming language. PHP can be added to straight HTML or it can be used with a variety of templating engines and web frameworks. PHP code is usually processed by an interpreter, which is either implemented as a native module on the web-server or as a common gateway interface (CGI).
wikipedia.org/wiki/PHP
FROM ghcr.io/appjail-makejails/php:15.1-85
COPY . /myapp
WORKDIR /myapp
CMD ["php", "./your-script.php"]Then, run the commands to build and run the OCI image:
$ buildah build --network=host -t my-php-app .
$ appjail oci run \
-o overwrite=force \
-o ephemeral \
-o alias \
-o ip4_inherit \
localhost/my-php-app my-php-appFor many simple, single file projects, you may find it inconvenient to write a complete Containerfile. In such cases, you can run a PHP script by using the PHP OCI image directly:
$ appjail oci run \
-o overwrite=force \
-o ephemeral \
-o alias \
-o ip4_inherit \
-o fstab="$PWD /myapp" \
-w /myapp \
ghcr.io/appjail-makejails/php:15.1-85 my-php-app \
php your-script.phpFor running this OCI image as an arbitrary user, -u flag to appjail oci run should be used (which can accept both a username/group in the container's /etc/passwd file like -u www or a specific UID/GID like -u 80:80).
php_from(default:ghcr.io/appjail-makejails/php): Location of OCI image. See also OCI Configuration.php_tag(default:latest): OCI image tag. See also OCI Configuration.
PGID(default:1000): Equivalent toPUIDbut for the Process Group ID.PUID(default:1000): Process User ID for the container's main process, allowing you to match the owner of files written to mounted host volumes to your host system's user. Writable volumes are changed based on this environment variable.
PHP_USE_FPM(optional): When set, php-fpm runs instead of the PHP CLI, with/usr/local/wwwas the working directory.
build:
variants:
- tag: 15.1-82
containerfile: Containerfile
args:
FREEBSD_RELEASE: "15.1"
PHPVER: "82"
NO_PKGCLEAN: "1"
cache_dirs: ["pkgcache0:/var/cache/pkg"]
- tag: 15.1-83
containerfile: Containerfile
args:
FREEBSD_RELEASE: "15.1"
PHPVER: "83"
NO_PKGCLEAN: "1"
cache_dirs: ["pkgcache0:/var/cache/pkg"]
- tag: 15.1-84
containerfile: Containerfile
args:
FREEBSD_RELEASE: "15.1"
PHPVER: "84"
NO_PKGCLEAN: "1"
cache_dirs: ["pkgcache0:/var/cache/pkg"]
- tag: 15.1-85
containerfile: Containerfile
aliases: ["latest"]
default: true
args:
FREEBSD_RELEASE: "15.1"
PHPVER: "85"
NO_PKGCLEAN: "1"
cache_dirs: ["pkgcache0:/var/cache/pkg"]- This image installs
php.ini-productionasphp.ini. You can always override or customize these settings.
