Test Local webserver kiami2 gibt error 500

gamecard

Lieutenant
Registriert
Apr. 2010
Beiträge
776
OS Ubuntu 18.04.4 LTS (GNU/Linux 4.15.0-96-generic x86_64
PHP 7.2.24-0ubuntu0.18.04.4 Zend Engine v3.2.0, with Zend OPcache v7.2.24-0ubuntu0.18.04.4,
Composer version 1.10.
Link zur software https://www.kimai.org/

Hallo ich habe echt ein Problem ich versuche die kimai2 zu installieren und zu konfigurieren(in meine Testumgebung läuft auf eine VM) nur beim Aufruf der Webseite bekomme ich einen 500 Error...

Unter /var/www/kimai2/var/log# nano prod.log bekomme ich folgendes code ausgegeben bei der auf ruf der Webseite

Code:
[2020-04-20 02:07:14] request.INFO: Matched route "fos_user_security_login". {"route":"fos_user_security_login","route_parameters":{"_route":"fos_user_security_login","_controller":"fos_user.security.controller:loginAction","_locale":"de"},"request_uri":"http://192.168.178.67/public/index.php/de/login","method":"GE$
[2020-04-20 02:07:14] security.DEBUG: Checking for guard authentication credentials. {"firewall_key":"secured_area","authenticators":1} []
[2020-04-20 02:07:14] security.DEBUG: Checking support on guard authenticator. {"firewall_key":"secured_area","authenticator":"App\\Security\\TokenAuthenticator"} []
[2020-04-20 02:07:14] security.DEBUG: Guard authenticator does not support the request. {"firewall_key":"secured_area","authenticator":"App\\Security\\TokenAuthenticator"} []
[2020-04-20 02:07:14] security.INFO: Populated the TokenStorage with an anonymous Token. [] []
[2020-04-20 02:07:14] request.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\DriverException: "An exception occurred in driver: SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost'" at /var/www/kimai2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 106 {"exception":"$
[2020-04-20 02:07:14] cache.WARNING: Failed to save key "%5BSymfony%5CComponent%5CHttpKernel%5CController%5CErrorController%5D%5B1%5D" of type array: file_put_contents(/var/www/kimai2/var/cache/prod/pools/65Ui8J-V3o/5e9d03d25e3b54.04015035): failed to open stream: Permission denied {"key":"%5BSymfony%5CComponent%5C$
[2020-04-20 02:07:14] cache.WARNING: Failed to save key "%5BSymfony%5CComponent%5CHttpKernel%5CController%5CErrorController%23__invoke%5D%5B1%5D" of type array: file_put_contents(/var/www/kimai2/var/cache/prod/pools/65Ui8J-V3o/5e9d03d25e3b54.04015035): failed to open stream: Permission denied {"key":"%5BSymfony%5CC$
[2020-04-20 02:07:14] request.CRITICAL: Exception thrown when handling an exception (Twig\Error\RuntimeError: An exception has been thrown during the rendering of a template ("Failed to create "/var/www/kimai2/var/cache/prod/translations": mkdir(): Permission denied."). at /var/www/kimai2/templates/error.html.twig $
[2020-04-20 02:07:14] php.CRITICAL: Uncaught Exception: An exception has been thrown during the rendering of a template ("Failed to create "/var/www/kimai2/var/cache/prod/translations": mkdir(): Permission denied."). {"exception":"[object] (Twig\\Error\\RuntimeError(code: 0): An exception has been thrown during the$
[2020-04-20 02:07:14] request.CRITICAL: Uncaught PHP Exception Twig\Error\RuntimeError: "An exception has been thrown during the rendering of a template ("Failed to create "/var/www/kimai2/var/cache/prod/translations": mkdir(): Permission denied.")." at /var/www/kimai2/templates/error.html.twig line 4 {"exception":$
[2020-04-20 02:07:14] request.CRITICAL: Exception thrown when handling an exception (Twig\Error\RuntimeError: An exception has been thrown during the rendering of a template ("An exception occurred in driver: SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost'"). at /var/www/kimai2/templates/partials/l$
[2020-04-20 02:07:14] php.CRITICAL: Uncaught Exception: An exception has been thrown during the rendering of a template ("An exception occurred in driver: SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost'"). {"exception":"[object] (Twig\\Error\\RuntimeError(code: 0): An exception has been thrown duri$

Unter var/log# nano kimai_access.log und /var/log# nano kimai_error.log gibt es nichts.

aber laut :/var/log# apache2
Code:
[Mon Apr 20 02:18:50.606069 2020] [core:warn] [pid 5798] AH00111: Config variable ${APACHE_RUN_DIR} is not defined
apache2: Syntax error on line 80 of /etc/apache2/apache2.conf: DefaultRuntimeDir must be a valid directory, absolute or relative to ServerRoot


.httaccess in /var/www/kimai2/public# nano .htaccess sieht so aus

Code:
# Use the front controller as index file. It serves as a fallback solution when
# every other rewrite/redirect fails (e.g. in an aliased environment without
# mod_rewrite). Additionally, this reduces the matching process for the
# start page (path "/") because otherwise Apache will apply the rewriting rules
# to each configured DirectoryIndex file (e.g. index.php, index.html, index.pl).
DirectoryIndex index.php

# Do NOT use Kimai with http, this is a huge security risk!
# Activate these lines if you configured SSL and certificates:

#<IfModule mod_rewrite.c>
#    RewriteEngine On
#    RewriteCond %{SERVER_PORT} 80
#    RewriteRule ^(.*)$ https://kimai.example.com/$1 [R,L]
#</IfModule>

<IfModule mod_rewrite.c>
    RewriteEngine On

    # Determine the RewriteBase automatically and set it as environment variable.
    # If you are using Apache aliases to do mass virtual hosting or installed the
    # project in a subdirectory, the base path will be prepended to allow proper
    # resolution of the app.php file and to redirect to the correct URI. It will
    # work in environments without path prefix as well, providing a safe, one-size
    # fits all solution. But as you do not need it in this case, you can comment
    # the following 2 lines to eliminate the overhead.
    RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
    RewriteRule ^(.*) - [E=BASE:%1]

    # Redirect to URI without front controller to prevent duplicate content
    # (with and without `/app.php`). Only do this redirect on the initial
    # rewrite by Apache and not on subsequent cycles. Otherwise we would get an
    # endless redirect loop (request -> rewrite to front controller ->
    # redirect -> request -> ...).
    # So in case you get a "too many redirects" error or you always get redirected
    # to the start page because your Apache does not expose the REDIRECT_STATUS
    # environment variable, you have 2 choices:
    # - disable this feature by commenting the following 2 lines or
    # - use Apache >= 2.3.9 and replace all L flags by END flags and remove the
    #   following RewriteCond (best solution)
    RewriteCond %{ENV:REDIRECT_STATUS} ^$
    RewriteRule ^index\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L]

    # If the requested filename exists, simply serve it.
    # We only want to let Apache serve files and not directories.
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule .? - [L]

    # Rewrite all other queries to the front controller.
    RewriteRule .? %{ENV:BASE}/index.php [L]
</IfModule>

<IfModule !mod_rewrite.c>
    <IfModule mod_alias.c>
        # When mod_rewrite is not available, we instruct a temporary redirect of
        # the start page to the front controller explicitly so that the website
        # and the generated links can still be used.
        RedirectMatch 302 ^/$ /index.php/
        # RedirectTemp cannot be used instead
    </IfModule>
</IfModule>



und unter /etc/apache2/sites-enabled# nano kimai.conf sieht es so aus


Code:
<VirtualHost *:80>
#    ServerName 192.168.178.67
    ServerName kimai.local
    ServerAlias www.kimai.local

   DocumentRoot /var/www/kimai2/public
    <Directory /var/www/kimai2/public>
        AllowOverride All

        # If you see an error like the following in your logs:
        # AH01630: client denied by server configuration: /var/www/kimai2/public/
        # then you might have to exchange the "Order/Allow" rules with "Require" (see below)
        # More infos at https://httpd.apache.org/docs/2.4/de/upgrading.html

        # Apache 2.2
        # Order Allow,Deny
        #Allow from All
        # Apache 2.4
         Require all granted

        FallbackResource /index.php
    </Directory>

    <Directory /var/www/kimai2>
        Options FollowSymlinks
    </Directory>

    # optionally disable the fallback resource for the asset directories
    # which will allow Apache to return a 404 error when files are
    # not found instead of passing the request to Symfony
    <Directory /var/www/kimai2/public/bundles>
        FallbackResource disabled
    </Directory>

    ErrorLog /var/log/kimai_error.log
    CustomLog /var/log/kimai_access.log combined

    # optionally set the value of the environment variables used in the application
    #SetEnv APP_ENV prod
    #SetEnv APP_SECRET <app-secret-id>
    #SetEnv DATABASE_URL "mysql://db_user:db_pass@host:3306/db_name"
</VirtualHost>




Ich Danke euch für jeden Hinweiß. Schon lange nicht in CB gewesen.
 
Zuletzt bearbeitet:
ich glaube es hat mit den Datei-Zugriffsberechtigungen zu tun?!
"
"Failed to create "/var/www/kimai2/var/cache/prod/translations": mkdir(): Permission denied."
"

der process hat anscheinend nicht die rechte dateien/ ordner zu schreiben.
 
@dermoritz

Danke dir habe es mit chmod -R -f 777 /var/www/kimai2/var behoben, jetzt ist der Fehler Code ein wenig kleiner als vorher :)

Jetzt zeigt weiterhin
Code:
[2020-04-20 02:52:15] request.INFO: Matched route "fos_user_security_login". {"route":"fos_user_security_login","route_parameters":{"_route":"fos_user_security_login","_controller":"fos_user.security.controller:loginAction","_locale":"de"},"request_uri":"http://192.168.178.67/public/index.php/de/login","method":"GE$
[2020-04-20 02:52:15] security.DEBUG: Checking for guard authentication credentials. {"firewall_key":"secured_area","authenticators":1} []
[2020-04-20 02:52:15] security.DEBUG: Checking support on guard authenticator. {"firewall_key":"secured_area","authenticator":"App\\Security\\TokenAuthenticator"} []
[2020-04-20 02:52:15] security.DEBUG: Guard authenticator does not support the request. {"firewall_key":"secured_area","authenticator":"App\\Security\\TokenAuthenticator"} []
[2020-04-20 02:52:15] security.INFO: Populated the TokenStorage with an anonymous Token. [] []
[2020-04-20 02:52:15] request.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\DriverException: "An exception occurred in driver: SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost'" at /var/www/kimai2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 106 {"exception":"$
[2020-04-20 02:52:15] request.CRITICAL: Exception thrown when handling an exception (Twig\Error\RuntimeError: An exception has been thrown during the rendering of a template ("An exception occurred in driver: SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost'"). at /var/www/kimai2/templates/partials/l$
[2020-04-20 02:52:15] php.CRITICAL: Uncaught Exception: An exception has been thrown during the rendering of a template ("An exception occurred in driver: SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost'"). {"exception":"[object] (Twig\\Error\\RuntimeError(code: 0): An exception has been thrown duri$
[2020-04-20 02:52:15] request.CRITICAL: Uncaught PHP Exception Twig\Error\RuntimeError: "An exception has been thrown during the rendering of a template ("An exception occurred in driver: SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost'")." at /var/www/kimai2/templates/partials/logo_login.html.twig $
[2020-04-20 02:52:15] request.CRITICAL: Exception thrown when handling an exception (Twig\Error\RuntimeError: An exception has been thrown during the rendering of a template ("An exception occurred in driver: SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost'"). at /var/www/kimai2/templates/partials/l$
[2020-04-20 02:52:15] php.CRITICAL: Uncaught Exception: An exception has been thrown during the rendering of a template ("An exception occurred in driver: SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost'"). {"exception":"[object] (Twig\\Error\\RuntimeError(code: 0): An exception has been thrown duri$
[2020-04-20 02:52:17] request.INFO: Matched route "fos_user_security_login". {"route":"fos_user_security_login","route_parameters":{"_route":"fos_user_security_login","_controller":"fos_user.security.controller:loginAction","_locale":"de"},"request_uri":"http://192.168.178.67/public/index.php/de/login","method":"GE$
[2020-04-20 02:52:17] security.DEBUG: Checking for guard authentication credentials. {"firewall_key":"secured_area","authenticators":1} []
[2020-04-20 02:52:17] security.DEBUG: Checking support on guard authenticator. {"firewall_key":"secured_area","authenticator":"App\\Security\\TokenAuthenticator"} []
[2020-04-20 02:52:17] security.DEBUG: Guard authenticator does not support the request. {"firewall_key":"secured_area","authenticator":"App\\Security\\TokenAuthenticator"} []
[2020-04-20 02:52:17] security.INFO: Populated the TokenStorage with an anonymous Token. [] []
[2020-04-20 02:52:17] request.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\DriverException: "An exception occurred in driver: SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost'" at /var/www/kimai2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 106 {"exception":"$
[2020-04-20 02:52:17] request.CRITICAL: Exception thrown when handling an exception (Twig\Error\RuntimeError: An exception has been thrown during the rendering of a template ("An exception occurred in driver: SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost'"). at /var/www/kimai2/templates/partials/l$
[2020-04-20 02:52:17] php.CRITICAL: Uncaught Exception: An exception has been thrown during the rendering of a template ("An exception occurred in driver: SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost'"). {"exception":"[object] (Twig\\Error\\RuntimeError(code: 0): An exception has been thrown duri$
[2020-04-20 02:52:17] request.CRITICAL: Uncaught PHP Exception Twig\Error\RuntimeError: "An exception has been thrown during the rendering of a template ("An exception occurred in driver: SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost'")." at /var/www/kimai2/templates/partials/logo_login.html.twig $
[2020-04-20 02:52:17] request.CRITICAL: Exception thrown when handling an exception (Twig\Error\RuntimeError: An exception has been thrown during the rendering of a template ("An exception occurred in driver: SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost'"). at /var/www/kimai2/templates/partials/l$
[2020-04-20 02:52:17] php.CRITICAL: Uncaught Exception: An exception has been thrown during the rendering of a template ("An exception occurred in driver: SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost'"). {"exception":"[object] (Twig\\Error\\RuntimeError(code: 0): An exception has been thrown duri$
 
nun scheint der Datenbankbenutzer (der account mit der sich die app bei der db anmeldet) nicht die nötigen Rechte zu haben.
Falls MySql:
Man muss Rechte auf ein Schema geben und für einen Host - in deinem Fall für "localhost"
 
@dermoritz

Also ich habe den Fehler Code noch verkürzen können.

Danke für den Tip, das gab mir die Idee die Konfiguration von doctrine.yaml anzusehen, die unter /var/www/kimai2/config/packages# nano doctrine.yaml liegt.

in dem ich in die default env(DATABASE_URL): '' als Kommentar deklariert habe und Folgendes ersetzt

env(DATABASE_URL): 'mysql://root:slöfjiaopfpaodckmoamäöafdk,mfuck@localhost:3306/kimai'

Code:
parameters:
    # Adds a fallback DATABASE_URL if the env var is not set.
    # This allows you to run cache:warmup even if your
    # environment variables are not available yet.
    # You should not need to change this value.
    #default    env(DATABASE_URL): ''
    env(DATABASE_URL): 'mysql://root:420420@localhost:3306/kimai'

doctrine:
    dbal:
        default_connection: default
        connections:
            default:
                url: '%env(resolve:DATABASE_URL)%'
                driver: 'pdo_mysql'
                # this setting prevents automatic database detection and finds a lot of false-negatives on doctrine:migrations:diff
                # for null columns with MariaDB. Each migration tries to convert EVERY nullable column.
                # server_version: '5.7'
                charset: utf8mb4
                default_table_options:
                    charset: utf8mb4
                    collate: utf8mb4_unicode_ci

        types:
            datetime: App\Doctrine\UTCDateTimeType
    orm:
        auto_generate_proxy_classes: '%kernel.debug%'
        default_entity_manager: default
        entity_managers:
            default:
                connection: default
                naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
                auto_mapping: true
                mappings:
                    App:
                        type: annotation
                        dir: '%kernel.project_dir%/src/Entity'
                        prefix: 'App\Entity'
                        alias: Kimai

Jetzt bekomme ich dies als code

Code:
[2020-04-20 05:38:31] request.ERROR: Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\BadRequestHttpException: "Untrusted Host "192.168.178.67"." at /var/www/kimai2/vendor/symfony/http-kernel/HttpKernel.php line 71 {"exception":"[object$
[2020-04-20 05:38:31] request.CRITICAL: Exception thrown when handling an exception (Twig\Error\LoaderError: Unable to find template "" (looked into: /var/www/kimai2/templates, /var/www/kimai2/vendor/symfony/twig-bridge/Resources/views/Form). at /va$
[2020-04-20 05:38:31] php.CRITICAL: Uncaught Exception: Unable to find template "" (looked into: /var/www/kimai2/templates, /var/www/kimai2/vendor/symfony/twig-bridge/Resources/views/Form). {"exception":"[object] (Twig\\Error\\LoaderError(code: 0): $
[2020-04-20 05:38:31] request.CRITICAL: Uncaught PHP Exception Twig\Error\LoaderError: "Unable to find template "" (looked into: /var/www/kimai2/templates, /var/www/kimai2/vendor/symfony/twig-bridge/Resources/views/Form)." at /var/www/kimai2/vendor/$
[2020-04-20 05:38:31] request.CRITICAL: Exception thrown when handling an exception (Twig\Error\LoaderError: Unable to find template "" (looked into: /var/www/kimai2/templates, /var/www/kimai2/vendor/symfony/twig-bridge/Resources/views/Form). at /va$
[2020-04-20 05:38:31] php.CRITICAL: Uncaught Exception: Unable to find template "" (looked into: /var/www/kimai2/templates, /var/www/kimai2/vendor/symfony/twig-bridge/Resources/views/Form). {"exception":"[object] (Twig\\Error\\LoaderError(code: 0): $

dermoritz schrieb:
Man muss Rechte auf ein Schema geben und für einen Host - in deinem Fall für "localhost"
Das heißt MySQL soll interne Zugriffe erlauben ?

@Vielen Dank :)
 
Zuletzt bearbeitet:
dermoritz schrieb:
nun scheint der Datenbankbenutzer (der account mit der sich die app bei der db anmeldet) nicht die nötigen Rechte zu haben.
Falls MySql:
Man muss Rechte auf ein Schema geben und für einen Host - in deinem Fall für "localhost"
hast recht überprüft aber kein Schima was dies zu bedeuten hat.
Code:
root@webserver:/var/www/kimai2# bin/console doctrine:schema:validate
Mapping
-------
[OK] The mapping files are correct.
Database
--------
[ERROR] The database schema is not in sync with the current mapping file.
 
Zurück
Oben