This reference documentation offers an in-depth description of the behavior and configuration options of the Paketo PHP Buildpack. For explanations of how to use the buildpack for several common use-cases, see the Paketo PHP Buildpack How To documentation.
The Paketo PHP Buildpack supports several versions of PHP and Composer. For more details on the specific versions supported in a given buildpack version, see the release notes.
The Paketo PHP Buildpack is a composite buildpack designed to build applications written in PHP.
With the PHP CNB, the only option for package management is Composer.
The Composer buildpack will install
composer as the package manager, and if a PHP
application contains a
composer.json (and preferably a
composer.lock file) packages
are installed by running
composer install by the Composer Install
buildpack. Packages installed will be available in a
vendor directory in the application source directory, and will be cached for
The buildpacks within the PHP CNB will configure basic configuration for working with FPM, HTTPD, NGINX, or the built-in PHP webserver. Web server choice is set by the user via environment variable (see PHP How To documentation), and user-provided configurations will be considered as outlined below.
Apps built with the buildpack that use Composer as a package manager contain SBOM entries that provide a full picture of the packages installed in the final app image. There are also entries for the installed versions of PHP and Composer. Check out the Access the Software Bill of Materials guide for more information about how to retrieve the SBOM for your app image.
The buildpacks in the PHP language family set default configurations, as well as include configurations from user-provided sources. The sections below outline the various configurations the buildpacks provide during the build process, and the various locations that will also be considered as configuration sources.
This section lists the various configuration sources for PHP
.ini files that
are made available to PHP at run-time.
inifile found from the PHP Distribution itself, with no modifications. It can be found on the container inside the PHP Distribution Buildpack layer under
/etc/buildpack.ini. This includes configurations specific to the buildpack’s install process and app image file system, such as the path to PHP extensions (
extension_dir), the include path to the PHP library directory.
Check out the PHP_INI_SCAN_DIR documentation section for more information.
Configuration for PHP FPM comes from a few sources, listed here in order of precedence from highest to lowest:
listendirective, and other features to make FPM work well with web servers.
$PHPRC/php-fpm.d/www.conf.defaultin the container.
The PHP NGINX Buildpack sets up two flavours of configuration itself, and allows for a third flavour from users. They are listed here in order of highest precedence, to lowest.
<APP-ROOT>/.nginx.conf.d/*-server.confThe former can be used to include user-specific config in the
httpblock, while the latter is used to include user-specific config in the
http.serverblock in the
nginx.confgenerated by the buildpack.
nginx.conffile for running with PHP apps. See PHP How To documentation for settings that can be configured via environment variables.
httpd.conffile for running with PHP apps. See PHP How To documentation for settings that can be configured via environment variables.
The Composer Install Buildpack sets up configuration to be used for running
composer commands. They are listed here in no specific order.
.inifile is created for usage during the buildpack build process only. It will tell Composer where to find extensions when running
.inifile available on the final image under
/workspace/.php.ini.d/composer-extensions.iniwhich will be appended onto the
PHP_INI_SCAN_DIR. It will include any
composer.jsonspecified extensions that come from running the Composer
The buildpacks within the Paketo PHP language family set a number of
environment variables during the
launch phases of the app
lifecycle. The sections below describe each environment variable and its impact
on your app.
iniconfiguration can be found.
--no-interactionflag to Composer commands
|Paketo PHP Dist Buildpack||Required||Installs the PHP distribution, making it available on the $PATH|
|Paketo PHP FPM Buildpack||Required||Configures a
|Paketo Composer Buildpack||Optional||Installs the Composer tool onto the $PATH|
|Paketo Composer Install Buildpack||Optional||Runs
|Paketo HTTPD Buildpack||Optional||Installs Apache HTTPD|
|Paketo NGINX Buildpack||Optional||Installs NGINX|
|Paketo PHP HTTPD Buildpack||Optional||Configures HTTPD to serve a PHP app|
|Paketo PHP NGINX Buildpack||Optional||Configures NGINX to serve a PHP app|
|Paketo PHP Builtin Server Buildpack||Optional||Sets a PHP built-in server start command|
|Paketo PHP Redis Session Handler Buildpack||Optional||Configures a PHP session handler for a Redis instance|
|Paketo PHP Memcached Session Handler Buildpack||Optional||Configures a PHP session handler for a Memcached instance|
|Paketo PHP Start Buildpack||Optional||Sets the start command to serve PHP apps with NGINX or HTTPD with FPM|
|Paketo Procfile Buildpack||Optional||Sets a user-specified start command|
|Paketo Environment Variables Buildpack||Optional||Sets user-specified launch-time environment variables|
|Paketo Image Labels Buildpack||Optional||Adds user-specified labels to app image metadata|
|Paketo CA Certificates Buildpack||Optional||Installs custom CA certificates|
Last modified: September 28, 2023