Giter Club home page Giter Club logo

extra-php-extensions's People

Contributors

1ed avatar aran112000 avatar atbreuer11 avatar bref-bot avatar chekalsky avatar ddeboer avatar deminy avatar grahamcampbell avatar iokiwi avatar lotharthesavior avatar mattrenner avatar mixaster avatar mnapoli avatar nemo64 avatar nyholm avatar petercv avatar pfazzi avatar pgrimaud avatar rdarcy1 avatar rmbl avatar robchett avatar rtc1 avatar sabmeua avatar sbennett-ihasco avatar semsphy avatar smoench avatar starred-gijs avatar sunaoka avatar tillkruss avatar zinc-dev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

extra-php-extensions's Issues

Workflows are referencing vulnerable actions

Hello, there!

As part of the university research we are currently doing regarding the security of Github Actions, we noticed that one or many of the workflows that are part of this repository are referencing vulnerable versions of the third-party actions. As part of a disclosure process, we decided to open issues to notify GitHub Community.

Please note that there are could be some false positives in our methodology, thus not all of the open issues could be valid. If that is the case, please let us know, so that we can improve on our approach. You can contact me directly using an email: ikoishy [at] ncsu.edu

Thanks in advance

  1. The workflow blackfire.yml is referencing action shivammathur/setup-php using references 2.1.2. However this reference is missing the commit 7163319 which may contain fix to the vulnerability.
  2. The workflow deploy-docker.yml is referencing action shivammathur/setup-php using references 2.1.2. However this reference is missing the commit 7163319 which may contain fix to the vulnerability.
  3. The workflow deploy-docker.yml is referencing action shivammathur/setup-php using references 2.1.2. However this reference is missing the commit 7163319 which may contain fix to the vulnerability.
  4. The workflow release.yml is referencing action shivammathur/setup-php using references 2.1.2. However this reference is missing the commit 7163319 which may contain fix to the vulnerability.

The vulnerability fix that is missing by actions' versions could be related to:
(1) CVE fix
(2) upgrade of vulnerable dependency
(3) fix to secret leak and others.
Please consider updating the reference to the action.

If you end up updating the reference, please let us know. We need the stats for the paper :-)

Checksum are never the same

Every time we build a layer we get a new checksum. Somewhere, in our build process, or in the base images, we have something that is non-deterministic.

I wonder what that is? Why don't two builds produce the exact same layers?

SQL Server Library Issues

Hi Team,

Got an issue with using the bref:extra.sqlsrv-php-74 layer with the bref:layer.php-74. Seems consistent if I downgrade the layers all the way back to bref:layer.php-72.

So with these layers:

  layers:
    - ${bref:layer.php-74}
    - ${bref:extra.sqlsrv-php-74}

I consistently get the error:

PHP Warning:  PHP Startup: Unable to load dynamic library '/opt/bref-extra/pdo_sqlsrv.so' (tried: /opt/bref-extra/pdo_sqlsrv.so (**/opt/bref-extra/pdo_sqlsrv.so: undefined symbol: executor_globals**), /opt/bref/lib/php/extensions/no-debug-zts-20190902//opt/bref-extra/pdo_sqlsrv.so.so (/opt/bref/lib/php/extensions/no-debug-zts-20190902//opt/bref-extra/pdo_sqlsrv.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP Warning:  require(/opt/bref/vendor/autoload.php): failed to open stream: No such file or directory in /opt/bootstrap on line 14

The file /opt/bref-extra/pdo_sqlsrv.so exists in the layer.

My php.ini is:

# Enable required extensions here
extension=/opt/bref-extra/pdo_sqlsrv.so

And my serverless environment variable is set:

ODBCSYSINI: /opt/microsoft/conf/

If I was going to make a guess I'd say that its because the pdo_sqlsrv.so file in the bref extras layer is configured to be not thread safe (NTS) while the php executable in bref-74 layer is configured to be thread safe (TS).

Any hints you could provide would be amazing. Am I just doing something wrong here?

Cheers,

Damon

docker error: "tar" executable not found in $PATH

Hello!

I am trying to test a new layer before send the PR, but when I execute the make layers docker shows me an error:

docker: Error response from daemon: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"tar\": executable file not found in $PATH": unknown.
ERRO[0000] error waiting for container: context canceled 

I lost some hours trying to understand what is happening. Is only happening to me or maybe is general? I think that some is wrong in the main docker imagebref/build-php-XX because seems that tar command is not available. But I am not sure.

Anybody can help me to fix it with some clue?

Thank you so much

The 0.6.0 build failed

Here is the build: https://github.com/brefphp/extra-php-extensions/runs/1442677439?check_suite_focus=true

Installing '/opt/bref/lib/php/extensions/no-debug-zts-20190902/yaml.so'
install ok: channel://pecl.php.net/yaml-2.1.0
configuration option "php_ini" is not set to php.ini location
You should add "extension=http://yaml.so" to php.ini
Removing intermediate container d4f47c592d7c
 ---> d4045fcd43c4
Step 8/15 : RUN cp /opt/bref/lib/php/extensions/no-debug-non-zts-*/yaml.so /tmp/yaml.so
 ---> Running in 79c801801b63
cp: cannot stat '/opt/bref/lib/php/extensions/no-debug-non-zts-*/yaml.so': No such file or directory
Makefile:19: recipe for target 'docker-images' failed

It seems like the yaml extension was compiled with zts (/opt/bref/lib/php/extensions/no-debug-zts-20190902/yaml.so), so the cp does not work.

I'm trying to understand why it was compiled with zts 🤔

Extensions failling to load

While looking through CW logs I came across a number of issues where dynamic libraries fail to load or tries loading twice. This only seems to occur with the gmp and redis libraries.

Example of errors below

PHP Warning:  PHP Startup: Unable to load dynamic library 'redis' (tried: /opt/bref/lib/php/extensions/no-debug-non-zts-20200930/redis (/opt/bref/lib/php/extensions/no-debug-non-zts-20200930/redis: cannot open shared object file: No such file or directory), /opt/bref/lib/php/extensions/no-debug-non-zts-20200930/redis.so (/opt/bref/lib/php/extensions/no-debug-non-zts-20200930/redis.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

and

PHP message: PHP Warning:  Module "gmp" is already loaded in Unknown on line 0

I am currently using these layers in the following merge order:

  • arn:aws:lambda:eu-west-2:209497400698:layer:php-80-fpm:6
  • arn:aws:lambda:eu-west-2:403367587399:layer:gmp-php-80:8
  • arn:aws:lambda:eu-west-2:403367587399:layer:redis-php-80:8
  • arn:aws:lambda:eu-west-2:403367587399:layer:gd-php-80:8

and php.ini

extension=redis
extension=intl
extension=/opt/bref-extra/gmp.so

Interestingly when changing the gmp extension to extension=gmp it instead failed to load the library (with same error as redis)

AWS Elasticache Extension

I am trying to create a custom AWS Elasticache Cluster Client extension using an AWS Lambda Layer but can't seem to get it working, per the instructions: https://bref.sh/docs/environment/php.html#custom-extensions

I'm not sure if I'm missing something crucial or the install steps for this extension are non-trivial, but any help is deeply appreciated and others might find this extension useful.

Error:
NOTICE: PHP message: PHP Warning: PHP Startup: Unable to load dynamic library '/opt/bref-extra/amazon-elasticache-cluster-client.so' (tried: /opt/bref-extra/amazon-elasticache-cluster-client.so (/opt/bref-extra/amazon-elasticache-cluster-client.so: cannot open shared object file: No such file or directory), /opt/bref/lib/php/extensions/no-debug-non-zts-20180731//opt/bref-extra/amazon-elasticache-cluster-client.so.so (/opt/bref/lib/php/extensions/no-debug-non-zts-20180731//opt/bref-extra/amazon-elasticache-cluster-client.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

Elasticache Layer Dockerfile:

FROM bref/build-php-73

RUN curl https://elasticache-downloads.s3.amazonaws.com/ClusterClient/PHP-7.3/latest-64bit | tar -C /tmp -zx

FROM public.ecr.aws/lambda/provided:al2

COPY --from=0 /tmp/amazon-elasticache-cluster-client.so /opt/bref-extra/amazon-elasticache-cluster-client.so

custom php.ini
extension=/opt/bref-extra/amazon-elasticache-cluster-client.so

Serverless.yml

provider:
  name: aws
  runtime: provided.al2
plugins:
  - ./vendor/bref/bref
  - ./vendor/bref/extra-php-extensions
functions:
  index:
    handler: index.php
    layers:
      - ${bref:layer.php-73-fpm}
      - arn:aws:lambda:xx:yy:layer:elasticache:1

AWS installation instructions:
https://docs.aws.amazon.com/AmazonElastiCache/latest/mem-ug/Appendix.PHPAutoDiscoverySetup.Installing.html

Usage instructions

Hello,

I'm trying to use the MongoDB extension in my local docker environment. So far i've got the following:

Dockerfile

FROM bref/extra-mongodb-php-74 as mongodbextra
FROM bref/php-74-fpm-dev
COPY --from=mongodbextra /opt/bref-extra/mongodb.so /opt/bref-extra/

php/conf.d/mongo.ini

extension=/opt/bref-extra/mongodb.so

I'm getting this:

PHP Warning: PHP Startup: Unable to load dynamic library '/opt/bref-extra/mongodb.so' (tried: /opt/bref-extra/mongodb.so (/opt/bref-extra/mongodb.so: undefined symbol: executor_globals)

I haven't been able to locate a guide as to how to use these docker images. Can someone please advise?

GetLayerVersion redis layer, not authorized

Hello everyone.
I'm running into an issue with the latest bref-extra-layer for redis.
During deployment it says the following error.

Resource update cancelled                                        
Resource handler returned message: "User: arn:aws:iam::*:user/andre is not authorized to perform: lambda:GetLayerVersion on resource: arn:aws:lambda:us-east-1:209497400698:layer:redis-php-80:11 (Service: Lambda, Status Code: 403, Request ID: 6a5a8970-d753-4bda-b906-073bc4b26dcd, Extended Request ID: null)" (RequestToken: 849d2db0-1351-9e1c-1791-e2e8369e99d4, HandlerErrorCode: AccessDenied)  

It seems like the layer image is not properly uplopaded.

Can you help me please?

My sam template part:

Layers:
                - !Sub 'arn:aws:lambda:${AWS::Region}:209497400698:layer:php-80:16'
                - !Sub 'arn:aws:lambda:${AWS::Region}:209497400698:layer:redis-php-80:11'

My region is us-east-1.

Thanks in advance.

Beste,
André

New Relic Extension doesn't work with infrequent requests

Hi,

I currently have a lambda application that is run about once a day. The app is configured to report to daemon running in AWS Fargate. The agent however is not logging web transactions or exceptions on a single request.

I have spoken to @goldenplec about this around March (sorry Aidan I got busy...) who implemented this extension. It is something to do how the agent collates the data and then sends to the daemon. @goldenplec will explain it a lot better than I ever could.

We did try a few things but nothing worked. So raising this here to see what can be done and to make people aware of the limitations of this extension.

Error when using Serverless 3.0

After upgrading Serverless to version 3.0.0 I got the error below

Environment: linux, node 14.18.3, framework 3.0.0, plugin 6.0.0, SDK 4.3.0
Docs:        docs.serverless.com
Support:     forum.serverless.com
Bugs:        github.com/serverless/serverless/issues

Error:
TypeError: Cannot read property 'bind' of undefined
    at new ServerlessPlugin (/home/filipemansano/konfetti/backend/source/vendor/bref/extra-php-extensions/index.js:45:33)
    at PluginManager.addPlugin (/usr/local/lib/node_modules/serverless/lib/classes/plugin-manager.js:88:28)
    at /usr/local/lib/node_modules/serverless/lib/classes/plugin-manager.js:135:33
    at Array.forEach (<anonymous>)
    at PluginManager.loadAllPlugins (/usr/local/lib/node_modules/serverless/lib/classes/plugin-manager.js:135:8)
    at Serverless.init (/usr/local/lib/node_modules/serverless/lib/serverless.js:137:30)
    at async /usr/local/lib/node_modules/serverless/scripts/serverless.js:529:7

version of bref and bref/extra-php-extensions used

"name": "bref/bref",
"version": "1.5.1",
"source": {
    "type": "git",
    "url": "https://github.com/brefphp/bref.git",
    "reference": "a627683f69416812dade926792bbd9ef2cc78f66"
},
"name": "bref/extra-php-extensions",
  "version": "0.11.21",
  "source": {
      "type": "git",
      "url": "https://github.com/brefphp/extra-php-extensions.git",
      "reference": "7fbb7241b8b9705b90d44298d382cf5d268c0911"
  },

Functions failing due to "error while loading shared libraries: libncurses.so.6"

As suggested by @mnapoli in this issue, it appears there may be some issue with an extension causing the following error to occur when a new function is started:

/opt/bin/php: error while loading shared libraries: libncurses.so.6: cannot open shared object file: No such file or directory

This occurs even when starting with a fresh deployment via serverless deploy and serverless deploy --stage prod, as well as on a new AWS account (to attempt to eliminate as many variables as possible).

My serverless.yml contains the following:

functions:
  worker:
    handler: worker.php
    layers:
      - ${bref:layer.php-80}
    events:
      -   sqs:
            arn:
              Fn::GetAtt: [ VehicleUpdateQueue, Arn ]
            # Only 1 item at a time to simplify error handling
            batchSize: 1

package:
  exclude:
    - .env
    - node_modules/**
    - public/storage
    - resources/assets/**
    - storage/**
    - tests/**

plugins:
  - ./vendor/bref/bref
  - ./vendor/bref/extra-php-extensions

If it matters as well, I am on the following versions:

  • bref/bref: 1.0.0
  • bref/extra-php-extensions: 0.7.2
  • bref/laravel-bridge: 1.0.0
  • laravel/framework: 8.16.1

Local docker development environment

Do you also publish the layers in Docker Hub so they can be installed in your local development setup? Or do you recommend installing the extensions directly in the base development docker image by using a custom Dockerfile?

Automatically enable extensions?

Would it make sense to automatically enable extensions when the layer is used?

That would simplify the installation steps: just import the layer and that's it.

How? PHP currently looks for *.ini files in 2 places:

https://github.com/brefphp/bref/blob/c3ca836239e2a9d5445235599b2e932de267ddb7/runtime/base/php-74.Dockerfile#L76

I think this works (I kinda remember some problems with this months ago, not sure), and I think it would be possible for the extra layers to include a pgsql.ini file (for example) in /opt/bref/etc/php/conf.d that would load the extension.

WDYT?

Newrelic extension

This isn't a bug, it a suggestion.

Create an extension layer with the Newrelic APM.

Layer ARN

I'm looking into integrating AWS Cognito and we're making use of JWT Framework to validate the tokens. I'll be needing the GMP extension, but I don't use the Serverless Framework. I wanted to know what's the Layer ARN that I can use to enable the extension.

Thanks!

Add to packagist

We should review/change the package name in composer.json and then add this package to packagist.

(If package name is changed in composer.json we also need to update the readme (plugin path))

Unknown Bref variable

Just updated to serverless 2.38.0 from 2.35.0 and getting this:

Cannot resolve variable at "functions.customSMSSender.layers.1": Error: Unknown Bref variable ${bref:extra.mongodb-php-80}, the only supported syntax right now is ${bref:layer.XXX}

customSMSSender:
handler: lambda_functions/LaravelHandle.php
timeout: 180
layers:
- ${bref:layer.php-80}
- ${bref:extra.mongodb-php-80}

Is there a new syntax that must be used?

Support for pgsql

I really thank you for your great work.
I added support for pgsql (not pdo-pgsql) so I'd like to pull request it if it works fine.

https://github.com/sabmeua/extra-php-extensions/tree/ext_pgsql

Now I made sure that the build is good with Travis CI. But I don't know how to add it to my serverless.yml as new layer and confirm it.

https://travis-ci.org/sabmeua/extra-php-extensions

I guess that to add a new layer, it needs to create a zip file from the docker image which generated above. How to create the zip file?

Usage with Laravel Vapor

I am currently using Laravel Vapor to run Serverless PHP through AWS. By default, Vapor has an option to use Imagick based on this repository see. I was wondering how I can extend this functionality to add SQLSrv support to my project.

Thanks in advance!

NewRelic: include newrelic-daemon executable as Lambda Extension

I have been playing around with this idea, and I created a Lambda Layer and using the Lambda Extension API and the newrelic-daemon executable. Its a very basic implementation, and there is indeed the occasional connection issue with cold starts, as the docs mention already

2021-04-08 11:22:17.607 +0000 (14 14) warning: daemon connect(fd=5 host=127.0.0.1, port=31339) returned -1 errno=ECONNREFUSED. Failed to connect to the newrelic-daemon. Please make sure that there is a properly configured newrelic-daemon running. For additional assistance, please see: https://newrelic.com/docs/php/newrelic-daemon-startup-modes

But for us this has been working really well, so I was wondering if the community could benefit from including the newrelic-daemon in this newrelic layer (and optionally use it)

We would need 2 additional files in the layer
extensions/bin/newrelic-daemon
extensions/newrelic.sh

where newrelic.sh is a bash script registering the Lambda Extension API and starting the daemon, based on this example

#!/bin/bash
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0

set -euo pipefail

OWN_FILENAME="$(basename $0)"
LAMBDA_EXTENSION_NAME="$OWN_FILENAME" # (external) extension name has to match the filename
TMPFILE=/tmp/$OWN_FILENAME

# Graceful Shutdown
_term() {
  echo "[${LAMBDA_EXTENSION_NAME}] Received SIGTERM"
  # forward SIGTERM to child procs and exit
  kill -TERM "$PID" 2>/dev/null
  echo "[${LAMBDA_EXTENSION_NAME}] Exiting"
  exit 0
}

forward_sigterm_and_wait() {
  trap _term SIGTERM
  wait "$PID"
  trap - SIGTERM
}

# Registration
HEADERS="$(mktemp)"
echo "[${LAMBDA_EXTENSION_NAME}] Registering at http://${AWS_LAMBDA_RUNTIME_API}/2020-01-01/extension/register"
curl -sS -LD "$HEADERS" -XPOST "http://${AWS_LAMBDA_RUNTIME_API}/2020-01-01/extension/register" --header "Lambda-Extension-Name: ${LAMBDA_EXTENSION_NAME}" -d "{ \"events\": [\"INVOKE\", \"SHUTDOWN\"]}" > $TMPFILE

RESPONSE=$(<$TMPFILE)
HEADINFO=$(<$HEADERS)
# Extract Extension ID from response headers
EXTENSION_ID=$(grep -Fi Lambda-Extension-Identifier "$HEADERS" | tr -d '[:space:]' | cut -d: -f2)

# Start NewRelic Daemon and accept all connections
/opt/extensions/bin/newrelic-daemon --address=0.0.0.0:31339 --logfile=/proc/self/fd/2

# Event processing
while true
do
  # Get an event. The HTTP request will block until one is received
  curl -sS -L -XGET "http://${AWS_LAMBDA_RUNTIME_API}/2020-01-01/extension/event/next" --header "Lambda-Extension-Identifier: ${EXTENSION_ID}" > $TMPFILE &
  PID=$!
  forward_sigterm_and_wait

  EVENT_DATA=$(<$TMPFILE)
  if [[ $EVENT_DATA == *"SHUTDOWN"* ]]; then
    echo "[extension: ${LAMBDA_EXTENSION_NAME}] Received SHUTDOWN event. Exiting."  1>&2;
    exit 0 # Exit if we receive a SHUTDOWN event
  fi

done

But than modified to only register if some environment var is set. Im also not a bash expert, I copied the example from amazon as starting point

Im curious to find out what you think about this, please share your thoughts!

Can't load blackfire layer `undefined symbol: compiler_globals`

PHP 7.4. I'm using the vapor base layer, which could be the issue but I thought i'd ask here in case there's an easy fix.
I'll continue to debug and see if i can get it working :)

PHP Warning:  PHP Startup: Unable to load dynamic library '/opt/bref-extra/blackfire.so' (tried: /opt/bref-extra/blackfire.so (/opt/bref-extra/blackfire.so: undefined symbol: compiler_globals), /opt/bin//opt/bref-extra/blackfire.so.so (/opt/bin//opt/bref-extra/blackfire.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0```

Add support for GD

We require the GD library (bref/php-74-fpm) for processing WebP images, any chance this is an easy one to add?

Bug in imagick when rendering text on a page - cannot write text on image (freetype missing?)

In trying to write text on an image using Imagick, the following error comes up when using the imagick layer;

php-fpm: DelegateLibrarySupportNotBuiltIn '/var/task/public/fonts/Arial.ttf' (Freetype) @ warning/annotate.c/RenderFreetype/1844.
CRITICAL - request()] Uncaught PHP Exception ImagickException: "Failed to query the font metrics" at /var/task/src/GeoJSON2Image.php line 484

The line of code is the following;
$canvas = new Imagick();
....
$draw = new ImagickDraw();
$label = 'my label';
...
$metrics = $canvas->queryFontMetrics($draw, $label);

It's basically to add annotations (text, explaining parts of an image).
Any help would be appreciated -- i'm a little stuck with what to do, and it looks like there's some vague mention of it elsewhere, with a reference to freetype not being included when compiling imagick (when imagick was used in other projects (outside of Bref))

Generating images of PDFs with Imagick

Hi,

I am using the Imagick layer with Laravel Vapor and need to be able to generate images of each page of a PDF. My code looks like this:

$this->imagick->setResolution($this->resolution, $this->resolution);
$this->imagick->readImage("{$this->path}[{$index}]");
$this->imagick->setFormat($this->format);

I have confirmed file exists in the /tmp directory, but when the readImage method is executed, I get the following exception:

ImagickException: Failed to read the file

I have also tried reading the file in with readImageBlob like so:

$this->imagick->setResolution($this->resolution, $this->resolution);
$this->imagick->readImageBlob(file_get_contents($this->path));
$this->imagick->setIterator($index);
$this->imagick->setFormat($this->format);

This results in the following exception:

ImagickException: Unable to read image blob

Does anybody now how this can be resolved?

gmp: Unable to initialize module

Hi, gmp is not working anymore.

PHP Warning:  PHP Startup: gmp: Unable to initialize module
Module compiled with build ID=API20190902,TS
PHP    compiled with build ID=API20190902,NTS
These options need to match

composer.json:

"bref/bref": "^1.0",
"bref/extra-php-extensions": "^0.6.3",

Runtime: provided.al2

GD extension latest version support

I use a lambda function to generate images backed by bref. Internally I've used gd library & gd lambda layer.

Functionally, everything works fine but there is a difference between generated image on lambda function & local. I did a more detailed investigation & found out that the gd library version on production is different than local. I suspect that can be the issue in my case.

Local docker GD version

image

Bref lambda production GD

image

I was trying to look into a way to upgrade GD library version, it would be great if I get some directions. I'll try to send a PR.

Imagick extension stopped working

Couple of days ago imagick extension I've used stopped working. I thought it was connected to #99 but apparently it's not.

I've made very simple bref app to demonstrate it.
https://github.com/chekalsky/bref-imagick-issue

image

Error:
PHP Warning: PHP Startup: Unable to load dynamic library '/opt/bref-extra/imagick.so' (tried: /opt/bref-extra/imagick.so (libgomp.so.1: cannot open shared object file: No such file or directory), /opt/bref/lib/php/extensions/no-debug-non-zts-20190902//opt/bref-extra/imagick.so.so (/opt/bref/lib/php/extensions/no-debug-non-zts-20190902//opt/bref-extra/imagick.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

Layer imagick - ICC profile manipulation via Lcms2

Hi

I need to manipulate ICC profiles, it worked in the local machine, but not an AWS lambda.

I had a log time in troubleshooting, until I come to this one:
https://stackoverflow.com/questions/47414462/php-imagick-wont-add-icc-color-profile

Because I was not able to find out the installed delegators using the Imagick class or phpinfo, to watch imagigk linked libraries I've added following in my php handler:
system('find / -name imagick.so -exec ldd {} \; 2>/dev/null');

Locally i could spot ...
liblcms2.so.2 => /usr/lib/x86_64-linux-gnu/liblcms2.so.2
... but on Lambda execution not.

Checking the Dockerfile I see that the linked library is copied into the layer (ref)
COPY --from=ext /usr/lib64/liblcms2.so.2 /opt/bref/lib/liblcms2.so.2

But a manual compilation of the docker-image (layer=imagick php_versions=80 make docker-images) when configuring ImageMagick showed:

Delegate library configuration:
  [...]
  LCMS              --with-lcms=yes             no
  [...]

Therefore I've re-compiled adding lcms2-devel in the # Prepare environment step (see PR), and now:

Delegate library configuration:
  [...]
  LCMS              --with-lcms=yes             yes
  [...]

Built all, deployed (mi first) layer to AWS, updated serverless.yml, deployed function and now:

liblcms2.so.2 => /opt/bref/lib/liblcms2.so.2 (0x00007f6eacd7c000)

and the ICC profile conversion worked on Lambda too 🥳.

Here all my steps to the bones:

  1. git clone [email protected]:brefphp/extra-php-extensions.git
  2. cd extra-php-extensions/
  3. Update layers/imagick/Dockerfile or checkout my PR
  4. layer=imagick php_versions=80 make docker-images
  5. layer=imagick php_versions=80 make layers
  6. aws lambda publish-layer-version --layer-name imagick-php-80 --zip-file fileb://./export/layer-imagick-php-80.zip
  7. Edit serverless.yml in original project and use your "LayerVersionArn" (from the aws lambda publish-layer-version) instead of ${bref-extra:imagick-php-80}

Class not found

Anything else I need to do in order to get Memcached/Redis Extension to work besides adding the two layers to my function?
I've added the following two
${bref-extra:memcached-php-74}
${bref-extra:redis-php-74}

I'm still getting errors such as:

Error: Class "Redis" not found in file /var/task/vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php on line 75

PHP: 8.0
Bref version: 1.4.1
Bref extra-php-extensions version: 0.11.21

SQLSRV extension error with libmsodbcsql

Starting with release 0.9.6, getting an error with the SQLSRV layer when connecting with sqlsrv_connect(). Using Bref 1.2.0.

[{
	"SQLSTATE": "01000",
	"code": 0,
	"message": "[unixODBC][Driver Manager]Can't open lib '\/opt\/microsoft\/msodbcsql17\/lib64\/libmsodbcsql-17.6.so.1.1' : file not found"
}]

Downgrading to bref/extra-php-extentions 0.9.5 fixes it while still using Bref 1.2.0.

memcached-php-80 missing

Looks like you've recently added a memcached build for 8.1, could it be availabled for us people stuck on 8.0?

`bref-extra:oci8-php-80` doesn't work

Hello. Let me ask you a question.
I think I've defined the extension correctly, but it doesn't work.

↓ serverless.yml

functions:
    # This function runs the Laravel website/API
    web:
        handler: public/index.php
        timeout: 28 # in seconds (API Gateway has a timeout of 29 seconds)
        layers:
            - ${bref:layer.php-74-fpm}
            - ${bref-extra:oci8-php-80}
        events:
            - httpApi: '*'
    # This function lets us run artisan commands in Lambda
    artisan:
        handler: artisan
        timeout: 120 # in seconds
        layers:
            - ${bref:layer.php-74} # PHP
            - ${bref:layer.console} # The "console" layer

plugins:
    # We need to include the Bref plugin
    - ./vendor/bref/bref
    - ./vendor/bref/extra-php-extensions

image

image

image

Do I need to set anything else?

Layer imagick - SVG Support

Where having issues rendering SVG files, and think it may have todo with imagemagic not being built with rsvg.

Is there a way we can get SVG build options added to the Docker build?

Im not sure if its
--with-rsvg=yes
or
--with-librsvg

Redis layer missing on PHP 8.1

The Redis layer which was added by @shouze under the following commit for PHP 8.1 doesn't appear to actually work:
f5fe449

When registered for a function PHP reports the Redis function never loaded - verified with get_loaded_extensions(). No sign of any startup errors from PHP which I would have expected, any idea how to debug/resolve this?

Unknown Bref extra layer named "gd-php-74"

I'm receiving this error when launching serverless
I've added the layer this way:
- ${bref:extra.gd-php-74}
I see no problem when using another extension for example:
- ${bref:extra.memcached-php-74}

Bref 1.0 support

Hi, it would be nice to update the bref dependency to support version ^1.0, thanks!

Problem 1
    - Installation request for bref/extra-php-extensions ^0.6.3 -> satisfiable by bref/extra-php-extensions[0.6.3].
    - bref/laravel-bridge 0.2.3 requires bref/bref ~0.5.20 -> satisfiable by bref/bref[0.5.x-dev].
    - bref/extra-php-extensions 0.6.3 conflicts with bref/bref[0.5.x-dev].
    - Installation request for bref/laravel-bridge ^0.2.3 -> satisfiable by bref/laravel-bridge[0.2.3].

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.