проблемы начальной настройки slim4
У меня есть установка с apache с приложением hello world slim-4, но я получаю исключение, если вызываю страницу hello world. Моя настройка следующая
/var/www/html:
composer.json composer.lock .htaccess public vendor
/var/www/html/public:
index.php
.htaccess
.vhosts file :
DocumentRoot /var/www/html
at the start and :
DocumentRoot /var/www/html/public
in the last row to fulfill this setup
installed
composer require slim/slim:^4.0
composer require slim/psr7
index.php содержимое:
<?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->addRoutingMiddleware();
$errorMiddleware = $app->addErrorMiddleware(true, true, true);
$app->get('/hello/{name}', function (Request $request, Response $response, $args) {
$name = $args['name'];
$response->getBody()->write("Hello, $name");
return $response;
});
$app->run();
содержимое /var/www/html/public/.htaccess, как описано на странице установки
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]
пока у меня ничего нет в файле /var/www/html/.htaccess, он работает https://localhost/hello/foobar -> Привет, foobar
Но у меня есть исключение:
[Wed Nov 27 16:13:59.267562 2019] [proxy_fcgi:error] [pid 49831:tid 140516607903488] [client 172.24.5.67:16446] AH01071: Got error 'PHP message: Slim Application Error:\nType: Slim\\Exception\\HttpNotFoundException\nCode: 404\nMessage: Not found.\nFile: /var/www/html/vendor/slim/slim/Slim/Middleware/RoutingMiddleware.php\nLine: 91\nTrace: #0 /var/www/html/vendor/slim/slim/Slim/Middleware/RoutingMiddleware.php(57): Slim\\Middleware\\RoutingMiddleware->performRouting(Object(Slim\\Psr7\\Request))\n#1 /var/www/html/vendor/slim/slim/Slim/MiddlewareDispatcher.php(123): Slim\\Middleware\\RoutingMiddleware->process(Object(Slim\\Psr7\\Request), Object(Slim\\Routing\\RouteRunner))\n#2 /var/www/html/vendor/slim/slim/Slim/Middleware/ErrorMiddleware.php(89): class@anonymous->handle(Object(Slim\\Psr7\\Request))\n#3 /var/www/html/vendor/slim/slim/Slim/MiddlewareDispatcher.php(123): Slim\\Middleware\\ErrorMiddleware->process(Object(Slim\\Psr7\\Request), Object(class@anonymous))\n#4 /var/www/html/vendor/slim/slim/Slim/MiddlewareDispatcher.php(64): c...\n', referer: https://localhost/hello/f
как только я добавляю строку AllowOverride All в /var/www/html/.htaccess, я получаю код 500 с:
[Wed Nov 27 16:37:31.580912 2019] [authz_core:error] [pid 49831:tid 140516565939968] [client 172.24.5.67:17131] AH01630: client denied by server configuration: /var/www/html/log/error/500.html
что не так с моей конфигурацией?