Hi.
I am starting to use Slim, step by step installing slim and Psr7 and copying the initial demo code and I always get 500 error.
I also create the .htaccess file in the same folder ( the main folder) as index.php. I don’t understand what’s happening because I’m following the guide.
I’m using Linux and Xamp, php 8.1, slim 4.10. I also have probe it in windows with Wamp server with identical result.
<?php
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Slim\Factory\AppFactory;
require __DIR__ . '/../vendor/autoload.php';
$app = AppFactory::create();
$app->get('/', function (Request $request, Response $response, $args) {
$response->getBody()->write("Hello world!");
return $response;
});
$app->run();
All of this code is extracted of the guide. Thanks for your help.