ZeroSharp / serverless-php

Serverless Framework example using an AWS lambda which runs a PHP function
Other
145 stars 20 forks source link

libcurl problem after building PHP #2

Closed jaikdean closed 7 years ago

jaikdean commented 7 years ago

After building PHP 7.1.0 and deploying to Lambda, I get the following error when executing my function:

stderr: ./php: /usr/lib64/libcurl.so.4: no version information available (required by ./php)
shamp00 commented 7 years ago

Yeah me too, but for me it does not prevent my function from running (is it for you?). But I can see the message in the logs. I think it's because the libcurl library used by the lambda container is conflicting with the one php is using. I tried excluding libcurl4-openssl-dev and/or the --with-curl options in dockerfile.buildphp but then my function did not run at all.

I don't know PHP well enough to know how to fix it properly. I wrote a blog post about a more complete example here in case that helps, but it still outputs that error in the logs.

jaypea commented 7 years ago

aws lambda runs in an ec2 environment with amazonlinux as os. installed libraries might live in other directories than on ubuntu.

so it might help to base your dockerfile on https://hub.docker.com/_/amazonlinux/ instead of ubuntu.

fyi: amazonlinux is based on redhat and uses yum to install packages and likely uses the same package names as redhat/centos does.

Stolz commented 7 years ago

I've forked the repo and I've updated Docker config to use Amazon Linux instead of Ubuntu, since that's the AMI from which Lambda is ran.

I'm not creating a PR since my PHP ./configure is too minimal and tailor made for my needs but please feel free to apply any changes you want:

https://github.com/Stolz/serverless-php/commit/0448ba59b6aa1ba663cfc42f4afab967f1a7a24c

shamp00 commented 7 years ago

Wow that's great @Stolz! I've been meaning to look into this myself but I've been snowed under. Thanks for the help! I'll try and integrate your changes.

shamp00 commented 7 years ago

Thanks everyone I've updated the php build script. Blog post here.