Closed n10000k closed 5 years ago
Hi @narwy
Where is your php.ini file located?
@txase It's from the ARN, no php.ini
in the zip on the lambda function.
You need to add a php.ini somewhere (according to the docs in the README, the easiest way is at the root of the function package) with extension=json.so
. The way I read things, your initial issue comment makes it sound like you added this php.ini file somewhere, but your last comment makes it sound like you haven't. Can you clarify?
Thanks!
Sorry, the first comment was in reference do the master branch, having it in the php.ini
.
Example Usage:
I use the Stackery ARN provided in the docs, (I don't compile the repo and make my own).
Add the layer to my Lambda function using the ARN.
In a PHP file I try to run json_decode()
, it will fail due to undefined function.
I'm now assuming the provided ARN does not have json.so
?
But the master branch has json.so
in the php.ini
? But not in the ARN version ?
Ahh, I understand your confusion now. The php.ini
file in this project is used internally by bootstrap
. It is not used by your function code.
The layer provides many standard extensions pre-built, but you must still enable them by adding your own php.ini
file in your function package. For your usage, you can simply add a php.ini
file at the root of you function package with:
extension=json.so
Then your function code should work.
I'm going to close this issue as I believe the layer is operating as expected. Please re-open if you find that it's still not working correctly. And if you want to propose a PR to the docs (or maybe just a comment in the php.ini
file of this project stating that the values specified within are not used when running the function code) that would be awesome :).
Thanks!
Seeing this error. I followed the documentation and created php.ini ile at the root of my function package with:
extension=json.so
But still facing same issue. Can anyone tell me why I'm seeing this?
@maliksajid you can use the new ARN which has the json extension by default 👍
@narwy where is the new ARN can you paste it here. which one works for you? Thank You.
Hi,
php.ini
is showingextension=json.so
but is this enabled on the ARN v5?undefined function json_decode()
doesn't seem to be using it?