Search code examples
mysqllinuxapachexampplampp

How to fix "Slim Application Error" error while using lampp to host


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): 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}

Solution

  • 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.