Skip to content
This repository was archived by the owner on Sep 8, 2021. It is now read-only.
This repository was archived by the owner on Sep 8, 2021. It is now read-only.

JSON extension not available #2

Closed

Description

@colinpizarek

First off, thanks for the layer. Great stuff. I'm using your ARN as a layer in a function. Works well, but I'm not able to use the JSON extension. I see that it's supposed to be enabled, but it's tossing errors.

I wrote a simple script to dump the config and the json extension is not there:

<?php 
$output = [];
$output['version'] = phpversion();
$output['extensions'] = get_loaded_extensions( false );

if (function_exists('json_encode') ){
    header('Content-Type: application/json');
    echo json_encode( $output );
} else {
    var_dump( $output );
}
?>

Here's the output:

array(2) { ["version"]=> string(5) "7.1.7" ["extensions"]=> array(15) { [0]=> string(4) "Core" [1]=> string(4) "date" [2]=> string(6) "libxml" [3]=> string(7) "openssl" [4]=> string(4) "pcre" [5]=> string(4) "zlib" [6]=> string(6) "filter" [7]=> string(4) "hash" [8]=> string(5) "pcntl" [9]=> string(8) "readline" [10]=> string(10) "Reflection" [11]=> string(3) "SPL" [12]=> string(7) "session" [13]=> string(8) "standard" [14]=> string(10) "cli_server" } }

You can see the live config readout here:
https://twp4slm6ji.execute-api.us-east-1.amazonaws.com/beta

Activity

  1. txase commented on Nov 30, 2018

    @txase
    Member

    Can you try adding a php.ini file to the root of your source code package with:

    extension_dir=/opt/lib/php/7.1/modules
  2. colinpizarek commented on Dec 1, 2018

    @colinpizarek
    Author

    Yes. Same result. I've attached my scripts; it's running at the same URL shown above.

    phpinfo-2.zip

  3. txase commented on Dec 1, 2018

    @txase
    Member

    I found a few issues with layer version 3 related to the php.ini and extension dir locations. I just released a new version of the layer. To use json, all you need to do now is make sure you have a php.ini file with:

    extension=json.so

    The readme has been updated to make it clear that to use one of the modules provided in the layer you must load it in your php.ini first.

    Thanks!

  4. colinpizarek commented on Dec 1, 2018

    @colinpizarek
    Author

    Confirmed the issue is fixed. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions