Open Nyholm opened 4 years ago
Or that at least a sane value should be used:
https://github.com/brefphp/bref/blob/master/runtime/layers/fpm-dev/Dockerfile#L32
aka - the doc should probably give an example like PHP_INI_SCAN_DIR=:/var/task/my_codebase/_my_custom_path
(with the :
at the beginning) - see https://www.php.net/manual/en/configuration.file.php
UPDATE: somehow it doesn't work and you have to explicitly set the original path, PHP_INI_SCAN_DIR=/opt/bref/etc/php/conf.d:/var/task/my_codebase/_my_custom_path
- thanks https://github.com/brefphp/bref/issues/1363#issuecomment-1358008629 🎉
We enabled Postgres extension in our project in v1 some years ago. Recently we upgraded to Bref v2 and found issues related to this env var.
Upgrading from v1.7.47 to v2.3.1 required these changes in our PHP 8.1 project:
serverless.yml
# Before
provider:
environment:
PHP_INI_SCAN_DIR: /var/task/devops/aws/serverless/php/conf.d
# After
provider:
environment:
PHP_INI_SCAN_DIR: /opt/bref/etc/php/conf.d/:/var/task/devops/aws/serverless/php/conf.d
If we don't prepend /opt/bref/etc/php/conf.d/:
the postgres extensions were not loaded and we got PDO driver errors.
php.ini inside /var/task/devops/aws/serverless/php/conf.d
# Before
extension=pdo_pgsql
extension=/opt/bref-extra/mongodb.so
# After
extension=pdo_pgsql
If we don't remove the mongodb extension load, we got mongodb extension already loaded warnings.
So it seems that a safe value in our project for PHP_INI_SCAN_DIR must have /opt/bref/etc/php/conf.d/:
and this must be included in the docs https://bref.sh/docs/environment/php#customizing-phpini-using-a-custom-path
Took me sometime to figure what was wrong and how to solve it with the current documentation.
Maybe the Bref serverless extension could check PHP_INI_SCAN_DIR var and show a message if /opt/bref/etc/php/conf.d/: is not found in the string.
If we override
PHP_INI_SCAN_DIR
then the "special php.ini" files will not be used. Ie: https://github.com/brefphp/bref/blob/0.5.9/runtime/layers/fpm/php.ini