PHP will read its configuration from:
/opt/bref/etc/php/php.ini(PHP's official production configuration)
/opt/bref/etc/php/conf.d/bref.ini(Bref's optimizations for Lambda)
These files cannot be customized.
You can create your own
php.ini to customize PHP's configuration:
- create a
php/conf.d/subdirectory in your project
- create a
php.inifile inside that directory (the name of the file does not matter, it must have an
PHP will automatically include any
*.ini file found in
php/conf.d/ in your project.
Customizing php.ini using a custom path
If you want PHP to scan a different directory than
php/conf.d/ in your project, you can override the path by setting it in the
PHP_INI_SCAN_DIR environment variable.
PHP_INI_SCAN_DIRmust contain an absolute path. Since your code is placed in
/var/taskon AWS Lambda, the environment variable should contain something like
Learn how to declare environment variables by reading the Environment Variables guide.
Customizing php.ini in extra layers
If you are using Lambda layers, for example to use custom PHP extensions, you can override the default
php.ini by placing your own configuration file in
Make sur to give a unique name to your
.ini file to avoid any collision with other layers.
Bref strives to include the most common PHP extensions. If a major PHP extension is missing please open an issue to discuss it.
Extensions installed and enabled
Extensions installed but disabled by default
- intl - Internationalization extension (referred as Intl) is a wrapper for ICU library, enabling PHP programmers to perform various locale-aware operations.
- APCu - APCu is APC stripped of opcode caching.
- ElastiCache php-memcached extension -
- phpredis - The phpredis extension provides an API for communicating with the Redis key-value store.
- PostgreSQL PDO Driver - PDO_PGSQL is a driver that implements the PHP Data Objects (PDO) interface to enable access from PHP to PostgreSQL databases.
- MySQL PDO Driver - PDO_MYSQL is a driver that implements the PHP Data Objects (PDO) interface to enable access from PHP to MySQL databases.
- Mongodb - Unlike the mongo extension, this extension is developed atop the » libmongoc and » libbson libraries. It provides a minimal API for core driver functionality: commands, queries, writes, connection management, and BSON serialization.
- pthreads - pthreads is an object-orientated API that provides all of the tools needed for multi-threading in PHP. PHP applications can create, read, write, execute and synchronize with Threads, Workers and Threaded objects.
You can enable these extensions by loading them in
php/conf.d/php.ini (as mentioned in the section above), for example:
extension=intl extension=apcu extension=amazon-elasticache-cluster-client.so extension=redis extension=pdo_pgsql extension=pdo_mysql extension=mongodb extension=pthreads
Due to space limitations in AWS Lambda, Bref cannot provide every possible extension. It is however possible to provide your own extensions via custom AWS Lambda layers.
To create your custom layer, you will need to:
- compile the extension (and any required libraries) in the same environment as AWS Lambda and Bref
- include the compiled extension (and required libraries) in a layer
- upload the layer to AWS Lambda
- include it in your project after the Bref layer
- enable the extension in a custom