-
Notifications
You must be signed in to change notification settings - Fork 70
Allow layers to load extra ini files #6
Allow layers to load extra ini files #6
Conversation
f413690
to
9c4871b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/opt/etc/php-7.1.d/ makes perfect sense. Help me understand the function package scan dir and we'll be all set :).
🙏
@@ -15,7 +15,7 @@ function start_webserver() { | |||
// exec the command | |||
$HANDLER = getenv('_HANDLER'); | |||
chdir('/var/task'); | |||
exec("php -S localhost:8000 -c /var/task/php.ini -d extension_dir=/opt/lib/php/7.1/modules '$HANDLER'"); | |||
exec("PHP_INI_SCAN_DIR=/opt/etc/php-7.1.d/:/var/task/php-7.1.d/ php -S localhost:8000 -c /var/task/php.ini -d extension_dir=/opt/lib/php/7.1/modules '$HANDLER'"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sincere question: why add /var/task/php-7.1.d/ when you can simply put a php.ini file at the root of the function package?
Is it a convention (if so, please provide a link to example(s))?
Since the scan dir grabs all ini files in that directory I think it is safer to explicitly put them in a separate directory. As far as I know there is no convention at all. Server less architecture is new for PHP :)
… On 3 Dec 2018, at 08:32, Chase Douglas ***@***.***> wrote:
@txase commented on this pull request.
/opt/etc/php-7.1.d/ makes perfect sense. Help me understand the function package scan dir and we'll be all set :).
🙏
In bootstrap:
> @@ -15,7 +15,7 @@ function start_webserver() {
// exec the command
$HANDLER = getenv('_HANDLER');
chdir('/var/task');
- exec("php -S localhost:8000 -c /var/task/php.ini -d extension_dir=/opt/lib/php/7.1/modules '$HANDLER'");
+ exec("PHP_INI_SCAN_DIR=/opt/etc/php-7.1.d/:/var/task/php-7.1.d/ php -S localhost:8000 -c /var/task/php.ini -d extension_dir=/opt/lib/php/7.1/modules '$HANDLER'");
Sincere question: why add /var/task/php-7.1.d/ when you can simply put a php.ini file at the root of the function package?
Is it a convention (if so, please provide a link to example(s))?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It all makes sense to me, and provides helpful flexibility. 🚀
@@ -63,7 +63,9 @@ extension=json.so | |||
|
|||
Extensions can be built using the lambci/lambda:build-nodejs8.10 Docker image. It is recommended that custom extensions be provided by a separate Lambda Layer with the extension .so files placed in /lib/php/7.1/modules/ so they can be loaded alongside the built-in extensions listed above. | |||
|
|||
#### Example | |||
The extensions can be loaded by adding an ini file in the etc/php-7.1.d this will be picked up automatically |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to edit this a bit post-merge to make it clearer for both layer and package code.
When you create new layers which would load additional extensions you need to be able to load extra ini files. This change will enable this in an easy way. Futhermore this will also enable lambda function to create their own php.ini overrides
For Layers:
Layers should add ini files to etc/php-7.1.d in the zip file it will be automatically be picked up during the bootstrap
For Lambda:
Add you custom ini files to /php-7.1.d and the bootstrap will apply them.