LibreBooking / app

Repository for the last open source version of Booked Scheduler. The "develop" branch contains the most current working code of the project and should be considered beta. The "master" branch is the most current stable release of BookedScheduler. Please read doc/README.md for further details.
GNU General Public License v3.0
426 stars 245 forks source link

still no luck with PHP 8.1. getting "unknown error" message #171

Open guilegatan opened 1 year ago

guilegatan commented 1 year ago

Sorry to bring it up again. I am still out of luck with PHP 8.1.9/MySQL 8.0.32

I installed the latest development version, and also installed Composer as mentionend somewhere else.

These are my last log lines in the apache error.log: [Fri Feb 10 09:20:22.790289 2023] [php:notice] [pid 966] [client 192.168.0.15:31342] Error: mysqli_sql_exception: Variable ' sql_mode' can't be set to the value of 'NO_AUTO_CREATE_USER' in /var/www/html/app-develop/lib/Database/MySQL/MySqlConnection.php:72\nStack trace:\n#0 /var/www/html/app-develop/lib/Database/MySQL/MySqlConnection.php(72): mysqli_query()\n#1 /var/www/html/app-develop/lib/Database/Database.php(27): MySqlConnection->Query()\n#2 /var/www/html/app-develop/Domain/Access/AnnouncementRepository.php(11): Database->Query()\n#3 /var/www/html/app-develop/Presenters/LoginPresenter.php(123): AnnouncementRepository->GetFuture()\n#4 /var/www/html/app-develop/Pages/LoginPage.php(124): LoginPresenter->PageLoad()\n#5 /var/www/html/app-develop/Web/index.php(25): LoginPage->PageLoad()\n#6 {main}, referer: https://testserver.my.url/app-develop/Web/index.php [Fri Feb 10 09:20:22.790371 2023] [php:notice] [pid 966] [client 192.168.0.15:31342] #0 /var/www/html/app-develop/lib/Common/Logging/ExceptionHandler.php(22): WebExceptionHandler->HandleException(Object(mysqli_sql_exception))\n#1 [internal function]: ExceptionHandler::Handle(Object(mysqli_sql_exception))\n, referer: https://testserver.my.url/app-develop/Web/index.php [Fri Feb 10 09:20:24.363937 2023] [php:notice] [pid 966] [client 192.168.0.15:31342] Error: mysqli_sql_exception: Variable 'sql_mode' can't be set to the value of 'NO_AUTO_CREATE_USER' in /var/www/html/app-develop/lib/Database/MySQL/MySqlConnection.php:72\nStack trace:\n#0 /var/www/html/app-develop/lib/Database/MySQL/MySqlConnection.php(72): mysqli_query()\n#1 /var/www/html/app-develop/lib/Database/Database.php(27): MySqlConnection->Query()\n#2 /var/www/html/app-develop/Domain/Access/AnnouncementRepository.php(11): Database->Query()\n#3 /var/www/html/app-develop/Presenters/LoginPresenter.php(123): AnnouncementRepository->GetFuture()\n#4 /var/www/html/app-develop/Pages/LoginPage.php(124): LoginPresenter->PageLoad()\n#5 /var/www/html/app-develop/Web/index.php(25): LoginPage->PageLoad()\n#6 {main}, referer: https://testserver.my.url/app-develop/Web/index.php [Fri Feb 10 09:20:24.363999 2023] [php:notice] [pid 966] [client 192.168.0.15:31342] #0 /var/www/html/app-develop/lib/Common/Logging/ExceptionHandler.php(22): WebExceptionHandler->HandleException(Object(mysqli_sql_exception))\n#1 [internal function]: ExceptionHandler::Handle(Object(mysqli_sql_exception))\n, referer: https://testserver.my.url/app-develop/Web/index.php

can anyone give me a hint how you got it working? I tried a clean Ubuntu 22.04 install with PHP 8.1.9 and MySQL 8.0.32, and imported my LibreBooking database from my Ubuntu 20.04/PHP 7.4.3/MySQL 8.0.32-server, but with no luck.

Zwischenablage01

cyberfarer commented 1 year ago

I think you must use PHP 7.x. As soon as I switch to PHP8.1 I get the same error.

effgarces commented 1 year ago

PHP 8 should be working, due to the contribution of several people of the community, but unfortunaly at the moment I really don't have time to debug this particular matter, so from just reading the log, it looks like a MySQL problem, not PHP, and it seems to revolve around "sql_mode"

jonnyforestGIS commented 1 year ago

Probably related to this: https://stackoverflow.com/questions/50336378/variable-sql-mode-cant-be-set-to-the-value-of-no-auto-create-user

Important Change: Importing a dump from a MySQL 5.7 server to a server running MySQL 8.0 often failed with ER_WRONG_VALUE_FOR_VAR when an SQL mode not supported by the 8.0 server was used. This could happen frequently due to the fact that NO_AUTO_CREATE_USER is enabled by default in MySQL 5.7 but not supported in MySQL 8.0.

The behavior of the server in such circumstances now depends on the setting of the pseudo_slave_mode system variable. If this is false, the server rejects the mode setting with ER_UNSUPPORTED_SQL_MODE. If pseudo_slave_mode is true, the server ignores the unsupported mode and gives a warning. Note that mysqlbinlog sets pseudo_slave_mode to true prior to executing any SQL. (Bug #90337, Bug #27828236)

_

Cheers

guilegatan commented 1 year ago

Finally got it working with PHP 8.1 with some help from our database guys for the production machines! Thanks everyone for the input! Looking forward to an official version 2.8.5.6.

PVTGoesen commented 1 year ago

Hi, do you have an list of the changes you made?

treborin commented 1 year ago

Pls. check new PR#198

TheHLee commented 1 year ago

I confirmed the above error is showing because 'NO_AUTO_CREATE_USER' has been deprecated since MySQL 8.0.11. See the following link for more info: https://stackoverflow.com/questions/71110454/no-auto-create-user-in-mysql-8-0

I removed NO_AUTO_CREATE_USER from MySqlConnection.php and that fixed the problem for me.

My environment:

hakito commented 1 year ago

I can also confirm it's not working with MySQL 8. Wiki should indicate that MySQL Version should be < 8.0.11 so far?

colisee commented 1 year ago

@hakito ,

did you try the solution that was given by @TheHLee on Sep 6 ?

hakito commented 1 year ago

Yes I tried it and the error was gone. But because I was unsure about other potential problems, I returned to an older MySQL Version.

colisee commented 1 year ago

@hakito, glad your problem is gone. Could you please close this issue?

hakito commented 1 year ago

@colisee I can't close it - I did not open the issue!

reaseno commented 1 month ago

There are two solutions/workarounds:

  1. remove NO_AUTO_CREATE_USER from lib/Database/MySQL/MySqlConnection.php
  2. add mysqli_report(MYSQLI_REPORT_OFF); to the config.php file, which is there by default

However, the line from the second option is removed when you edit the configuration in the admin menu (tested in v2.8.6.1). So the first solution is the better one.

Thus, the issue should not be closed until this is fixed.