vercel-community / php

🐘 PHP Runtime for ▲ Vercel Serverless Functions (support 7.4-8.3)

Home Page:https://php.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PHP Built-In Server HTTP error: Error: connect ECONNREFUSED 127.0.0.1:8000

wnsite opened this issue · comments

Hey, I was testing this package and I set up the example and I got this error: PHP Built-In Server HTTP error: Error: connect ECONNREFUSED 127.0.0.1:8000. The vercel deployed but when I visit the website it shows that error.
NOTE: I deployed it all using GitHub and vercel online, I did not install Node.JS or the Vercel CLI on my local machine. Do I need to do that?
The site if you want to see for yourself: https://testvercelphp.vercel.app/
My test file structure:
vercel.json
api/
├─ index.php

vercel.json:
{
"functions": {
"api/index.php": {
"runtime": "vercel-php@0.7.1"
}
},
"routes": [
{ "src": "/(.*)", "dest": "/api/index.php" }
]
}

index.php:

Fixed! Changed the json to:

{
  "functions": {
    "api/index.php": {
      "runtime": "vercel-php@0.7.1"
    }
  },
  "routes": [
    { "src": "/(.*)", "dest": "/api/index.php" }
  ]
}

sorry, but where is the different

got same error but above does not work.

Same error here

I was able to deploy the basic examples by setting Node.js version to 18.x on Vercel's project settings, I've tried vercel-php@0.7.1, vercel-php@0.6.2 and vercel-php@0.5.5 with it and it seems fine.

I had the same error PHP Built-In Server HTTP error: Error: connect ECONNREFUSED 127.0.0.1:8000 when using the default version (Node.js 20.x).

The same just want to write comment.
Node 18 will work.

Hi folks. Node 20.x seems to be problem. I need to investigate it.

i get error
my web : https://doodplay.vercel.app/
my vercel id : QuBwX4iGVFwYPpmEJApy8H3L

how to fix it

I had the same problem with node 20x. I created package.json file and add this code to use node 18x version.

package.json
{ "engines": { "node": "18.x" } }

The project is running without any issue

I had the same problem.
How can I fix it?

I managed to get it working by changing the Node.js Version in the Settings -> General on Vercel web page.