skip to Main Content

I’m using lampp on my linux machine to host a website. The db is configured as the virtual host. Also, the php dependencies are fixed using composer. When I start the lampp components and I go to locahost I recive this error. I tried to fix it in some ways, but nothing worked.
Hope you can help me, thank you.

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): MonologHandlerStreamHandler->write(Array)
#1 /opt/lampp/htdocs/starlight-app/vendor/monolog/monolog/src/Monolog/Logger.php(344): MonologHandlerAbstractProcessingHandler->handle(Array)
#2 /opt/lampp/htdocs/starlight-app/vendor/monolog/monolog/src/Monolog/Logger.php(637): MonologLogger->addRecord(200, 'Loading route.', Array)
#3 /opt/lampp/htdocs/starlight-app/config/middlewares.php(94): MonologLogger->info('Loading route.', Array)
#4 [internal function]: Closure->{closure}(Object(SlimHttpRequest), Object(SlimHttpResponse), 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]: SlimDeferredCallable->__invoke(Object(SlimHttpRequest), Object(SlimHttpResponse), Object(Closure))
#7 /opt/lampp/htdocs/starlight-app/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func(Object(SlimDeferredCallable), Object(SlimHttpRequest), Object(SlimHttpResponse), Object(Closure))
#8 /opt/lampp/htdocs/starlight-app/vendor/slim/csrf/src/Guard.php(171): SlimApp->Slim{closure}(Object(SlimHttpRequest), Object(SlimHttpResponse))
#9 [internal function]: SlimCsrfGuard->__invoke(Object(SlimHttpRequest), Object(SlimHttpResponse), Object(Closure))
#10 /opt/lampp/htdocs/starlight-app/vendor/slim/slim/Slim/DeferredCallable.php(43): call_user_func_array(Object(SlimCsrfGuard), Array)
#11 [internal function]: SlimDeferredCallable->__invoke(Object(SlimHttpRequest), Object(SlimHttpResponse), Object(Closure))
#12 /opt/lampp/htdocs/starlight-app/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func(Object(SlimDeferredCallable), Object(SlimHttpRequest), Object(SlimHttpResponse), Object(Closure))
#13 /opt/lampp/htdocs/starlight-app/config/middlewares.php(178): SlimApp->Slim{closure}(Object(SlimHttpRequest), Object(SlimHttpResponse))
#14 [internal function]: Closure->{closure}(Object(SlimHttpRequest), Object(SlimHttpResponse), 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]: SlimDeferredCallable->__invoke(Object(SlimHttpRequest), Object(SlimHttpResponse), Object(Closure))
#17 /opt/lampp/htdocs/starlight-app/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func(Object(SlimDeferredCallable), Object(SlimHttpRequest), O Object(SlimHttpResponse), Object(Closure))
#18 /opt/lampp/htdocs/starlight-app/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(117): SlimApp->Slim{closure}(Object(SlimHttpRequest), Object(SlimHttpResponse))
#19 /opt/lampp/htdocs/starlight-app/vendor/slim/slim/Slim/App.php(405): SlimApp->callMiddlewareStack(Object(SlimHttpRequest), Object(SlimHttpResponse))
#20 /opt/lampp/htdocs/starlight-app/vendor/slim/slim/Slim/App.php(313): SlimApp->process(Object(SlimHttpRequest), Object(SlimHttpResponse))
#21 /opt/lampp/htdocs/starlight-app/public/index.php(70): SlimApp->run()
#22 {main}

2

Answers


  1. Chosen as BEST ANSWER

    Ok sorry for bothering you, I simply resolved the problem fixing the permissions o writing and reading on the logs folder using chmod -R a+wr logs/. Thank you.


  2. As of your error output it is showing some permissions issue you can give all access to the root folder as sudo chmod 777

    And make sure you are providing the valid data in api body and passing the valid json data to the response

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search