I’m trying to run a simple PHP code in Vercel (PHP is in the folder ‘api’), it opens the HTML code but when it calls the index.php give me the error:
PHP Built-In Server HTTP error: Error: connect ECONNREFUSED 127.0.0.1:8000
my html :
Testando php no vercel
Bem vindo ao meu site
Digite seu nome:
Enviar
my PHP:
<?php
// Verifica se o nome foi enviado via POST
if (isset($_POST['nome'])) {
$nome = $_POST['nome'];
echo "
Bem-vindo ao meu site, $nome!
";
} else {
header("Location: /index.html");
exit();
}
my vercel.json:
{
"functions": {
"api/index.php": {
"runtime": "vercel-php@0.7.1"
}
},
"routes": [
{
"src": "/api/index.php",
"dest": "/api/index.php"
},
{
"src": "/(.*)",
"dest": "/index.html"
}
]
}
Hi, @kaue10166!
There is a Vercel Community PHP repo you use to check the set-up and compare with yours
Otherwise, feel free to create a minimal reproducible example for us to dig deeper!