simjanos-dev / LinguaCafe

LinguaCafe is a self-hosted software that helps language learners read foreign languages.
https://simjanos-dev.github.io/LinguaCafeHome/
GNU General Public License v3.0
888 stars 32 forks source link

Cant start server #371

Open JanSimeonMetzger opened 1 day ago

JanSimeonMetzger commented 1 day ago

When i access http://localhost:9191 i get this error: UnexpectedValueException in /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php (line 219)

            $this->errorMessage = null;
            set_error_handler([$this, 'customErrorHandler']);
            $status = mkdir($dir, 0777, true);
            restore_error_handler();
            if (false === $status && !is_dir($dir) && strpos((string) $this->errorMessage, 'File exists') === false) {
                throw new \UnexpectedValueException(sprintf('There is no existing directory at "%s" and it could not be created: '.$this->errorMessage, $dir));
            }
        }
        $this->dirCreated = true;
    }
}

in /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php -> createDir (line 135)

        if (!is_resource($this->stream)) {
            $url = $this->url;
            if (null === $url || '' === $url) {
                throw new \LogicException('Missing stream url, the stream can not be opened. This may be caused by a premature call to close().' . Utils::getRecordMessageForException($record));
            }
            $this->createDir($url);
            $this->errorMessage = null;
            set_error_handler([$this, 'customErrorHandler']);
            try {
                $stream = fopen($url, 'a');
                if ($this->filePermission !== null) {

in /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php -> write (line 48)

            $record = $this->processRecord($record);
        }
        $record['formatted'] = $this->getFormatter()->format($record);
        $this->write($record);
        return false === $this->bubble;
    }
    /**

in /var/www/html/vendor/monolog/monolog/src/Monolog/Logger.php -> handle (line 399)

                    }
                }
                // once the record exists, send it to all handlers as long as the bubbling chain is not interrupted
                try {
                    if (true === $handler->handle($record)) {
                        break;
                    }
                } catch (Throwable $e) {
                    $this->handleException($e, $record);

in /var/www/html/vendor/monolog/monolog/src/Monolog/Logger.php -> addRecord (line 650)

     * @param string|Stringable $message The log message
     * @param mixed[]           $context The log context
     */
    public function error($message, array $context = []): void
    {
        $this->addRecord(static::ERROR, (string) $message, $context);
    }
    /**
     * Adds a log record at the CRITICAL level.
     *

in /var/www/html/vendor/laravel/framework/src/Illuminate/Log/Logger.php -> error (line 181)

     * @param  array  $context
     * @return void
     */
    protected function writeLog($level, $message, $context)
    {
        $this->logger->{$level}(
            $message = $this->formatMessage($message),
            $context = array_merge($this->context, $context)
        );
        $this->fireLogEvent($level, $message, $context);

in /var/www/html/vendor/laravel/framework/src/Illuminate/Log/Logger.php -> writeLog (line 94)

     * @param  array  $context
     * @return void
     */
    public function error($message, array $context = [])
    {
        $this->writeLog(__FUNCTION__, $message, $context);
    }
    /**
     * Log a warning message to the logs.
     *

in /var/www/html/vendor/laravel/framework/src/Illuminate/Log/LogManager.php -> error (line 590)

     * @param  array  $context
     * @return void
     */
    public function error($message, array $context = [])
    {
        $this->driver()->error($message, $context);
    }
    /**
     * Exceptional occurrences that are not errors.
     *

in /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php -> error (line 247)

            $logger = $this->container->make(LoggerInterface::class);
        } catch (Exception $ex) {
            throw $e;
        }
        $logger->error(
            $e->getMessage(),
            array_merge(
                $this->exceptionContext($e),
                $this->context(),
                ['exception' => $e]

in /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php -> report (line 165)

    public function handleException(Throwable $e)
    {
        self::$reservedMemory = null;
        try {
            $this->getExceptionHandler()->report($e);
        } catch (Exception $e) {
            //
        }
        if ($this->app->runningInConsole()) {

UnexpectedValueException: There is no existing directory at "/var/www/html/storage/logs" and it could not be created: Permission denied

at /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:219 at Monolog\Handler\StreamHandler->createDir('/var/www/html/storage/logs/laravel.log') (/var/www/html/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:135) at Monolog\Handler\StreamHandler->write(array('message' => 'There is no existing directory at "/var/www/html/storage/logs" and it could not be created: Permission denied', 'context' => array('exception' => object(UnexpectedValueException)), 'level' => 400, 'level_name' => 'ERROR', 'channel' => 'local', 'datetime' => object(DateTimeImmutable), 'extra' => array(), 'formatted' => '[2024-11-21 16:47:50] local.ERROR: There is no existing directory at "/var/www/html/storage/logs" and it could not be created: Permission denied {"exception":"[object] (UnexpectedValueException(code: 0): There is no existing directory at \"/var/www/html/storage/logs\" and it could not be created: Permission denied at /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:219)[stacktrace]#0 /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php(135): Monolog\\Handler\\StreamHandler->createDir(\'/var/www/html/s...\')#1 /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(48): Monolog\\Handler\\StreamHandler->write(Array)#2 /var/www/html/vendor/monolog/monolog/src/Monolog/Logger.php(399): Monolog\\Handler\\AbstractProcessingHandler->handle(Array)#3 /var/www/html/vendor/monolog/monolog/src/Monolog/Logger.php(650): Monolog\\Logger->addRecord(400, \'There is no exi...\', Array)#4 /var/www/html/vendor/laravel/framework/src/Illuminate/Log/Logger.php(181): Monolog\\Logger->error(\'There is no exi...\', Array)#5 /var/www/html/vendor/laravel/framework/src/Illuminate/Log/Logger.php(94): Illuminate\\Log\\Logger->writeLog(\'error\', \'There is no exi...\', Array)#6 /var/www/html/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(590): Illuminate\\Log\\Logger->error(\'There is no exi...\', Array)#7 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(247): Illuminate\\Log\\LogManager->error(\'There is no exi...\', Array)#8 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(415): Illuminate\\Foundation\\Exceptions\\Handler->report(Object(UnexpectedValueException))#9 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(113): Illuminate\\Foundation\\Http\\Kernel->reportException(Object(UnexpectedValueException))#10 /var/www/html/public/index.php(51): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))#11 {main}"} ')) (/var/www/html/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php:48) at Monolog\Handler\AbstractProcessingHandler->handle(array('message' => 'There is no existing directory at "/var/www/html/storage/logs" and it could not be created: Permission denied', 'context' => array('exception' => object(UnexpectedValueException)), 'level' => 400, 'level_name' => 'ERROR', 'channel' => 'local', 'datetime' => object(DateTimeImmutable), 'extra' => array(), 'formatted' => '[2024-11-21 16:47:50] local.ERROR: There is no existing directory at "/var/www/html/storage/logs" and it could not be created: Permission denied {"exception":"[object] (UnexpectedValueException(code: 0): There is no existing directory at \"/var/www/html/storage/logs\" and it could not be created: Permission denied at /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:219)[stacktrace]#0 /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php(135): Monolog\\Handler\\StreamHandler->createDir(\'/var/www/html/s...\')#1 /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(48): Monolog\\Handler\\StreamHandler->write(Array)#2 /var/www/html/vendor/monolog/monolog/src/Monolog/Logger.php(399): Monolog\\Handler\\AbstractProcessingHandler->handle(Array)#3 /var/www/html/vendor/monolog/monolog/src/Monolog/Logger.php(650): Monolog\\Logger->addRecord(400, \'There is no exi...\', Array)#4 /var/www/html/vendor/laravel/framework/src/Illuminate/Log/Logger.php(181): Monolog\\Logger->error(\'There is no exi...\', Array)#5 /var/www/html/vendor/laravel/framework/src/Illuminate/Log/Logger.php(94): Illuminate\\Log\\Logger->writeLog(\'error\', \'There is no exi...\', Array)#6 /var/www/html/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(590): Illuminate\\Log\\Logger->error(\'There is no exi...\', Array)#7 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(247): Illuminate\\Log\\LogManager->error(\'There is no exi...\', Array)#8 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(415): Illuminate\\Foundation\\Exceptions\\Handler->report(Object(UnexpectedValueException))#9 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(113): Illuminate\\Foundation\\Http\\Kernel->reportException(Object(UnexpectedValueException))#10 /var/www/html/public/index.php(51): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))#11 {main}"} ')) (/var/www/html/vendor/monolog/monolog/src/Monolog/Logger.php:399) at Monolog\Logger->addRecord(400, 'There is no existing directory at "/var/www/html/storage/logs" and it could not be created: Permission denied', array('exception' => object(UnexpectedValueException))) (/var/www/html/vendor/monolog/monolog/src/Monolog/Logger.php:650) at Monolog\Logger->error('There is no existing directory at "/var/www/html/storage/logs" and it could not be created: Permission denied', array('exception' => object(UnexpectedValueException))) (/var/www/html/vendor/laravel/framework/src/Illuminate/Log/Logger.php:181) at Illuminate\Log\Logger->writeLog('error', 'There is no existing directory at "/var/www/html/storage/logs" and it could not be created: Permission denied', array('exception' => object(UnexpectedValueException))) (/var/www/html/vendor/laravel/framework/src/Illuminate/Log/Logger.php:94) at Illuminate\Log\Logger->error('There is no existing directory at "/var/www/html/storage/logs" and it could not be created: Permission denied', array('exception' => object(UnexpectedValueException))) (/var/www/html/vendor/laravel/framework/src/Illuminate/Log/LogManager.php:590) at Illuminate\Log\LogManager->error('There is no existing directory at "/var/www/html/storage/logs" and it could not be created: Permission denied', array('exception' => object(UnexpectedValueException))) (/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php:247) at Illuminate\Foundation\Exceptions\Handler->report(object(UnexpectedValueException)) (/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:165) at Illuminate\Foundation\Bootstrap\HandleExceptions->handleException(object(UnexpectedValueException))

Im on ubuntu 24 and docker version 27.3.1