vercel-community / php

🐘 PHP Runtime for β–² Vercel Serverless Functions (support 7.4-8.3)
https://php.vercel.app
MIT License
1.21k stars 268 forks source link

the example can't run,what happened? #534

Closed banditsmile closed 3 months ago

banditsmile commented 3 months ago

Question

the example can't run,what happened?

Firstly, I want to deploy my own code to vercel,but there are always runtime error when building the code.

[21:19:18.785] Running build in Washington, D.C., USA (East) – iad1
[21:19:18.920] Cloning github.com/banditsmile/meta (Branch: main, Commit: 92dae1f)
[21:19:19.161] Cloning completed: 240.269ms
[21:19:19.248] Previous build cache not available
[21:19:19.455] Running "vercel build"
[21:19:19.968] Vercel CLI 33.6.1
[21:19:20.129] > Installing Builder: vercel-php@0.3.5
[21:19:22.321] 🐘 Downloading user files
[21:19:22.322] 🐘 Downloading PHP runtime files
[21:19:22.337] 🐘 Creating lambda
[21:19:22.345] Build Completed in /vercel/output [25ms]
[21:19:22.460] Deploying outputs...
[21:19:22.468] Error: The following Serverless Functions contain an invalid "runtime":
[21:19:22.468]   - api/index (nodejs18.x). Learn More: https://vercel.com/guides/serverless-function-contains-invalid-runtime-error
[21:19:22.543] 

I've checked this "https://vercel.com/guides/serverless-function-contains-invalid-runtime-error", the problem seems to be lasted to 2025?

Then, I turned to try example code

% cd test/examples 
% cd 00-php 
% vercel
Vercel CLI 33.6.1
? Set up and deploy β€œ~/Projects/codes/github.com/vercel-community/php/test/examples/00-php”? [Y/n] y
? Which scope do you want to deploy to? banditsmile's projects
? Link to existing project? [y/N] n
? What’s your project’s name? 00-php
? In which directory is your code located? ./
Local settings detected in vercel.json:
No framework detected. Default Project Settings:
- Build Command: `npm run vercel-build` or `npm run build`
- Development Command: None
- Install Command: `yarn install`, `pnpm install`, `npm install`, or `bun install`
- Output Directory: `public` if it exists, or `.`
? Want to modify these settings? [y/N] n
πŸ”—  Linked to banditsmiles-projects/00-php (created .vercel)
πŸ”  Inspect: https://vercel.com/banditsmiles-projects/00-php/FJJVENUXVwJ9nNFL7zBysVZcUyTj [4s]
βœ…  Production: https://00-r7u9dmydn-banditsmiles-projects.vercel.app [4s]
Error: The following Serverless Functions contain an invalid "runtime":
  - api/api/index (nodejs18.x)
  - api/api/users (nodejs18.x)
  - api/ext/ds (nodejs18.x)
  - api/ext/gd (nodejs18.x)
  - api/ext/index (nodejs18.x)
  - api/ext/phalcon (nodejs18.x)
  - api/hello (nodejs18.x)
  - api/index (nodejs18.x)
  - api/ini/index (nodejs18.x)
  - api/libs (nodejs18.x)
  - api/test (nodejs18.x)

It seems that the example code can't run too.

Does this means this project will been gaven up?

qkqpttgf commented 3 months ago

Do as this => https://github.com/qkqpttgf/OneManager-php/issues/722

QuiiBz commented 3 months ago

πŸ‘‹ Since this project manually enforces the runtime to be nodejs18.x, you have to make sure your project's Node.js version is the same (Settings > Node.js Version > Select 18.x)

https://github.com/vercel-community/php/blob/5cefd55adbbce1459d3bb22e330377d258d2fb58/src/index.ts#L126

banditsmile commented 3 months ago

this works for me ,thank you

f3l1x commented 3 months ago

New version 0.7.1 released.