Skip to main content
Skip to main content
🚧 Work in Progress

Customize PHP runtime environment

The default PHP runtime environment contains:

  • Alpine 3.20
  • Selected version of PHP when the runtime service was created
  • zCLI
  • Git and Composer
Note

To use Ubuntu instead of the default Alpine, set the run.os attribute.

Additional packages and tools can be installed using run.prepareCommands.

Runtime Flow​

image

When the first deploy with a defined prepareCommands attribute is triggered, Zerops will

  1. Create a prepare runtime container
  2. Optionally: copy selected folders or files from your build container
  3. Run the run.prepareCommands commands in the defined order

Command exit code​

Failed commands return non-zero exit codes and cancel deployment. Check prepare runtime logs for errors.

Successful commands return exit code 0, triggering the next command. After all prepareCommands complete, the runtime environment is ready for deployment.

The prepare runtime container is deleted once the phase completes or fails.

Custom runtime environment cache​

Some packages or tools can take a long time to install. Therefore, Zerops caches your custom runtime environment after the installation of your custom packages or tools is completed. When the second or following deploy is triggered, Zerops will use the custom runtime cache from the previous deploy if following conditions are met:

  1. Content of the build.addToRunPrepare and run.prepareCommands attributes didn't change from the previous deploy
  2. The custom runtime cache wasn't invalidated in the Zerops GUI.

Clearing Zerops runtime cache​

  1. Go to service detail
  2. Select "Service dashboard & runtime containers"
  3. Click "Open pipeline detail"
  4. Click "Clear runtime prepare cache"

When the custom runtime cache is used, Zerops doesn't create a prepare runtime container and executes the deployment of your application directly.

Overwrite php.ini files​

You can override PHP configuration directives by setting environment variables in your zerops.yml file.

Here's an example of how to adjust PHP's post_max_size directive:

zerops:
# define hostname of your service
- setup: app
# ==== how to build your application ====
run:
# REQUIRED. Sets the base technology for the build environment:
base: php-nginx@8.3

# OPTIONAL. Defines the env variables for the build environment:
envVariables:
PHP_INI_post_max_size: 10M