{"id":23003739,"url":"https://github.com/stechstudio/php-lambda","last_synced_at":"2025-04-02T14:25:06.740Z","repository":{"id":150650131,"uuid":"93954112","full_name":"stechstudio/php-lambda","owner":"stechstudio","description":"Build PHP executables for AWS Lambda","archived":false,"fork":false,"pushed_at":"2019-01-18T18:39:17.000Z","size":172,"stargazers_count":24,"open_issues_count":0,"forks_count":4,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-02-08T05:27:45.476Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stechstudio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-10T17:10:57.000Z","updated_at":"2020-12-20T16:58:02.000Z","dependencies_parsed_at":"2023-06-12T06:45:18.393Z","dependency_job_id":null,"html_url":"https://github.com/stechstudio/php-lambda","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stechstudio%2Fphp-lambda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stechstudio%2Fphp-lambda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stechstudio%2Fphp-lambda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stechstudio%2Fphp-lambda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stechstudio","download_url":"https://codeload.github.com/stechstudio/php-lambda/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246829984,"owners_count":20840732,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-15T07:15:12.298Z","updated_at":"2025-04-02T14:25:06.735Z","avatar_url":"https://github.com/stechstudio.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# php : Executable for AWS Lambda\n\nOur company has a significant investment in PHP development as well as AWS. We desire the ability to run [PHP](http://www.php.net/) in [AWS Lambda](https://aws.amazon.com/lambda/) despite the fact that it isn't formally supported. We created this system for building PHP Executables that will run properly in AWS Lambda Functions.\n\n# Testing PHP for AWS Lambda\n\nWe have tested building PHP Versions:\n\n - 7.2\n\nWe keep pre-baked archives on the release page:\n\nhttps://github.com/stechstudio/php-lambda/releases\n\nUn-archive that and skip the entire build process if you like.\n\n# Building PHP for AWS Lambda\n\nThe process depends on [Docker](https://docs.docker.com/engine/installation/).\n\nClone this repository and run:\n\n    $ make\n\nWhen complete you should have something like `export/php-7.2.14.zip` in your working directory and the `php.ini` generated in the package will be in your current directory.\n\n# Publishing the PHP for AWS Lambda\n```\n$\u003e make publish\nDone! Published arn:aws:lambda:us-east-1:965741605173:layer:sts-php-7_2:1\n```\n\n### Overriding php.ini Defaults or Adding other configuration settings.\nYou can create configuration files to customize PHP configuration:\n\n1. create a `php/config.d/` subdirectory in your project.\n1. create a `php.ini` file inside that directory _(the name of the file does not matter, but it must have an `.ini` extensions)_\n\nPHP will automagically scan that directory and load the `*.ini` files you place there, overridding any default settings.\n\n### PHP_INI_SCAN_DIR Environment Variable.\nIf you would like to have PHP scan a different directory in your project, simply set the environment varialbe to and absolute path to the directory you want scanned.\n\n\u003e The `PHP_INI_SCAN_DIR` must contain an absolute path. Since your code is placed in `/var/task` on AWS Lambda the environment variable should contain something like `/var/task/my/different/dir`.\n\nHere is an example of how to define the Environment variable in your SAM template:\n\n```yaml\nResources:\n    MyFunction:\n        Type: AWS::Serverless::Function\n        Properties:\n            # ...\n            Environment:\n                Variables:\n                    PHP_INI_SCAN_DIR: '/var/task/phpScanDir'\n```\n\n## Extensions\n\nWe include a common set of extensions in the PHP layer. \n\nThe layer bundles two categories of extensions.\n\n1. Those that are enabled and can not be disabled.\n2. Those that are disabled and can be enabled.\n\n## Bundled Extensions\n### Enabled, can not be disabled.\n\u003ctable\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd  align=\"left\" valign=\"top\"\u003e\n        \u003cul\u003e\n        \u003cli\u003eCore\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"http://php.net/manual/en/intro.ctype.php\"\u003ectype\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"http://php.net/manual/en/book.curl.php\"\u003ecurl\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003edate\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"http://php.net/manual/en/book.dom.php\"\u003edom\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"http://php.net/manual/en/book.exif.php\"\u003eexif\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"http://php.net/manual/en/book.fileinfo.php\"\u003efileinfo\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"http://php.net/manual/en/book.filter.php\"\u003efilter\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"http://php.net/manual/en/book.ftp.php\"\u003eftp\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"http://php.net/manual/en/book.gettext.php\"\u003egettext\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"http://php.net/manual/en/book.hash.php\"\u003ehash\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"http://php.net/manual/en/book.iconv.php\"\u003eiconv\u003c/a\u003e\u003c/li\u003e\n        \u003c/ul\u003e\n      \u003c/td\u003e\n      \u003ctd  align=\"left\" valign=\"top\"\u003e\n        \u003cul\u003e\n        \u003cli\u003e\u003ca href=\"http://php.net/manual/en/book.json.php\"\u003ejson\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"http://php.net/manual/en/book.libxml.php\"\u003elibxml\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"http://php.net/manual/en/book.mbstring.php\"\u003embstring\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"http://php.net/manual/en/book.mysqlnd.php\"\u003emysqlnd\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"http://php.net/manual/en/book.openssl.php\"\u003eopenssl\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"http://php.net/manual/en/book.pcntl.php\"\u003epcntl\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"http://php.net/manual/en/book.pcre.php\"\u003epcre\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"http://php.net/manual/en/book.PDO.php\"\u003ePDO\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"http://php.net/manual/en/book.pdo_sqlite.php\"\u003epdo_sqlite\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"http://php.net/manual/en/book.Phar.php\"\u003ePhar\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"http://php.net/manual/en/book.posix.php\"\u003eposix\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"http://php.net/manual/en/book.readline.php\"\u003ereadline\u003c/a\u003e\u003c/li\u003e\n        \u003c/ul\u003e\n      \u003c/td\u003e\n      \u003ctd align=\"left\" valign=\"top\"\u003e\n        \u003cul\u003e\n        \u003cli\u003e\u003ca href=\"http://php.net/manual/en/book.Reflection.php\"\u003eReflection\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"http://php.net/manual/en/book.session.php\"\u003esession\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"http://php.net/manual/en/book.SimpleXML.php\"\u003eSimpleXML\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"http://php.net/manual/en/book.sodium.php\"\u003esodium\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"http://php.net/manual/en/book.SPL.php\"\u003eSPL\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"http://php.net/manual/en/book.sqlite3.php\"\u003esqlite3\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"http://php.net/manual/en/book.standard.php\"\u003estandard\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"http://php.net/manual/en/book.tokenizer.php\"\u003etokenizer\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"http://php.net/manual/en/book.xml.php\"\u003exml\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"http://php.net/manual/en/book.xmlreader.php\"\u003exmlreader\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"http://php.net/manual/en/book.xmlwriter.php\"\u003exmlwriter\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"http://php.net/manual/en/book.zlib.php\"\u003ezlib\u003c/a\u003e\u003c/li\u003e\n        \u003c/ul\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n### Disabled, but can be enabled.\n- **[OPCache](http://php.net/manual/en/book.opcache.php)** - OPcache improves PHP performance by storing precompiled script bytecode in shared memory, thereby removing the need for PHP to load and parse scripts on each request.\n- **[intl](http://php.net/manual/en/intro.intl.php)** - Internationalization extension (referred as Intl) is a wrapper for » ICU library, enabling PHP programmers to perform various locale-aware operations.\n- **[APCu](http://php.net/manual/en/intro.apcu.php)** - APCu is APC stripped of opcode caching.\n- **[ElastiCache php-memcached extension](https://docs.aws.amazon.com/AmazonElastiCache/latest/mem-ug/Appendix.PHPAutoDiscoverySetup.html)** - \n- **[phpredis](https://github.com/phpredis/phpredis)** -  The phpredis extension provides an API for communicating with the Redis key-value store. \n- **[PostgreSQL PDO Driver](http://php.net/manual/en/ref.pdo-pgsql.php)** -  PDO_PGSQL is a driver that implements the PHP Data Objects (PDO) interface to enable access from PHP to PostgreSQL databases.\n- **[MySQL PDO Driver](http://php.net/manual/en/ref.pdo-mysql.php)** -  PDO_MYSQL is a driver that implements the PHP Data Objects (PDO) interface to enable access from PHP to MySQL databases.\n- **[Mongodb](http://php.net/manual/en/set.mongodb.php)** - Unlike the mongo extension, this extension is developed atop the » libmongoc and » libbson libraries. It provides a minimal API for core driver functionality: commands, queries, writes, connection management, and BSON serialization.\n- **[pthreads](http://php.net/manual/en/book.pthreads.php)** - pthreads is an object-orientated API that provides all of the tools needed for multi-threading in PHP. PHP applications can create, read, write, execute and synchronize with Threads, Workers and Threaded objects.\n\nYou can enable these extensions by loading them in your project `php/config.d/php.ini`, for example:\n\n```ini\nextension=opcache\nextension=intl\nextension=apcu\nextension=amazon-elasticache-cluster-client.so\nextension=redis\nextension=pdo_pgsql\nextension=pdo_mysql\nextension=mongodb\nextension=pthreads\n```\n\n## Other Extensions\nIf you need an extension that is not available in the layer, you will need to build the extension (and any required libraries) against the PHP binary and libraries in this Layer. Then you can either include it in your own layer, loaded after this layer, or you could simply package the `extensions.so` in your project and add to PHP by setting `extension=/var/task/extension.so` _(must be a an absolute path)_ in your `php/config.d/php.ini`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstechstudio%2Fphp-lambda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstechstudio%2Fphp-lambda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstechstudio%2Fphp-lambda/lists"}