PHP Built-In Server HTTP error: Error: connect ECONNREFUSED 127.0.0.1:8000
wnsite opened this issue · 25 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.
Are you using Node 18.x? Node 20.x is a problem.
Are you using Node 18.x? Node 20.x is a problem.
yeah i have made that change
this solution works! thanks
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 know Vercel uses Node.js to build our project and for the creation of Serverless Functions but I didn't quite understand the role of "runtime":"vercel-php@0.7.1"
An explanation would be greatly appreciated.
Thank you
vercel.json-
{
"functions": {
"api/index.php": {
"runtime": "vercel-php@0.7.1"
}
},
"routes": [
{ "src": "/(.*)", "dest": "/api/index.php" }
]
}
package.json-
{ "engines": { "node": "18.x" } }
Works 👍
The error is:
Spawning: PHP Built-In Server at /var/task/user (document root) and /var/task/user/api/index.php (router)
🐘STDERR: php: error while loading shared libraries: libssl.so.10: cannot open shared object file: No such file or directory
Node 20.x image has no libssl.so.10
The error is:
Spawning: PHP Built-In Server at /var/task/user (document root) and /var/task/user/api/index.php (router) 🐘STDERR: php: error while loading shared libraries: libssl.so.10: cannot open shared object file: No such file or directory
Node 20x image has no libssl.so.10
I have seen that the Node.js 18 will be retired on Vercel next year (Early 2025).
By the way, how important is libsssl.so in PHP? (I am just a beginner in PHP)
https://vercel.com/docs/functions/runtimes/node-js#node.js-version
The error is:
Spawning: PHP Built-In Server at /var/task/user (document root) and /var/task/user/api/index.php (router) 🐘STDERR: php: error while loading shared libraries: libssl.so.10: cannot open shared object file: No such file or directory
Node 20x image has no libssl.so.10
I have seen that the Node.js 18 will be retired on Vercel next year (Early 2025). By the way, how important is libsssl.so in PHP? (I am just a beginner in PHP) https://vercel.com/docs/functions/runtimes/node-js#node.js-version
PHP use libssl.so in curl
extension and openssl
extension.
using curl
to request the https website
This solution worked for me:
{
"functions": {
"api/index.php": {
"runtime": "vercel-php@0.3.6"
}
},
"rewrites": [
{ "source": "/(.*)", "destination": "/api/index.php" }
]
}
And change node.js version to 18.x
: #504
The error is:
Spawning: PHP Built-In Server at /var/task/user (document root) and /var/task/user/api/index.php (router) 🐘STDERR: php: error while loading shared libraries: libssl.so.10: cannot open shared object file: No such file or directory
Node 20x image has no libssl.so.10
I have seen that the Node.js 18 will be retired on Vercel next year (Early 2025). By the way, how important is libsssl.so in PHP? (I am just a beginner in PHP) https://vercel.com/docs/functions/runtimes/node-js#node.js-version
PHP use libssl.so in
curl
extension andopenssl
extension.
usingcurl
to request the https website
So with no libssl.so, basically CURL will be dead right?
Why is not specified in the readme that Node 18.x must be selected?
(I made a PR #569)
For anyone still faced with this issue, do the following
Step 1: Use a working example
Step 2: replace the api/index.php
file content with this
<?php
phpinfo();
Step 3: Switch from Node 20.x to Node 18.x under vercel settings
Step 4: Redeploy your project and Voila!!!
Enjoy!!!
Hey all! It should be fixed to use Node 20.x, can you folks try version 0.7.2
with Node 20.x?