Sign in

Mod for code-server

PHP-CLI

This mod adds php-cli and composer to code-server/openvscode-server, to be installed/updated during container start.

arch
amd64
built

Use it#

Set DOCKER_MODS on the code-server container and recreate it. The mod is pulled on every start; several mods are separated with |.

DOCKER_MODS=ghcr.io/linuxserver-playground/mods:code-server-php-cli

:code-server-php-cli always gets the newest build. To stay on this one, pin its tag:

DOCKER_MODS=ghcr.io/linuxserver-playground/mods:code-server-php-cli-6243284
services:
  code-server:
    image: ghcr.io/linuxserver-playground/code-server:latest
    environment:
      - DOCKER_MODS=ghcr.io/linuxserver-playground/mods:code-server-php-cli

Also for openvscode-server.

Details#

Installing specific PHP version

To install a specific PHP version simply define the environment variable PHP_VERSION with the version of your choice. As this mod uses the ondrej/php repository you can choose from the available versions there.

As default this mod will install PHP 8.2.

Example: PHP_VERSION=8.1

WARNING
Composer requires at least PHP 7.4 to run!

Installing PHP extensions

To install PHP extensions simply define the environment variable PHP_EXTENSIONS. If you want to install multiple extensions, seperate them with |.

Example: PHP_EXTENSIONS=simplexml|gd|zip

Enable Composer binary

To enable the installation of the composer binary, set the environment variable ENABLE_COMPOSER to yes.

Example: ENABLE_COMPOSER=yes

WARNING
Composer requires at least PHP 7.4 to run!

PHP configuration files

You can find all the PHP configuration files at /config/.php. They are symlinked to /etc/php

Community project

Improve this mod, or make your own

Mods are how LinuxServer images grow without getting heavier: a Dockerfile, a few scripts and a mod.yml. If this one is missing something, or you need one like it for another image, an AI agent in our harness can build and test it with you.

Ask your agent

  • The code-server-php-cli mod <what is wrong>. Fix it, test it and draft the PR.
  • Make a mod like code-server-php-cli for <another image>, and test it.

Making a mod Every way to help Get the harness (opens in a new tab)

Source: code-server-php-cli branch (opens in a new tab). Every mod