Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile PHP with Mongodb/Postgress #9

Open
migsyboy opened this issue Mar 15, 2018 · 4 comments
Open

Compile PHP with Mongodb/Postgress #9

migsyboy opened this issue Mar 15, 2018 · 4 comments

Comments

@migsyboy
Copy link

Thank you for this great work.

Do you know what needs to be done to compile php with Mongodb and Postgress support?

I have read that those modules need to be statically compiled and bundled into the compiled PHP, but I'm lost as to how to do it.

Best regards.

@shamp00
Copy link
Member

shamp00 commented Mar 16, 2018

You need to modify dockerfile.buildphp to include your dependencies. (That is, add mongodb-org and postrgresql-server to the yum install part near the top. I'm no expert on php, so there's probably more to it than that...) Then run

sh buildphp.sh

which rebuilds your php binary.

Make sure your code works locally with

sls invoke local --function hello

This ensures your you've built your php correctly. If not keep modifying and building the php binary until it works. Then

sls deploy

and check it works remotely with

sls invoke --function hello

Hope that helps.

@migsyboy
Copy link
Author

Hello.

Thank you for your answer.

Sure, yum install will install Mongodb and Postgres on the server, but don't you need to recompile PHP and let the compiler know that you want Mongodb and Postgres support?

Regards.

@shamp00
Copy link
Member

shamp00 commented Mar 17, 2018

Yes buildphp.sh recompiles php. You need to modify buildphp.sh so that it builds your perfect php binary. You may need to change .configure or other changes in order to do so. To make sure you've got the right php binary, you can check it works locally before uploading anything to amazon as explained above with sls invoke local.

@Phyrom
Copy link

Phyrom commented May 24, 2018

Have you got any chance to get Mongodb included in your php binary and get it working with Lambda? If you have done so, can you please help light me through... I am bumping into the same situation.

I want to include redis also because I want to use with Elasticache for Redis.

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants