diff --git a/Makefile b/Makefile index 4057a87..eee5fce 100644 --- a/Makefile +++ b/Makefile @@ -3,10 +3,10 @@ ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) all: php71.zip php73.zip php71.zip: - docker run --rm -e http_proxy=${http_proxy} -v $(ROOT_DIR):/opt/layer lambci/lambda:build-nodejs8.10 /opt/layer/build.sh + docker run --rm -e http_proxy=${http_proxy} -v $(ROOT_DIR):/opt/layer lambci/lambda:build-provided /opt/layer/build.sh php73.zip: - docker run --rm -e http_proxy=${http_proxy} -v $(ROOT_DIR):/opt/layer lambci/lambda:build-nodejs8.10 /opt/layer/build-php-remi.sh 3 + docker run --rm -e http_proxy=${http_proxy} -v $(ROOT_DIR):/opt/layer lambci/lambda:build-provided /opt/layer/build-php-remi.sh 3 upload71: php71.zip ./upload.sh 7.1 diff --git a/README.md b/README.md index c6d8b71..f71456d 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,9 @@ This is an early iteration of the PHP runtime Layer which is not yet ready for p ## Current Layer Version ARN When creating/updating a Lambda function you must specify a specific version of the layer. This readme will be kept up to date with the latest version available. The latest available Lambda Layer Version ARNs for PHP 7.3 and 7.1 are: -**arn:aws:lambda:\:887080169480:layer:php73:2** +**arn:aws:lambda:\:887080169480:layer:php73:3** -**arn:aws:lambda:\:887080169480:layer:php71:9** +**arn:aws:lambda:\:887080169480:layer:php71:10** See [Releases](https://github.com/stackery/php-lambda-layer/releases) for release notes. @@ -37,6 +37,45 @@ Replace ${PHP_VERSION} with '7.3', or '7.1' according to your preferred runtime. ##### Extensions The following extensions are built into the layer and available in /opt/lib/php/${PHP_VERSION}/modules: +PHP 7.3 Layer: +``` +bz2.so +calendar.so +ctype.so +curl.so +dom.so +exif.so +fileinfo.so +ftp.so +gettext.so +iconv.so +json.so +mbstring.so +mysqli.so +mysqlnd.so +pdo_mysql.so +pdo_pgsql.so +pdo.so +pdo_sqlite.so +pgsql.so +phar.so +posix.so +shmop.so +simplexml.so +sockets.so +sqlite3.so +sysvmsg.so +sysvsem.so +sysvshm.so +tokenizer.so +wddx.so +xmlreader.so +xml.so +xmlwriter.so +xsl.so +``` + +PHP 7.1 Layer: ``` bz2.so calendar.so @@ -105,7 +144,7 @@ Resources: Timeout: 30 Tracing: Active Layers: - - !Sub arn:aws:lambda:${AWS::Region}:887080169480:layer:php73:2 + - !Sub arn:aws:lambda:${AWS::Region}:887080169480:layer:php73:3 Events: api: Type: Api diff --git a/bootstrap b/bootstrap index 91969bd..bf39035 100755 --- a/bootstrap +++ b/bootstrap @@ -134,10 +134,10 @@ while (true) { $uri .= "&"; } - $uri .= $name; + $uri .= rawurlencode($name) . '='; if ($value != '') { - $uri .= '=' . $value; + $uri .= rawurlencode($value); } } } @@ -145,7 +145,7 @@ while (true) { $ch = curl_init("http://localhost:8000$uri"); - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, FALSE); if (array_key_exists('multiValueHeaders', $event)) { $headers = array(); @@ -171,13 +171,7 @@ while (true) { } if (strlen($body) > 0) { - if($event['httpMethod'] === 'POST'){ - curl_setopt($ch, CURLOPT_POSTFIELDS, $body); - } - curl_setopt($ch, CURLOPT_INFILESIZE, strlen($body)); - curl_setopt($ch, CURLOPT_READFUNCTION, function ($ch, $fd, $length) use ($body) { - return $body; - }); + curl_setopt($ch, CURLOPT_POSTFIELDS, $body); } $response = array(); diff --git a/build-php-remi.sh b/build-php-remi.sh index c0d0ee0..8d8fbef 100755 --- a/build-php-remi.sh +++ b/build-php-remi.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -e PHP_MINOR_VERSION=$1 @@ -8,9 +8,8 @@ yum install -y wget yum install -y yum-utils wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm wget https://rpms.remirepo.net/enterprise/remi-release-6.rpm -rpm -Uvh remi-release-6.rpm rpm -Uvh epel-release-latest-6.noarch.rpm - +rpm -Uvh remi-release-6.rpm yum-config-manager --enable remi-php7${PHP_MINOR_VERSION} @@ -18,7 +17,7 @@ yum install -y httpd yum install -y postgresql-devel yum install -y libargon2-devel -yum install -y --disablerepo="*" --enablerepo="remi,remi-php7${PHP_MINOR_VERSION}" php php-mbstring php-pdo php-mysql php-pgsql +yum install -y --disablerepo="*" --enablerepo="remi,remi-php7${PHP_MINOR_VERSION}" php php-mbstring php-pdo php-mysql php-pgsql php-xml php-process mkdir /tmp/layer @@ -37,6 +36,7 @@ done cp /usr/lib64/libedit.so.0 lib/ cp /usr/lib64/libargon2.so.0 lib/ cp /usr/lib64/libpq.so.5 lib/ +cp /usr/lib64/libonig.so.5 lib/ mkdir -p lib/php/7.${PHP_MINOR_VERSION} cp -a /usr/lib64/php/modules lib/php/7.${PHP_MINOR_VERSION}/