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.04k stars 531 forks source link

Error Installation brand new Debian10, Apache2, PHP7.3 #1095

Closed erdenkind closed 4 years ago

erdenkind commented 4 years ago

Describe the bug The Installation of Kimai2 bin/console kimai:install breaks

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

To Reproduce Steps to reproduce the behavior:

  1. Base System installed as described in the documentation
  2. Install Kima2 started
  3. See error

Logfile

See error above
kevinpapst commented 4 years ago

That often indicates that your .env DATABASE_URL is misconfigured. If you are 110% sure it correct, you can try to edit the file config/packages/doctrine.yaml and change # server_version: '5.7' to server_version: '5.7', then run bin/console cache:clear and run the installer again. But first check twice that your DATABASE_URL is correct.

erdenkind commented 4 years ago

.env (uncommented lines deleted) MAILER_FROM=kimai@example.com APP_ENV=prod APP_SECRET=change_this_to_something_unique DATABASE_URL=mysql://kimaifour:passwd@127.0.0.1:3306/kimaifour MAILER_URL=null://localhost CORS_ALLOW_ORIGIN=^https?://localhost(:[0-9]+)?$

erdenkind commented 4 years ago

Doctrine.yaml:

doctrine: dbal: default_connection: default connections: default: url: '%env(resolve:DATABASE_URL)%' driver: 'pdo_mysql' server_version: '5.7' charset: utf8mb4 default_table_options: charset: utf8mb4 collate: utf8mb4_unicode_ci

...

erdenkind commented 4 years ago

Error still exists:

In ConnectionFactory.php line 79:

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

In AbstractMySQLDriver.php line 93:

An exception occurred in driver: SQLSTATE[HY000] [1045] Access denied for user 'kimaifour'@'localhost' (using password: YES)

In PDOConnection.php line 31:

SQLSTATE[HY000] [1045] Access denied for user 'kimaifour'@'localhost' (using password: YES)

In PDOConnection.php line 27:

SQLSTATE[HY000] [1045] Access denied for user 'kimaifour'@'localhost' (using password: YES)

kevinpapst commented 4 years ago

This is your real problem:

Access denied for user 'kimaifour'@'localhost' (using password: YES)

As I said:

That often indicates that your .env DATABASE_URL is misconfigured.

The error An exception occured while establishing a connection to figure out your platform version. You can circumvent this by setting a 'server_version' configuration value is misleading, because it is just a follow up error.

You have to fix your database connection. If Kimai can't reach the database, the server version cannot be found as well. You can revert the changes in the doctrine.yaml.

erdenkind commented 4 years ago

Hello,

sorry for a Little offtopic questioning:

mysql starts..normally. Connect kimaifour works fine

Do you have a little howto, how to configure the mysql database after a brand new installation?

That's what I did for the kimaifour User (full acces for the first test) CREATE USER 'kimaifour'@'localhost' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON . TO 'kimaifor'@'localhost';

phpMyAdmin works absolutely fine on the LAMP Installation...

kevinpapst commented 4 years ago

That has actually nothing to do with Kimai and is documented thousands of times in the Internet ;-) But here you go: https://www.kimai.org/documentation/fresh-ubuntu-18.html#create-database

Is that just a typo here or also in your installation?

GRANT ALL PRIVILEGES ON . TO 'kimaifor'@'localhost';

kimaifor vs kimaifour

erdenkind commented 4 years ago

Hello back,

Is that just a typo here or also in your installation? sorry, only a typo problem.

MariaDB [(none)]> CREATE DATABASE IF NOT EXISTS kimaifour; Query OK, 1 row affected (0.001 sec) MariaDB [(none)]> CREATE USER IF NOT EXISTS kimaifour@127.0.0.1 IDENTIFIED BY "passwd"; Query OK, 0 rows affected (0.001 sec) MariaDB [(none)]> GRANT select,insert,update,delete,create,alter,drop,index,references ON kimaifour.* TO kimaifour@127.0.0.1; Query OK, 0 rows affected (0.000 sec) MariaDB [(none)]> exit; Bye

Still the connection problem, but only with the kimai installation. PHP Check files are able to connect to the mariaDB.

There are users for 127...and localhost in the mariaDB:

127.0.0.1 | kimaifour | HASH | localhost | kimaifour | THE SAME HASH |

kevinpapst commented 4 years ago

Show me the check files please. Is "passwd" really your password? Or is it some string containing special character? But still: Kimai (Doctrine) uses normal pdo connections.

erdenkind commented 4 years ago

passwd means: my original password overwritten Sorry for bothering: what do you mean with "check files"..? I am a novice about the installation..

I can connect to MariaDB by sudo mysql: MariaDB [(none)]> I can show the users and the database kimaifour: 127.0.0.1 | kimaifour | HASH | and localhost | kimaifour | THE SAME HASH | I do have the privileges set as described.

But still the kimai install error.

kevinpapst commented 4 years ago

Whatever you mean with:

PHP Check files are able to connect to the mariaDB.

Show me the real connection string. This complete discussion is about solving your local problem. Kimai works fine, you have a problem in YOUR installation. If you want any more help, you have to show me the exact commands and configs you are using.

erdenkind commented 4 years ago

DATABASE_URL=mysql://kimaifour:applet4E$n@127.0.0.1:3306/kimaifour

kevinpapst commented 4 years ago

Can you please try (in this order) two things, I believe the $ is the problem.

kevinpapst commented 4 years ago

And if that still fails, the last idea I have is to replace this line from url: '%env(resolve:DATABASE_URL)%' to url: '%env(DATABASE_URL)%'

erdenkind commented 4 years ago

YESYESYES!

The dollar sign was the problem! THANKS!!!

But what does that mean: [ERROR] Failed to clear cache: You have requested a non-existent parameter "kimai.theme".

kevinpapst commented 4 years ago

Do you have a local.yaml?

erdenkind commented 4 years ago

..I do have all the files that where downloaded by the git dup.

kevinpapst commented 4 years ago

What does git status report?

kevinpapst commented 4 years ago

Try rm -rf var/cache/* and then a bin/console cache:warmup --env=prod

erdenkind commented 4 years ago

Super!

[OK] Cache for the "prod" environment (debug=false) was successfully warmed.

kevinpapst commented 4 years ago

Maybe some hickup due to the previous problems.

erdenkind commented 4 years ago

Sorry for another "user"question: after the installation: what is the url that I can reach kimai now? Or do I have to add it into the apache2 first? (if YES: how to add the kimai2: its files are located under /var/www/kimai2/ ..default website apache2 /var/www/html/

kevinpapst commented 4 years ago

Did you consider to read the documentation first? I know asking is easier ...- but its all in there: https://www.kimai.org/documentation/installation.html#webserver https://www.kimai.org/documentation/fresh-ubuntu-18.html https://www.kimai.org/documentation/webserver-configuration.html

acmeraptor commented 4 years ago

You can feel free to check my temporary wiki at https://wiki.casperbb.com/view/Wyvt-rsksolutions I'm trying to meld a couple of things onto a fresh virtual machine to suit my business needs, but the kimai2 parts work perfectly using Kevin's documentation (even LDAP). I just had to pull pieces from his various links to make it flow a little better.

kevinpapst commented 4 years ago

Awesome @acmeraptor thanks for sharing 👍 if you have any hint how to improve the official documentation, please let me know! It's not that easy to write a good documentation, if you don't need it yourself ;-)

acmeraptor commented 4 years ago

@kevinpapst Your documentation has been some of the best I have ever seen. Each setup is different depending on various needs, including mine. I would be happy to help other users with things like this though so that you can keep working on kimai2 for all of us. :)

kevinpapst commented 4 years ago

Seems to be solved

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.