kimai / kimai

Kimai is a web-based multi-user time-tracking application. Works great for everyone: freelancers, companies, organizations - everyone can track their times, generate reports, create invoices and do so much more. SaaS version available at https://www.kimai.cloud
https://www.kimai.org
GNU Affero General Public License v3.0
3.01k stars 529 forks source link

Allowed memory size of 134217728 bytes exhausted PHP (Correct file permissions set) #975

Closed trentks closed 4 years ago

trentks commented 4 years ago

Describe the bug PHP is running out of memory, identical to #659, I have double checked permissions etc as per the guide.

To Reproduce Steps to reproduce the behavior:

  1. Follow installation guide from https://www.kimai.org/documentation/installation.html replacing with */kimai2/* replacement for */kimai/* as per pull request here: https://github.com/kimai/www.kimai.org/pull/32
  2. Restart apache systemctl restart apache2.
  3. Set read-write permissions (nuclear option) as per #659 chmod a+rwx -R /var/www/kimai2
  4. Set ownership as per #659 chown www-data:www-data -R /var/www/kimai2
  5. Ensure permissions, copied below ls -al /var/www/kimai2/
    ls -al /var/www/kimai2/
    total 972
    drwxrwxrwx 14 www-data www-data   4096 Jul 22 10:26 .
    drwxr-xr-x  6 www-data www-data   4096 Jul 22 10:16 ..
    drwxrwxrwx  5 www-data www-data   4096 Jul 22 10:17 assets
    drwxrwxrwx  2 www-data www-data   4096 Jul 22 10:15 bin
    -rwxrwxrwx  1 www-data www-data  82327 Jul 22 10:15 CHANGELOG.md
    -rwxrwxrwx  1 www-data www-data    487 Jul 22 10:15 .codecov.yml
    -rwxrwxrwx  1 www-data www-data   4632 Jul 22 10:15 composer.json
    -rwxrwxrwx  1 www-data www-data 410452 Jul 22 10:15 composer.lock
    drwxrwxrwx  6 www-data www-data   4096 Jul 22 10:17 config
    -rwxrwxrwx  1 www-data www-data   1235 Jul 22 10:15 CONTRIBUTING.md
    -rwxrwxrwx  1 www-data www-data   1905 Jul 22 10:15 Dockerfile
    -rwxrwxrwx  1 www-data www-data    224 Jul 22 10:15 .editorconfig
    -rwxrwxrwx  1 www-data www-data     65 Jul 22 10:21 .env
    -rwxrwxrwx  1 www-data www-data   1446 Jul 22 10:15 .env.dist
    drwxrwxrwx  8 www-data www-data   4096 Jul 22 10:17 .git
    drwxrwxrwx  3 www-data www-data   4096 Jul 22 10:15 .github
    -rwxrwxrwx  1 www-data www-data    154 Jul 22 10:15 .github_changelog_generator
    -rwxrwxrwx  1 www-data www-data   1000 Jul 22 10:15 .gitignore
    -rwxrwxrwx  1 www-data www-data   1100 Jul 22 10:15 LICENSE
    -rwxrwxrwx  1 www-data www-data   1226 Jul 22 10:15 package.json
    -rwxrwxrwx  1 www-data www-data   5585 Jul 22 10:15 .php_cs.dist
    -rwxrwxrwx  1 www-data www-data   1345 Jul 22 10:15 phpstan.neon
    -rwxrwxrwx  1 www-data www-data   2859 Jul 22 10:15 phpunit.xml.dist
    drwxrwxrwx  5 www-data www-data   4096 Jul 22 10:30 public
    -rwxrwxrwx  1 www-data www-data   4084 Jul 22 10:15 README.md
    -rwxrwxrwx  1 www-data www-data   1077 Jul 22 10:15 SECURITY.md
    drwxrwxrwx 28 www-data www-data   4096 Jul 22 10:15 src
    -rwxrwxrwx  1 www-data www-data  18078 Jul 22 10:29 symfony.lock
    drwxrwxrwx 24 www-data www-data   4096 Jul 22 10:15 templates
    drwxrwxrwx 28 www-data www-data   4096 Jul 22 10:15 tests
    drwxrwxrwx  2 www-data www-data  12288 Jul 22 10:17 translations
    -rwxrwxrwx  1 www-data www-data   1135 Jul 22 10:15 .travis.yml
    -rwxrwxrwx  1 www-data www-data   8032 Jul 22 10:15 UPGRADING.md
    drwxrwxrwx  7 www-data www-data   4096 Jul 22 10:15 var
    drwxrwxrwx 42 www-data www-data   4096 Jul 22 10:29 vendor
    -rwxrwxrwx  1 www-data www-data   1679 Jul 22 10:15 webpack.config.js
    -rwxrwxrwx  1 www-data www-data 315489 Jul 22 10:15 yarn.lock
  6. Monitor the log file tail -f /var/log/kimai_error.log (see step 8 for output)
  7. Browse to webserver in web-browser (http://<server-ip>/), redirects to http://<server-ip>/index.php/en/homepage, but presents a blank page.
  8. Read logfile:
    [Mon Jul 22 11:30:51.743520 2019] [php7:error] [pid 12312] [client 192.168.1.202:49548] PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /var/www/kimai2/vendor/symfony/security/Core/Authorization/AuthorizationChecker.php on line 49
    [Mon Jul 22 11:30:51.745669 2019] [php7:error] [pid 12312] [client 192.168.1.202:49548] PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 73728 bytes) in /var/www/kimai2/vendor/composer/ClassLoader.php on line 444

Additional context Add any other context about the problem here.

kevinpapst commented 4 years ago

Anyting in the logfile?

trentks commented 4 years ago

Hi @kevinpapst

Could you be more specific, is there another log file that is useful to look at? In step 8 is the tail of the /var/log/kimai_error.log file. Copied again below.

[Mon Jul 22 11:30:51.743520 2019] [php7:error] [pid 12312] [client 192.168.1.202:49548] PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /var/www/kimai2/vendor/symfony/security/Core/Authorization/AuthorizationChecker.php on line 49
[Mon Jul 22 11:30:51.745669 2019] [php7:error] [pid 12312] [client 192.168.1.202:49548] PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 73728 bytes) in /var/www/kimai2/vendor/composer/ClassLoader.php on line 444

Cheers.

kevinpapst commented 4 years ago

https://www.kimai.org/documentation/faq.html#i-have-a-problem :-D

kevinpapst commented 4 years ago

btw you should see http://<server-ip>/ and not http://<server-ip>/index.php/en/homepage

trentks commented 4 years ago

Sorry @kevinpapst I had missed that!

Some tail end stuff out of /var/www/kimai2/var/log/prod.log:

[2019-07-22 12:01:57] request.INFO: Matched route "home". {"route":"home","route_parameters":{"_route":"home","_controller":"Symfony\\Bundle\\FrameworkBundle\\Controller\\RedirectController::redirectAction","route":"homepage","permanent":true},"request_uri":"http://219.89.117.89/index.php/","method":"GET"} []
[2019-07-22 12:01:57] request.CRITICAL: Uncaught PHP Exception Symfony\Component\DependencyInjection\Exception\EnvNotFoundException: "Environment variable not found: "APP_SECRET"." at /var/www/kimai2/vendor/symfony/dependency-injection/EnvVarProcessor.php line 96 {"exception":"[object] (Symfony\\Component\\DependencyInjection\\Exception\\EnvNotFoundException(code: 0): Environment variable not found: \"APP_SECRET\". at /var/www/kimai2/vendor/symfony/dependency-injection/EnvVarProcessor.php:96)"} []
[2019-07-22 12:01:57] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException: "The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL." at /var/www/kimai2/vendor/symfony/security/Core/Authorization/AuthorizationChecker.php line 49 {"exception":"[object] (Symfony\\Component\\Security\\Core\\Exception\\AuthenticationCredentialsNotFoundException(code: 0): The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL. at /var/www/kimai2/vendor/symfony/security/Core/Authorization/AuthorizationChecker.php:49)"} []
[2019-07-22 12:01:57] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException: "The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL." at /var/www/kimai2/vendor/symfony/security/Core/Authorization/AuthorizationChecker.php line 49 {"exception":"[object] (Symfony\\Component\\Security\\Core\\Exception\\AuthenticationCredentialsNotFoundException(code: 0): The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL. at /var/www/kimai2/vendor/symfony/security/Core/Authorization/AuthorizationChecker.php:49)"} []
[2019-07-22 12:01:57] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException: "The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL." at /var/www/kimai2/vendor/symfony/security/Core/Authorization/AuthorizationChecker.php line 49 {"exception":"[object] (Symfony\\Component\\Security\\Core\\Exception\\AuthenticationCredentialsNotFoundException(code: 0): The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL. at /var/www/kimai2/vendor/symfony/security/Core/Authorization/AuthorizationChecker.php:49)"} []
[2019-07-22 12:01:57] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException: "The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL." at /var/www/kimai2/vendor/symfony/security/Core/Authorization/AuthorizationChecker.php line 49 {"exception":"[object] (Symfony\\Component\\Security\\Core\\Exception\\AuthenticationCredentialsNotFoundException(code: 0): The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL. at /var/www/kimai2/vendor/symfony/security/Core/Authorization/AuthorizationChecker.php:49)"} []
[2019-07-22 12:01:57] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException: "The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL." at /var/www/kimai2/vendor/symfony/security/Core/Authorization/AuthorizationChecker.php line 49 {"exception":"[object] (Symfony\\Component\\Security\\Core\\Exception\\AuthenticationCredentialsNotFoundException(code: 0): The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL. at /var/www/kimai2/vendor/symfony/security/Core/Authorization/AuthorizationChecker.php:49)"} []
[2019-07-22 12:01:57] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException: "The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL." at /var/www/kimai2/vendor/symfony/security/Core/Authorization/AuthorizationChecker.php line 49 {"exception":"[object] (Symfony\\Component\\Security\\Core\\Exception\\AuthenticationCredentialsNotFoundException(code: 0): The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL. at /var/www/kimai2/vendor/symfony/security/Core/Authorization/AuthorizationChecker.php:49)"} []
[2019-07-22 12:01:57] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException: "The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL." at /var/www/kimai2/vendor/symfony/security/Core/Authorization/AuthorizationChecker.php line 49 {"exception":"[object] (Symfony\\Component\\Security\\Core\\Exception\\AuthenticationCredentialsNotFoundException(code: 0): The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL. at /var/www/kimai2/vendor/symfony/security/Core/Authorization/AuthorizationChecker.php:49)"} []
[2019-07-22 12:01:57] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException: "The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL." at /var/www/kimai2/vendor/symfony/security/Core/Authorization/AuthorizationChecker.php line 49 {"exception":"[object] (Symfony\\Component\\Security\\Core\\Exception\\AuthenticationCredentialsNotFoundException(code: 0): The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL. at /var/www/kimai2/vendor/symfony/security/Core/Authorization/AuthorizationChecker.php:49)"} []
[2019-07-22 12:01:57] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException: "The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL." at /var/www/kimai2/vendor/symfony/security/Core/Authorization/AuthorizationChecker.php line 49 {"exception":"[object] (Symfony\\Component\\Security\\Core\\Exception\\AuthenticationCredentialsNotFoundException(code: 0): The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL. at /var/www/kimai2/vendor/symfony/security/Core/Authorization/AuthorizationChecker.php:49)"} []
[2019-07-22 12:01:57] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException: "The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL." at /var/www/kimai2/vendor/symfony/security/Core/Authorization/AuthorizationChecker.php line 49 {"exception":"[object] (Symfony\\Component\\Security\\Core\\Exception\\AuthenticationCredentialsNotFoundException(code: 0): The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL. at /var/www/kimai2/vendor/symfony/security/Core/Authorization/AuthorizationChecker.php:49)"} []
[2019-07-22 12:01:57] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException: "The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL." at /var/www/kimai2/vendor/symfony/security/Core/Authorization/AuthorizationChecker.php line 49 {"exception":"[object] (Symfony\\Component\\Security\\Core\\Exception\\AuthenticationCredentialsNotFoundException(code: 0): The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL. at /var/www/kimai2/vendor/symfony/security/Core/Authorization/AuthorizationChecker.php:49)"} []
[2019-07-22 12:01:57] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException: "The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL." at /var/www/kimai2/vendor/symfony/security/Core/Authorization/AuthorizationChecker.php line 49 {"exception":"[object] (Symfony\\Component\\Security\\Core\\Exception\\AuthenticationCredentialsNotFoundException(code: 0): The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL. at /var/www/kimai2/vendor/symfony/security/Core/Authorization/AuthorizationChecker.php:49)"} []
[2019-07-22 12:01:57] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException: "The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL." at /var/www/kimai2/vendor/symfony/security/Core/Authorization/AuthorizationChecker.php line 49 {"exception":"[object] (Symfony\\Component\\Security\\Core\\Exception\\AuthenticationCredentialsNotFoundException(code: 0): The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL. at /var/www/kimai2/vendor/symfony/security/Core/Authorization/AuthorizationChecker.php:49)"} []
[2019-07-22 12:01:57] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException: "The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL." at /var/www/kimai2/vendor/symfony/security/Core/Authorization/AuthorizationChecker.php line 49 {"exception":"[object] (Symfony\\Component\\Security\\Core\\Exception\\AuthenticationCredentialsNotFoundException(code: 0): The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL. at /var/www/kimai2/vendor/symfony/security/Core/Authorization/AuthorizationChecker.php:49)"} []
[2019-07-22 12:01:57] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException: "The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL." at /var/www/kimai2/vendor/symfony/security/Core/Authorization/AuthorizationChecker.php line 49 {"exception":"[object] (Symfony\\Component\\Security\\Core\\Exception\\AuthenticationCredentialsNotFoundException(code: 0): The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL. at /var/www/kimai2/vendor/symfony/security/Core/Authorization/AuthorizationChecker.php:49)"} []
[2019-07-22 12:01:57] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException: "The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL." at /var/www/kimai2/vendor/symfony/security/Core/Authorization/AuthorizationChecker.php line 49 {"exception":"[object] (Symfony\\Component\\Security\\Core\\Exception\\AuthenticationCredentialsNotFoundException(code: 0): The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL. at /var/www/kimai2/vendor/symfony/security/Core/Authorization/AuthorizationChecker.php:49)"} []
[2019-07-22 12:01:57] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException: "The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL." at /var/www/kimai2/vendor/symfony/security/Core/Authorization/AuthorizationChecker.php line 49 {"exception":"[object] (Symfony\\Component\\Security\\Core\\Exception\\AuthenticationCredentialsNotFoundException(code: 0): The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL. at /var/www/kimai2/vendor/symfony/security/Core/Authorization/AuthorizationChecker.php:49)"} []
[2019-07-22 12:01:57] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException: "The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL." at /var/www/kimai2/vendor/symfony/security/Core/Authorization/AuthorizationChecker.php line 49 {"exception":"[object] (Symfony\\Component\\Security\\Core\\Exception\\AuthenticationCredentialsNotFoundException(code: 0): The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL. at /var/www/kimai2/vendor/symfony/security/Core/Authorization/AuthorizationChecker.php:49)"} []
[2019-07-22 12:01:57] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException: "The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL." at /var/www/kimai2/vendor/symfony/security/Core/Authorization/AuthorizationChecker.php line 49 {"exception":"[object] (Symfony\\Component\\Security\\Core\\Exception\\AuthenticationCredentialsNotFoundException(code: 0): The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL. at /var/www/kimai2/vendor/symfony/security/Core/Authorization/AuthorizationChecker.php:49)"} []
trentks commented 4 years ago

btw you should see http://<server-ip>/ and not http://<server-ip>/index.php/en/homepage

Yeah sorry, step 7 was misformatted, I've editted it now. I am browsing to http://<server-ip>/ and it's redirecting me to http://<server-ip>/index.php/en/homepage.

kevinpapst commented 4 years ago

As written in the FAQ, many problems reveal themself after checking it ;-)

Environment variable not found: \"APP_SECRET\".

If you use env vars from the vhost, then you have to set all of them. First remove them from your vhost config and test with the .env file. If that works, try to set them via the vhost.

The redirect is definitely wrong (or at least unwanted, maybe it works nevertheless). Don't know why, I am not using Apache and can't test right it now.

trentks commented 4 years ago

Thanks for your help @kevinpapst,

I've at least progressed the problem--it's now redirecting to http://192.168.1.5/index.php/en/login which is progress.

/var/www/var/log/prod.log is now reading:

tail -f /var/www/kimai2/var/log/prod.log 
[2019-07-22 12:14:47] security.DEBUG: Checking for guard authentication credentials. {"firewall_key":"secured_area","authenticators":1} []
[2019-07-22 12:14:47] security.DEBUG: Checking support on guard authenticator. {"firewall_key":"secured_area","authenticator":"App\\Security\\TokenAuthenticator"} []
[2019-07-22 12:14:47] security.DEBUG: Guard authenticator does not support the request. {"firewall_key":"secured_area","authenticator":"App\\Security\\TokenAuthenticator"} []
[2019-07-22 12:14:47] security.INFO: Populated the TokenStorage with an anonymous Token. [] []
[2019-07-22 12:14:47] request.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\DBALException: "An exception occured while establishing a connection to figure out your platform version. You can circumvent this by setting a 'server_version' configuration value  For further information have a look at: https://github.com/doctrine/DoctrineBundle/issues/673" at /var/www/kimai2/vendor/doctrine/doctrine-bundle/ConnectionFactory.php line 79 {"exception":"[object] (Doctrine\\DBAL\\DBALException(code: 0): An exception occured while establishing a connection to figure out your platform version.\nYou can circumvent this by setting a 'server_version' configuration value\n\nFor further information have a look at:\nhttps://github.com/doctrine/DoctrineBundle/issues/673 at /var/www/kimai2/vendor/doctrine/doctrine-bundle/ConnectionFactory.php:79, Doctrine\\DBAL\\Exception\\ConnectionException(code: 0): An exception occurred in driver: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: No address associated with hostname at /var/www/kimai2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:93, Doctrine\\DBAL\\Driver\\PDOException(code: 2002): SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: No address associated with hostname at /var/www/kimai2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:31, PDOException(code: 2002): SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: No address associated with hostname at /var/www/kimai2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:27, PDOException(code: 0): PDO::__construct(): php_network_getaddresses: getaddrinfo failed: No address associated with hostname at /var/www/kimai2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:27)"} []
[2019-07-22 12:14:47] request.CRITICAL: Exception thrown when handling an exception (Twig\Error\SyntaxError: Unknown "get_title" function. at /var/www/kimai2/templates/base.html.twig line 4) {"exception":"[object] (Twig\\Error\\SyntaxError(code: 0): Unknown \"get_title\" function. at /var/www/kimai2/templates/base.html.twig:4)"} []
[2019-07-22 12:14:47] php.CRITICAL: Uncaught Exception: Unknown "get_title" function. {"exception":"[object] (Twig\\Error\\SyntaxError(code: 0): Unknown \"get_title\" function. at /var/www/kimai2/templates/base.html.twig:4, Doctrine\\DBAL\\DBALException(code: 0): An exception occured while establishing a connection to figure out your platform version.\nYou can circumvent this by setting a 'server_version' configuration value\n\nFor further information have a look at:\nhttps://github.com/doctrine/DoctrineBundle/issues/673 at /var/www/kimai2/vendor/doctrine/doctrine-bundle/ConnectionFactory.php:79, Doctrine\\DBAL\\Exception\\ConnectionException(code: 0): An exception occurred in driver: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: No address associated with hostname at /var/www/kimai2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:93, Doctrine\\DBAL\\Driver\\PDOException(code: 2002): SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: No address associated with hostname at /var/www/kimai2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:31, PDOException(code: 2002): SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: No address associated with hostname at /var/www/kimai2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:27, PDOException(code: 0): PDO::__construct(): php_network_getaddresses: getaddrinfo failed: No address associated with hostname at /var/www/kimai2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:27)"} []
[2019-07-22 12:14:47] request.CRITICAL: Uncaught PHP Exception Twig\Error\SyntaxError: "Unknown "get_title" function." at /var/www/kimai2/templates/base.html.twig line 4 {"exception":"[object] (Twig\\Error\\SyntaxError(code: 0): Unknown \"get_title\" function. at /var/www/kimai2/templates/base.html.twig:4, Doctrine\\DBAL\\DBALException(code: 0): An exception occured while establishing a connection to figure out your platform version.\nYou can circumvent this by setting a 'server_version' configuration value\n\nFor further information have a look at:\nhttps://github.com/doctrine/DoctrineBundle/issues/673 at /var/www/kimai2/vendor/doctrine/doctrine-bundle/ConnectionFactory.php:79, Doctrine\\DBAL\\Exception\\ConnectionException(code: 0): An exception occurred in driver: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: No address associated with hostname at /var/www/kimai2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:93, Doctrine\\DBAL\\Driver\\PDOException(code: 2002): SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: No address associated with hostname at /var/www/kimai2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:31, PDOException(code: 2002): SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: No address associated with hostname at /var/www/kimai2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:27, PDOException(code: 0): PDO::__construct(): php_network_getaddresses: getaddrinfo failed: No address associated with hostname at /var/www/kimai2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:27)"} []
[2019-07-22 12:14:47] request.CRITICAL: Exception thrown when handling an exception (Twig\Error\SyntaxError: Unknown "get_title" function. at /var/www/kimai2/templates/base.html.twig line 4) {"exception":"[object] (Twig\\Error\\SyntaxError(code: 0): Unknown \"get_title\" function. at /var/www/kimai2/templates/base.html.twig:4)"} []
[2019-07-22 12:14:47] php.CRITICAL: Uncaught Exception: Unknown "get_title" function. {"exception":"[object] (Twig\\Error\\SyntaxError(code: 0): Unknown \"get_title\" function. at /var/www/kimai2/templates/base.html.twig:4, Twig\\Error\\SyntaxError(code: 0): Unknown \"get_title\" function. at /var/www/kimai2/templates/base.html.twig:4, Doctrine\\DBAL\\DBALException(code: 0): An exception occured while establishing a connection to figure out your platform version.\nYou can circumvent this by setting a 'server_version' configuration value\n\nFor further information have a look at:\nhttps://github.com/doctrine/DoctrineBundle/issues/673 at /var/www/kimai2/vendor/doctrine/doctrine-bundle/ConnectionFactory.php:79, Doctrine\\DBAL\\Exception\\ConnectionException(code: 0): An exception occurred in driver: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: No address associated with hostname at /var/www/kimai2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:93, Doctrine\\DBAL\\Driver\\PDOException(code: 2002): SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: No address associated with hostname at /var/www/kimai2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:31, PDOException(code: 2002): SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: No address associated with hostname at /var/www/kimai2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:27, PDOException(code: 0): PDO::__construct(): php_network_getaddresses: getaddrinfo failed: No address associated with hostname at /var/www/kimai2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:27)"} []

And /var/log/kimai2_error.log is now reading:

[Mon Jul 22 12:14:47.739732 2019] [php7:error] [pid 14066] [client 192.168.1.202:50054] PHP Fatal error:  Uncaught PDOException: PDO::__construct(): php_network_getaddresses: getaddrinfo failed: No address 
[Mon Jul 22 12:14:47.739732 2019] [php7:error] [pid 14066] [client 192.168.1.202:50054] PHP Fatal error:  Uncaught PDOException: PDO::__construct(): php_network_getaddresses: getaddrinfo failed: No address associated with hostname in /var/www/kimai2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:27\nStack trace:\n#0 /var/www/kimai2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(27): PDO->__construct('mysql:host=host...', '<user>', '<password>', Array)\n#1 /var/www/kimai2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php(25): Doctrine\\DBAL\\Driver\\PDOConnection->__construct('mysql:host=host...', '<user>', '<password>', Array)\n#2 /var/www/kimai2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(356): Doctrine\\DBAL\\Driver\\PDOMySql\\Driver->connect(Array, '<user>', '<password>', Array)\n#3 /var/www/kimai2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(420): Doctrine\\DBAL\\Connection->connect()\n#4 /var/www/kimai2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(380): Doctrine\\DBAL\\Connection->getDatabasePlatformVersion()\n#5 /var/www/kimai2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connecti in /var/www/kimai2/templates/base.html.twig on line 4

Still somewhat perplexed, but I'll have a deeper dig into it--seems to be struggling to find a server version? Lunch first. Thanks for your help @kevinpapst.

trentks commented 4 years ago

Solved it:

I'd missed the host part of the SetEnv DATABASE_URL "mysql://<user>:<password>@<host>:<port>/kimai2" line in the vhost file.

It had read: SetEnv DATABASE_URL "mysql://<user>:<password>@host:<port>/kimai2"

It needed to be altered to: SetEnv DATABASE_URL "mysql://<user>:<password>@localhost:<port>/kimai2"

Thanks again for your help @kevinpapst.

lock[bot] commented 4 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. If you use Kimai on a daily basis, please consider donating to support further development of Kimai.