HugoFara / lwt

Learn languages by reading! A language learning app stemmed from Learning with Texts (LWT).
https://hugofara.github.io/lwt/
The Unlicense
169 stars 19 forks source link

WordPress privileges needed to change max_heap_table_size #104

Closed graciax452 closed 1 year ago

graciax452 commented 1 year ago

Describe the bug I have installed on a WordPress site but am getting this error:

Parse error: syntax error, unexpected '|', expecting '{' in /homepages/28/d868714141/htdocs/clickandbuilds/SpeakShona/hlwt/inc/session_utility.php on line 925

To Reproduce Steps to reproduce the behavior:

Upload unzipped files to wordpress and change config file with server details, launch lwt and see error

Expected behavior lwt home screen

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information): Windows 10

Additional context Old LWT installed and working fine

HugoFara commented 1 year ago

Hi! Are you using PHP 8 or above? PHP 7.4 is abandoned since last year.

graciax452 commented 1 year ago

Upgraded to 8.2 and it worked thanks. is there a way for me to import a database from the old LWT?

I tried to and got this error image

image

image

image

image

graciax452 commented 1 year ago

Hi any clue how I get the texts working?

HugoFara commented 1 year ago

Hello! I think the simplest solution is to raise your privileges. Basically LWT needs a lot of permissions (admin-level), and some features do not work otherwise.

I also looked at the code, you can try to comment lines 1257 and 1258 (or simply delete them), I think it will work, but you may meet this issue elsewhere. The function check_text_with_expressions is a dirty mess of SQL, it may take some time to rewrite it in PHP so I think I won't be doing it before long.

Sorry for the late answer!

graciax452 commented 1 year ago

I couldn't figure out what to, will just revert to old LWT for now :)

HugoFara commented 1 year ago

Ah sorry my comment was not so clear re-reading it :open_mouth:

You can open the file inc/database_connect.php, search and remove


    do_mysqli_query('SET GLOBAL max_heap_table_size = 1024 * 1024 * 1024 * 2');
    do_mysqli_query('SET GLOBAL tmp_table_size = 1024 * 1024 * 1024 * 2');

at lines 1527 and 1258. It is in the function check_text_with_expressions.

I hope that helps you!

HugoFara commented 1 year ago

I tried to change the code so that the issue won't happen, the logic of the code itself is a problem, so I won't be able to solve your issue easily. I'm closing this thread for now, as I cannot see as something that can be solved. Thanks for signaling the issue though!