A Cloud Native Buildpack for configuring a Memcached session handler in PHP apps.
The buildpack generates an .ini
configuration snippet to allow for connecting
to an external Memcached server as a session handler. The servers
, username
, and password
are configurable via service bindings.
The PHP Memcached Session Handler CNB provides nothing, and only requires
php
at launch time. It detects on the presence of a service binding of
type php-memcached-session
.
As mentioned above, the buildpack participates in the build if the user
provides a service
binding of type php-memcached-session
.
The build command will look like:
pack build myapp --env SERVICE_BINDING_ROOT=/bindings --volume <absolute-path-to-binding>:/bindings/php-memcached-session
Inside of the binding itself, the following configuration can be set:
servers
(Default127.0.0.1
): Memcached instance IP addressusername
(Default""
): Memcached instance username, if there is onepassword
(Default""
): Memcached instance password, if there is one
The configurations from the service binding are parsed and used to create a
php-memcached.ini
file with session configurations. The php-memcached.ini
file is
available in the PHP Memcached Session Handler buildpack layer on the image, and
its path is appended to the PHP_INI_SCAN_DIR
for usage when the app starts up.
To package this buildpack for consumption:
$ ./scripts/package.sh
This builds the buildpack's Go source using GOOS=linux
by default. You can
supply another value as the first argument to package.sh
.
To run all unit tests, run:
./scripts/unit.sh
To run all integration tests, run:
./scripts/integration.sh
For extra debug logs from the image build process, set the $BP_LOG_LEVEL
environment variable to DEBUG
at build-time (ex. pack build my-app --env BP_LOG_LEVEL=DEBUG
or through a project.toml
file.