Skip to content

Commit 9c4871b

Browse files
committed
Allow layers to load extra ini files and allow the task to load additional ini files
1 parent 76a2d02 commit 9c4871b

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

README.md

Lines changed: 3 additions & 1 deletion
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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function start_webserver() {
1515
// exec the command
1616
$HANDLER = getenv('_HANDLER');
1717
chdir('/var/task');
18-
exec("php -S localhost:8000 -c /var/task/php.ini -d extension_dir=/opt/lib/php/7.1/modules '$HANDLER'");
18+
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'");
1919
exit;
2020

2121
// return the child pid to parent
@@ -137,7 +137,7 @@ while (true) {
137137
array_push($headers, "${name}: ${value}");
138138
}
139139
}
140-
140+
141141
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
142142
}
143143

@@ -216,4 +216,4 @@ while (true) {
216216
curl_close($ch);
217217
}
218218

219-
?>
219+
?>

0 commit comments

Comments
 (0)