Skip to content

Commit 2f32b04

Browse files
authored
Merge pull request stackery#6 from JerryVerhoef/fix-scan-additional-php-ini-files
Allow layers to load extra ini files
2 parents 75eeb3f + 9c4871b commit 2f32b04

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ extension=json.so
6363

6464
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.
6565

66-
#### Example
66+
The extensions can be loaded by adding an ini file in the etc/php-7.1.d this will be picked up automatically
67+
68+
#### SAM Example
6769
Let's create an AWS SAM PHP application. We suggest using [Stackery](https://stackery.io) to make this super simple. It automates all the scaffolding shown below. But you may also choose to roll your own application from scratch.
6870

6971
First, install [AWS SAM CLI](https://github.com/awslabs/aws-sam-cli). Make sure to create a SAM deployment bucket as shown in [Packaging your application](https://github.com/awslabs/aws-sam-cli/blob/develop/docs/deploying_serverless_applications.rst#packaging-your-application)

bootstrap

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function start_webserver() {
1818
// exec the command
1919
$HANDLER = getenv('_HANDLER');
2020
chdir('/var/task');
21-
exec("php -S localhost:8000 -c /var/task/php.ini -d extension_dir=/opt/lib/php/7.1/modules '$HANDLER'");
21+
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'");
2222
exit;
2323

2424
// return the child pid to parent

0 commit comments

Comments
 (0)