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.

Extension not loaded #40

Open
Open

Description

@danieljosephbrennan

I am getting this error: "Use of undefined constant XML_PI_NODE - assumed 'XML_PI_NODE' (this will throw an Error in a future version of PHP)"
This seems to indicate that the xml extension is not loaded, but I have added it to php.ini

Activity

  1. JDJunge commented on Jun 13, 2019

    @JDJunge

    I ran into a surprisingly similar issue just yesterday.
    My mysql extension was not loaded.

    I guess the php.ini file is in the wrong directory. In the resulting lambda-layer it will be found under /opt/php.ini but the bootstrap will search for it somewhere else.

    I changed
    exec("PHP_INI_SCAN_DIR=/opt/etc/php-7.${phpMinorVersion}.d/:/var/task/php-7.${phpMinorVersion}.d/ php -S localhost:8000 -c /var/task/php.ini -d extension_dir=/opt/lib/php/7.${phpMinorVersion}/modules '$handler_filename'");

    To
    exec("PHP_INI_SCAN_DIR=/opt/ php -S localhost:8000 -c /opt/php.ini -d extension_dir=/opt/lib/php/7.${phpMinorVersion}/modules '$handler_filename'");

    Now extensions are beeing loaded (confimed via phpinfo())

  2. security-intel commented on Jul 30, 2019

    @security-intel

    Hi there. So i bumped into the same issue also, trying to install a PHP layer on my dumb AWS lambda function(I needed the json and mbstring modules). In my case, the above solution didn't work, as I was getting a permission denied error:

    RequestId: xxxxxxxxx Error: Runtime failed to start: fork/exec /opt/bootstrap: permission denied
    Runtime.ExitError
    

    The solution was to update the exec line to:

    exec("PHP_INI_SCAN_DIR=/opt/etc/php-7.${phpMinorVersion}.d/:/var/task/php-7.${phpMinorVersion}.d/ php -S localhost:8000 -c /var/task/php.ini -d extension_dir=/opt/lib/php/7.${phpMinorVersion}/modules '$handler_filename'");

    and add the php.ini file, that includes all the modules I need, at the top level of my lambda function folder, next to all the other files. As the lambda env runs at /var/task , setting the path at /var/task/php.ini worked for me.

    Extensions are loaded now.

    Hope this helps. All the best

  3. zilahir commented on Sep 9, 2019

    @zilahir

    The extensions are not loaded for me either, and don't know how to approach this problem.

    I am getting the following error in the logs.

    [Mon Sep 9 16:11:29 2019] PHP Warning: PHP Startup: Unable to load dynamic library 'xml.so' (tried: /opt/lib/php/7.3/modules/xml.so (/opt/lib/php/7.3/modules/xml.so: cannot open shared object file: No such file or directory), /opt/lib/php/7.3/modules/xml.so.so (/opt/lib/php/7.3/modules/xml.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
    

    According to the docs, the modules should be there, but apparently they are not.

    Any ideas, suggestions? Thanks in advance!

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