我在我的linux机器上使用lampp来托管一个网站。数据库被配置为虚拟主机。此外,php依赖关系是使用composer修复的。当我启动lampp组件并转到locahost时,我收到了这个错误。我试图以某种方式修复它,但没有任何效果。希望你能帮助我,谢谢。
Slim Application Error
The application could not run because of the following error:
Details
Type: UnexpectedValueException
Message: The stream or file "../logs/app.log" could not be opened: failed to open stream: Permission denied
File: /opt/lampp/htdocs/starlight-app/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php
Line: 107
Trace
#0 /opt/lampp/htdocs/starlight-app/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(39): Monolog\Handler\StreamHandler->write(Array)
#1 /opt/lampp/htdocs/starlight-app/vendor/monolog/monolog/src/Monolog/Logger.php(344): Monolog\Handler\AbstractProcessingHandler->handle(Array)
#2 /opt/lampp/htdocs/starlight-app/vendor/monolog/monolog/src/Monolog/Logger.php(637): Monolog\Logger->addRecord(200, 'Loading route.', Array)
#3 /opt/lampp/htdocs/starlight-app/config/middlewares.php(94): Monolog\Logger->info('Loading route.', Array)
#4 [internal function]: Closure->{closure}(Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Closure))
#5 /opt/lampp/htdocs/starlight-app/vendor/slim/slim/Slim/DeferredCallable.php(43): call_user_func_array(Object(Closure), Array)
#6 [internal function]: Slim\DeferredCallable->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Closure))
#7 /opt/lampp/htdocs/starlight-app/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func(Object(Slim\DeferredCallable), Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Closure))
#8 /opt/lampp/htdocs/starlight-app/vendor/slim/csrf/src/Guard.php(171): Slim\App->Slim\{closure}(Object(Slim\Http\Request), Object(Slim\Http\Response))
#9 [internal function]: Slim\Csrf\Guard->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Closure))
#10 /opt/lampp/htdocs/starlight-app/vendor/slim/slim/Slim/DeferredCallable.php(43): call_user_func_array(Object(Slim\Csrf\Guard), Array)
#11 [internal function]: Slim\DeferredCallable->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Closure))
#12 /opt/lampp/htdocs/starlight-app/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func(Object(Slim\DeferredCallable), Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Closure))
#13 /opt/lampp/htdocs/starlight-app/config/middlewares.php(178): Slim\App->Slim\{closure}(Object(Slim\Http\Request), Object(Slim\Http\Response))
#14 [internal function]: Closure->{closure}(Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Closure))
#15 /opt/lampp/htdocs/starlight-app/vendor/slim/slim/Slim/DeferredCallable.php(43): call_user_func_array(Object(Closure), Array)
#16 [internal function]: Slim\DeferredCallable->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Closure))
#17 /opt/lampp/htdocs/starlight-app/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func(Object(Slim\DeferredCallable), Object(Slim\Http\Request), O Object(Slim\Http\Response), Object(Closure))
#18 /opt/lampp/htdocs/starlight-app/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(117): Slim\App->Slim\{closure}(Object(Slim\Http\Request), Object(Slim\Http\Response))
#19 /opt/lampp/htdocs/starlight-app/vendor/slim/slim/Slim/App.php(405): Slim\App->callMiddlewareStack(Object(Slim\Http\Request), Object(Slim\Http\Response))
#20 /opt/lampp/htdocs/starlight-app/vendor/slim/slim/Slim/App.php(313): Slim\App->process(Object(Slim\Http\Request), Object(Slim\Http\Response))
#21 /opt/lampp/htdocs/starlight-app/public/index.php(70): Slim\App->run()
#22 {main}
2条答案
按热度按时间7gcisfzg1#
好的,很抱歉打扰你,我只是解决了这个问题,修复了使用
chmod -R a+wr logs/
的日志文件夹的阅读权限。谢谢。iyfamqjs2#
由于您的错误输出,它是显示一些权限问题,您可以给予所有访问根文件夹作为sudo的chmod777
并确保您在API主体中提供了有效的数据,并将有效的JSON数据传递给响应