Service type
PHP service
PHP runtime service for custom applications and framework-based workloads.
This service runs your code: its image is built from a Git repository, and each build is deployed to an app environment.
On this page
Technical profile
Versions, source repository, and Helm chart.
Stacks that use it
Public stacks that include this service.
Source builds and CI/CD
Boilerplates, Git providers, CI, and container registries.
Service configuration
Links to other services.
Services based on it
Catalog services that inherit from this one.
On Wodby
How PHP runs on Wodby
Linked services
Links to other services reach the application as environment variables. Read them in code; do not hardcode hosts or credentials.
| Link | Variables |
|---|---|
| Database (MariaDB, MySQL or PostgreSQL) | DB_HOST, DB_PORT, DB_NAME (also DB_DATABASE), DB_USERNAME, DB_PASSWORD, DB_DRIVER (also DB_CONNECTION) |
MSMTP_HOST, MSMTP_PORT | |
| OpenTelemetry Collector | OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_PROTOCOL (http/protobuf), OTEL_EXPORTER_OTLP_HEADERS (the Collector's ingest token), OTEL_PHP_AUTOLOAD_ENABLED (true) |
Mail needs no code: PHP's mail() is delivered through the linked mail service. An SMTP library or credentials in the codebase are not required.
A variable is present only while its link exists and the linked service is enabled.
The opentelemetry extension is enabled in the image. To send traces, add the OpenTelemetry PHP SDK, the OTLP exporter and an HTTP client with Composer (open-telemetry/sdk, open-telemetry/exporter-otlp and php-http/guzzle7-adapter), plus auto-instrumentation packages for the framework if wanted; with the link, the SDK configures itself from the variables above. Set OTEL_SERVICE_NAME to name the application in traces. Without the link the SDK stays off.
Generated configuration
On every start the container writes $CONF_DIR/wodby.settings.php (normally /var/www/conf/wodby.settings.php), a $wodby array with the environment's hosts, the files directory and the linked database's connection details. Framework services built on this one extend it and include it for the application. It is outside the codebase and rewritten on start: never edit it or copy its values into the repository. In a plain PHP application, read the variables above.
PHP settings
PHP and PHP-FPM are configured through environment variables on the service, such as PHP_MEMORY_LIMIT, PHP_MAX_EXECUTION_TIME or PHP_FPM_PM_MAX_CHILDREN, not through a php.ini in the repository. A change applies with the next deployment of the service.
Environment
WODBY_HOSTSis a JSON array of the environment's hosts;WODBY_PRIMARY_HOSTandWODBY_PRIMARY_URLare the canonical ones for links generated outside a request.WODBY_ENV_TYPEtells a development environment from a production-like one.
In a development workspace
- The code is served from the checkout as it is on disk. PHP checks files for changes on every request, so an edit needs no restart.
- PHP-FPM handles requests as
wodby, the user that owns the checkout, so it reads what the developer can read and the files it writes stay editable over SSH. - Dependencies are installed by workspace setup with
composer install;/vendor/is kept out of Git status. - A change to variables or linked services still needs a deployment of the environment.
Overview
Technical profile of PHP
Versions
Source repository
Public Helm chart
Stacks
Stacks that include PHP
CI/CD
Build PHP from a Git repository
Composer boilerplate
Use it as it is, or clone it into your own Git account.
wodby/php-package-boilerplateGit providers
You connect a repository through an integration with its Git provider.
CI providers
Wodby CI is built in: the pipeline is the file .wodby/pipeline.yml in the repository. For a repository you connect, an external CI provider can run the same steps with Wodby CLI.
Container registries
Built images go to Wodby Registry by default, or to an external registry that you connect as an integration.
Environment variables from integrations
A variable integration stores the credentials of a third-party service once. Attach it to PHP and Wodby passes them to the container as environment variables at runtime, not during the image build.
Configuration
PHP service configuration
Service links
Each link is a connection from PHP to another service. A stack sets which service a link points to. The cards list the public services that can satisfy each link.
db
Services that can satisfy this link
sendmail
Services that can satisfy this link
otel
Services that can satisfy this link
Based on this service