xp-forge / lambda

AWS Lambda for the XP Framework
3 stars 0 forks source link

PHP extensions #8

Open thekid opened 2 years ago

thekid commented 2 years ago

Currently, we compile with the following extensions enabled:

Looking at https://bref.sh/docs/environment/php.html#extensions-installed-and-enabled and from scanning through use cases, the following could be interesting:

The following extensions don't seem to make sense for an AWS lambda enviromment:

thekid commented 2 years ago

However, all these increase the PHP binary size, it might be valuable looking into providing these as extra layers like Bref does, but instead of hosting them somewhere, providing a xp lambda layer command to create them from scratch

thekid commented 2 years ago

libxml, dom, xml, xmlreader, xmlwriter - for processing XML and HTML

See #11

thekid commented 2 years ago

mbstring - prerequisite for exif anyways

See #12

thekid commented 2 years ago

https://packagist.org/packages/aws/aws-sdk-php and https://packagist.org/packages/async-aws/core require SimpleXML

thekid commented 2 years ago

https://packagist.org/packages/aws/aws-sdk-php and https://packagist.org/packages/async-aws/core require SimpleXML

Rolled out in https://github.com/xp-forge/lambda/releases/tag/v3.1.0

thekid commented 2 years ago

ZLib could be implemented via https://gist.github.com/chobie/6659137 as a fallback:

"You can use my implementation freely even for commercial purpose ..."

thekid commented 2 years ago

ZLib could be implemented

...but on the other hand, simply adding the --with-zlib configure option doesn't yield a big difference!

Before:

[+] Creating runtime-8.0.21.zip
 => create --name 62d00678ec295 lambda-xp-runtime:8.0.21
aeb956bff0da38d5254234ca63e3594a5f6f9dff9ed485353cd08557194d4fef
 => cp 62d00678ec295:/opt/php/runtime.zip runtime-8.0.21.zip
 => rm -f 62d00678ec295
aeb956bff0da38d5254234ca63e3594a5f6f9dff9ed485353cd08557194d4fef

Wrote 2,530,040 bytes

After:

[+] Creating runtime-8.0.21.zip
 => create --name 62d008947c97a lambda-xp-runtime:8.0.21
bd517bac950db0f3542c93ba2ef63faeeb991b5873b5b083b3c8282ebb5094d8
 => cp 62d008947c97a:/opt/php/runtime.zip runtime-8.0.21.zip
 => rm -f 62d008947c97a
bd517bac950db0f3542c93ba2ef63faeeb991b5873b5b083b3c8282ebb5094d8

Wrote 2,542,744 bytes

(~12 Kilobytes)

thekid commented 2 years ago

zlib - if we want to create ZIP files, HTTP compression

Rolled out in https://github.com/xp-forge/lambda/releases/tag/v4.1.0

thekid commented 1 year ago

The configure line used is:

./configure \
  --prefix=/opt/php/ \
  --without-sqlite3 \
  --with-zlib \
  --with-openssl \
  --enable-bcmath \
  --disable-pdo