Giter Site home page Giter Site logo

sumonst21 / serverless-php Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zerosharp/serverless-php

0.0 2.0 0.0 25.83 MB

Serverless Framework example using an AWS lambda which runs a PHP function

License: Other

Shell 36.59% JavaScript 53.47% PHP 9.94%

serverless-php's Introduction

PHP with the Serverless Framework

In order to use PHP on AWS Lambda you need to bundle the PHP binary, including the required libraries, into the package. This serverless example project includes the necessary binary to run a simple PHP script.

See my blog post here.

Prerequisites

Install this serverless project. It will create a new serverless-php folder.

serverless install --url https://github.com/ZeroSharp/serverless-php

Deploying the sample function to AWS

Check the serverless.yml file and modify region and stage if necessary.

sls deploy

Running the function locally

sls invoke local --function hello

Running the function on AWS

sls invoke --function hello

Rebuilding the PHP binary

If you need different compiler flags or dependencies you will need to recompile PHP.

Prerequisites

Compile the static standalone PHP 7 binary

To do this, we have to compile the PHP 7.2.2 with statically linked libraries:

sh buildphp.sh

PHP Version

The default is to use the PHP 7.2.2 branch to compile the PHP binary. To switch the PHP version you can set the branch PHP_VERSION_GIT_BRANCH parameter in buildphp.sh line 8.

Thanks

Thanks to:

serverless-php's People

Contributors

shamp00 avatar oh-sky avatar

Watchers

Md. Sumon Islam avatar  avatar

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.