Request your help, I have recently updated our system from Slim3 to Slim4 and the below function is not working on Slim4 where as the same works perfectly in Slim3 , the return data is of type json(return $serverList;)
Was able to resolve this issue by modifying the code as below, and it is working as expected, but also throwing the below error in Apache log. hence request your help.
created the file .htaccess above the public folder (web)
RewriteEngine on
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]
File .htaccess insied the public folder
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
index.php
use DI\Container;
use Slim\Factory\AppFactory;
use Slim\Views\Twig;
use Slim\Views\TwigMiddleware;
use Slim\Exception\NotFoundException;
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Message\ResponseInterface as Response;
use Selective\BasePath\BasePathDetector;
$container = new Container();
AppFactory::setContainer($container);
Thank you very much, I tried the solution that you gave me , still facing the same issue, below is my index.php file
index.php
use DI\Container;
use Slim\Factory\AppFactory;
use Slim\Views\Twig;
use Slim\Views\TwigMiddleware;
use Slim\Exception\NotFoundException;
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Message\ResponseInterface as Response;
use Selective\BasePath\BasePathDetector;
$container = new Container();
AppFactory::setContainer($container);
Was able to resolve this issue , as the folder “static” was under the folder “public”, so moved this folder above the public folder (under the folder “web”) and removed the below lines from index.php, and now I am not getting this error message.