From 9d7452805a4aee13a7860687f4b3c03fb933bef3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milan=20Felix=20=C5=A0ulc?= Date: Mon, 27 Mar 2023 13:11:22 +0200 Subject: [PATCH 1/7] [0.3.x] upgrade php libraries, use node 14 --- Makefile | 2 +- package-lock.json | 22 +++++++++++----------- package.json | 4 ++-- src/utils.ts | 4 ++-- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 186e07d0..a8a400fb 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ test-watch: publish: rm -rf ./dist - npm publish --access public --tag latest + npm publish --access public canary: rm -rf ./dist diff --git a/package-lock.json b/package-lock.json index 319d72b3..33f53f39 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,15 @@ { "name": "vercel-php", - "version": "0.5.2", + "version": "0.3.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "vercel-php", - "version": "0.5.2", + "version": "0.3.3", "license": "MIT", "dependencies": { - "@libphp/amazon-linux-2-v81": "*" + "@libphp/amazon-linux-2-v74": "latest" }, "devDependencies": { "@types/glob": "^7.1.2", @@ -948,10 +948,10 @@ "@jridgewell/sourcemap-codec": "^1.4.10" } }, - "node_modules/@libphp/amazon-linux-2-v81": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/@libphp/amazon-linux-2-v81/-/amazon-linux-2-v81-0.0.1.tgz", - "integrity": "sha512-cR7w79FZr91x1ur0eR5DWX+Wb1hDuYdxzka6vIzUMMmsuW1NBaEpwDQu4icJizNVS26NwpUtDTJGIoEomBiYxA==" + "node_modules/@libphp/amazon-linux-2-v74": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/@libphp/amazon-linux-2-v74/-/amazon-linux-2-v74-0.0.10.tgz", + "integrity": "sha512-+kQWM2X88+wU3XuO02BqpJClUMPuuxnEzZkpSN0nvCfHHfjxAH5XzXq1pMiQqUuuZn3U5cnCidH4qGg9K32yEg==" }, "node_modules/@sinclair/typebox": { "version": "0.24.35", @@ -4187,10 +4187,10 @@ "@jridgewell/sourcemap-codec": "^1.4.10" } }, - "@libphp/amazon-linux-2-v81": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/@libphp/amazon-linux-2-v81/-/amazon-linux-2-v81-0.0.1.tgz", - "integrity": "sha512-cR7w79FZr91x1ur0eR5DWX+Wb1hDuYdxzka6vIzUMMmsuW1NBaEpwDQu4icJizNVS26NwpUtDTJGIoEomBiYxA==" + "@libphp/amazon-linux-2-v74": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/@libphp/amazon-linux-2-v74/-/amazon-linux-2-v74-0.0.10.tgz", + "integrity": "sha512-+kQWM2X88+wU3XuO02BqpJClUMPuuxnEzZkpSN0nvCfHHfjxAH5XzXq1pMiQqUuuZn3U5cnCidH4qGg9K32yEg==" }, "@sinclair/typebox": { "version": "0.24.35", diff --git a/package.json b/package.json index b0880c54..68a9228c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "vercel-php", "description": "Vercel PHP runtime", - "version": "0.5.2", + "version": "0.3.3", "license": "MIT", "main": "./dist/index.js", "homepage": "https://github.com/juicyfx/vercel-php", @@ -31,7 +31,7 @@ "conf" ], "dependencies": { - "@libphp/amazon-linux-2-v81": "latest" + "@libphp/amazon-linux-2-v74": "latest" }, "devDependencies": { "@types/glob": "^7.1.2", diff --git a/src/utils.ts b/src/utils.ts index 120222d3..ede88f24 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,9 +1,9 @@ import path from 'path'; import { spawn, SpawnOptions } from 'child_process'; import { File, FileFsRef, FileBlob } from '@vercel/build-utils'; -import * as libphp from "@libphp/amazon-linux-2-v81"; +import * as libphp from "@libphp/amazon-linux-2-v74"; -const PHP_PKG = path.dirname(require.resolve('@libphp/amazon-linux-2-v81/package.json')); +const PHP_PKG = path.dirname(require.resolve('@libphp/amazon-linux-2-v74/package.json')); const PHP_BIN_DIR = path.join(PHP_PKG, "native/php"); const PHP_MODULES_DIR = path.join(PHP_BIN_DIR, "modules"); const PHP_LIB_DIR = path.join(PHP_PKG, "native/lib"); From f09c7684ab15b8666a76fde68498099cad70fcb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milan=20Felix=20=C5=A0ulc?= Date: Tue, 23 Jan 2024 20:39:04 +0100 Subject: [PATCH 2/7] [0.3.x] upgrade to node18 --- package-lock.json | 4 ++-- package.json | 2 +- src/index.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 33f53f39..a1cfb38a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "vercel-php", - "version": "0.3.3", + "version": "0.3.4", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "vercel-php", - "version": "0.3.3", + "version": "0.3.4", "license": "MIT", "dependencies": { "@libphp/amazon-linux-2-v74": "latest" diff --git a/package.json b/package.json index 68a9228c..8870eaa2 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "vercel-php", "description": "Vercel PHP runtime", - "version": "0.3.3", + "version": "0.3.4", "license": "MIT", "main": "./dist/index.js", "homepage": "https://github.com/juicyfx/vercel-php", diff --git a/src/index.ts b/src/index.ts index 2ef57572..bdbde502 100644 --- a/src/index.ts +++ b/src/index.ts @@ -123,7 +123,7 @@ export const build: BuildV3 = async ({ ...runtimeFiles }, handler: 'launcher.launcher', - runtime: 'nodejs14.x', + runtime: 'nodejs18.x', environment: { NOW_ENTRYPOINT: entrypoint, NOW_PHP_DEV: meta.isDev ? '1' : '0' From f960ecbc9e91c0f362f0ad7ce4cb11beea867123 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milan=20Felix=20=C5=A0ulc?= Date: Wed, 24 Jan 2024 01:07:14 +0100 Subject: [PATCH 3/7] [0.3.x] update LD_LIBRARY_PATH --- package.json | 2 +- src/launchers/builtin.ts | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 8870eaa2..214048e0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "vercel-php", "description": "Vercel PHP runtime", - "version": "0.3.4", + "version": "0.3.5", "license": "MIT", "main": "./dist/index.js", "homepage": "https://github.com/juicyfx/vercel-php", diff --git a/src/launchers/builtin.ts b/src/launchers/builtin.ts index 5a94dee1..82035793 100644 --- a/src/launchers/builtin.ts +++ b/src/launchers/builtin.ts @@ -22,7 +22,10 @@ async function startServer(entrypoint: string): Promise { // php spawn options const options: SpawnOptions = { stdio: ['pipe', 'pipe', 'pipe'], - env: process.env + env: { + ...process.env, + LD_LIBRARY_PATH: `/var/task/lib:${process.env.LD_LIBRARY_PATH}` + } }; // now vs now-dev From 5cecd01958e323d7b630003523d4b3fcca568172 Mon Sep 17 00:00:00 2001 From: Marcelo Roberto Jimenez Date: Sat, 18 Nov 2023 08:05:53 -0300 Subject: [PATCH 4/7] CI: use node 18.x --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 46e5e2ec..49c8064d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,7 +12,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v1 with: - node-version: '14.x' + node-version: "18.x" - name: Dependencies run: make install From 30b6fb09c5a2bd8bf05a296109a7076da05a9bc8 Mon Sep 17 00:00:00 2001 From: Marcelo Roberto Jimenez Date: Sat, 18 Nov 2023 09:19:35 -0300 Subject: [PATCH 5/7] CI: update checkout and setup-node --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 49c8064d..b1729a2d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,10 +7,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v1 + uses: actions/checkout@v4 - name: Setup Node - uses: actions/setup-node@v1 + uses: actions/setup-node@v4 with: node-version: "18.x" From fc9f407a12bf3cf61919ec0865f82184216221aa Mon Sep 17 00:00:00 2001 From: Tom Lienard Date: Sat, 13 Apr 2024 21:03:48 +0100 Subject: [PATCH 6/7] [0.3.x] fix: autodetect nodejs runtime --- src/index.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index bdbde502..652a16ec 100644 --- a/src/index.ts +++ b/src/index.ts @@ -6,7 +6,8 @@ import { download, Lambda, BuildV3, - PrepareCache + PrepareCache, + getNodeVersion } from '@vercel/build-utils'; import { getPhpFiles, @@ -113,6 +114,7 @@ export const build: BuildV3 = async ({ } console.log('🐘 Creating lambda'); + const nodeVersion = await getNodeVersion(workPath); const lambda = new Lambda({ files: { @@ -123,7 +125,7 @@ export const build: BuildV3 = async ({ ...runtimeFiles }, handler: 'launcher.launcher', - runtime: 'nodejs18.x', + runtime: nodeVersion.runtime, environment: { NOW_ENTRYPOINT: entrypoint, NOW_PHP_DEV: meta.isDev ? '1' : '0' From a82bfd530487e2376f6ae83d483f05977138b623 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milan=20Felix=20=C5=A0ulc?= Date: Tue, 16 Apr 2024 08:54:55 +0200 Subject: [PATCH 7/7] [0.3.x] bump 0.3.6 --- README.md | 28 +++++++++++++--------------- package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 064ab274..27d67a4c 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ Second file `vercel.json` is pure gold here. Setup your project with configurati { "functions": { "api/*.php": { - "runtime": "vercel-php@0.5.2" + "runtime": "vercel-php@0.3.6" } } } @@ -80,7 +80,7 @@ Are you ready to deploy your first PHP project to Vercel? Click & Go! ## 🤗 Features - **Architecture**: PHP development server (🚀 fast enough) -- **PHP version**: 8.1.4 +- **PHP version**: 7.0.x - **Extensions**: apcu, bcmath, brotli, bz2, calendar, Core, ctype, curl, date, dom, ds, exif, fileinfo, filter, ftp, geoip, gettext, hash, iconv, igbinary, imap, intl, json, libxml, lua, mbstring, mongodb, msgpack, mysqli, mysqlnd, openssl, pcntl, pcre, PDO, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, phalcon, Phar, protobuf, readline, redis, Reflection, runkit7, session, SimpleXML, soap, sockets, sodium, SPL, sqlite3, standard, swoole, timecop, tokenizer, uuid, xml, xmlreader, xmlrpc, xmlwriter, xsl, Zend OPcache, zlib, zip - **Speed**: cold ~250ms / warm ~5ms - **Memory**: ~90mb @@ -90,9 +90,7 @@ Are you ready to deploy your first PHP project to Vercel? Click & Go! ## 💯 Versions -- `vercel-php@0.5.2` - PHP 8.1.x -- `vercel-php@0.4.0` - PHP 8.0.x -- `vercel-php@0.3.2` - PHP 7.4.x +- `vercel-php@0.3.6` - PHP 7.4.x ## ⚙️ Usage @@ -105,7 +103,7 @@ If you need to route everything to index, use `routes` property. { "functions": { "api/*.php": { - "runtime": "vercel-php@0.5.2" + "runtime": "vercel-php@0.3.6" } }, "routes": [ @@ -180,19 +178,19 @@ project { "functions": { "api/*.php": { - "runtime": "vercel-php@0.5.2" + "runtime": "vercel-php@0.3.6" }, // Can be list also directly "api/index.php": { - "runtime": "vercel-php@0.5.2" + "runtime": "vercel-php@0.3.6" }, "api/users.php": { - "runtime": "vercel-php@0.5.2" + "runtime": "vercel-php@0.3.6" }, "api/books.php": { - "runtime": "vercel-php@0.5.2" + "runtime": "vercel-php@0.3.6" } } } @@ -207,7 +205,7 @@ project { "functions": { "api/index.php": { - "runtime": "vercel-php@0.5.2" + "runtime": "vercel-php@0.3.6" } }, "routes": [ @@ -227,7 +225,7 @@ Additional function properties are `memory`, `maxDuration`. Learn more about [fu { "functions": { "api/*.php": { - "runtime": "vercel-php@0.5.2", + "runtime": "vercel-php@0.3.6", "memory": 3008, "maxDuration": 60 } @@ -254,7 +252,7 @@ project { "functions": { "api/*.php": { - "runtime": "vercel-php@0.5.2" + "runtime": "vercel-php@0.3.6" } } } @@ -293,7 +291,7 @@ project { "functions": { "api/*.php": { - "runtime": "vercel-php@0.5.2" + "runtime": "vercel-php@0.3.6" } } } @@ -318,7 +316,7 @@ Runtimes support excluding some files or folders, [take a look at doc](https://v { "functions": { "api/**/*.php": { - "runtime": "vercel-php@0.5.2", + "runtime": "vercel-php@0.3.6", "excludeFiles": "{foo/**,bar/config/*.yaml}", } } diff --git a/package-lock.json b/package-lock.json index a1cfb38a..04f93ed0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "vercel-php", - "version": "0.3.4", + "version": "0.3.6", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "vercel-php", - "version": "0.3.4", + "version": "0.3.6", "license": "MIT", "dependencies": { "@libphp/amazon-linux-2-v74": "latest" diff --git a/package.json b/package.json index 214048e0..030bd57d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "vercel-php", "description": "Vercel PHP runtime", - "version": "0.3.5", + "version": "0.3.6", "license": "MIT", "main": "./dist/index.js", "homepage": "https://github.com/juicyfx/vercel-php",