Closed prolic closed 4 years ago
@prolic you very probably don't want to do that. I invite you to run AWS' documentation about Lambda layers. You can use several, so you can have your layer override/extend the Bref layer.
BTW I updated https://bref.sh/docs/environment/php.html it may help you a bit more. But at the moment I don't have time to write a complete guide (I mean on my open source time).
Thanks, I'll have a look.
Hi, i followed the instructions to enable the pdo_mysql extenstion, but i was not able to get it work. I created a directory(php/conf.d
) in my project with an custom php.ini file. But it seems like its beeing ignored. Does someone already tried to connect to an mysql db with his project?
my php.ini file contains only one line
extension=pdo_mysql
I was able to do this earlier, and could confirm by just putting phpinfo();
into my handler script then checking the extension is loaded (it goes away when I remove the php.ini
file or comment out the extension=pdo_mysql
line).
How do you know it's not being loaded? Are you seeing an error?
I'm using Symfony4 and the first error i got was "could not load driver" , then i investigated a little bit and found, that there is no extension for pdo_mysql. I tried to get the config with ini_get_all("pdo_mysql");
. Then i received an Exception "Unable to find extension 'pdo_mysql'". Can you try to get the ini_get_all in your project?
Which bref version do you use ?
Le ven. 1 févr. 2019 à 17:38, j-tec notifications@github.com a écrit :
I'm using Symfony4 and the first error i got was "could not load driver" , then i investigated a little bit and found, that there is no extension for pdo_mysql. I tried to get the config with ini_get_all("pdo_mysql");. Then i received an Exception "Unable to find extension 'pdo_mysql'". Can you try to get the ini_get_all in your project?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mnapoli/bref/issues/198#issuecomment-459784629, or mute the thread https://github.com/notifications/unsubscribe-auth/ABhO9J5L5mA5hI68XcYPGglUB56Rrakgks5vJG2UgaJpZM4aLG0J .
var_dump(ini_get_all("pdo_mysql"));
gives me
array(1) {
["pdo_mysql.default_socket"]=> array(3) {
["global_value"]=> string(15) "/tmp/mysql.sock"
["local_value"]=> string(15) "/tmp/mysql.sock"
["access"]=> int(4)
}
}
Which bref version do you use
Good point, I wonder if it's a manifestation of this..? https://github.com/mnapoli/bref/pull/219#issuecomment-459670739
@j-tec, what version of PHP is running on your host machine? If it's less than 7.2, you won't be getting the latest version of Bref, and the layers / extensions won't work
im using bref in version 0.3.x-dev
, PHP 7.2.11
on my composer-runing machine and this layer:
arn:aws:lambda:eu-central-1:416566615250:layer:php-72-fpm:1
and the layer was the issue - it is not possible to enable the pdo_mysql extension with this 7.2 layer.
I switched to arn:aws:lambda:eu-central-1:209497400698:layer:php-73-fpm:1
and not its working fine.
thanks @all ;-)
@j-tec You have to switch to tag ^0.3,
and change the layer reference : layer_version
+1 On this. I just found #96 and Laravel Telescope requires bcmath
to work. Not sure how I would compile it and add an extra layer with the extension.
Hey all, there is https://github.com/stechstudio/bref-extensions by @bubba-h57 which is a good starting point.
Is there any documentation about custom layers which describes the structure needed for an custom php extension? I just want to install gd.so but i have no idea how i have to set up the layer. Can someone share his experiance with custom layers?
I have thee same problem as @j-tec. I need to add the php_gd2 extension to my project, but have no idea on how to do it using lambda layers.
Hello. I'm also having the same issue. Already read everything about the custom layers both in bref and amazon and I've been fighting to get php to load soap.so through a custom layers.
Here's what I understand is the right process:
I still get the errror that dinamic library soap could not be loaded, but when I do a function to print the folders and files, lambda actually decompressed the soap.so in the right place, and the php.info page shows that the soap.ini file is beeping read.
I hope it helps you get closer at least.
And if anyone managed to get soap working please please let me know. I'm going nuts here.
Awesome work by the way
Hi @awackate, I think this might be because you need 2 things:
soap.so
PHP extensionwhich would match the error you describe:
I still get the errror that dinamic library soap could not be loaded
The PHP extension may be actually just a proxy to behavior that is implemented in a shared system library.
Note that this is just a supposition, I'm not familiar with that extension.
That makes a lot of sense. I'll look into that since there's no much info on soap around.
In case that fails, is there a way I can recompile everything but with soap turned on? Making my own php layer won't be enough to do a laravel project right?
In case that fails, is there a way I can recompile everything but with soap turned on?
I am afraid you will have the same problem. In the build scripts we explicitly include system libraries that we want to include in the layer (those needed by the PHP extensions we include). So you'll still be missing the soap system library (if they actually exist, because again I don't know at all).
Thank you Matthieu. It's nice to have such a quick reply. I failed miserably at identifing any missing system library missing for this to work. So I'm giving up on this pursuit.
Any chance you'll be including SOAP in the libraries any time soon? Or do you any idea of how can I go forward from this? I need SOAP because Google's Adwords API requires it and I'm trying to connect to that.
Thank you
As i wrote in #283 Soap must be enables when building php,
@awackate if you want to you just need to add --enable-soap
in the php.Dockerfile and rebuild the layer.
We also use Google Library and all works :)
Hi, any plans to include gd or imagick libraries?
@atrope and @mnapoli thank you very much. I managed to compile my own php layer with soap and it works perfectly. For anyone having this issue, it's not a big investment of time and it's worth it.
@awackate happy to hear that, it might be very useful to some folks in the future if you described in a few steps what you did. At the moment this issue is kind of "the documentation" so feel free to contribute to it ;)
You can read how to add PHP extensions in https://github.com/brefphp/extra-php-extensions
@mnapoli can you give some quick hints on how I can create another layer on top with a custom php extension? I need to have this extension https://github.com/allegro/php-protobuf/ available. If not possible for you, I would need to fork your repository in order to temper with the docker file, so it's included in the main layer.