Page 1 of 1
Can't connect to MySQL DB using LC Server & revIgniter
Posted: Thu Apr 23, 2020 7:41 pm
by xyz
EDIT: I think I found the reason. I set up a simple LC stack to connect to my MySQL DB and received an error saying that the client does not support the authentication protocol requested by the server. I don't know how to change that.

I guess I'm off to the MySQL website.
---
I'm testing a local instance of LC server before I commit to LC server hosting.
I've installed LC community server and revIgniter. Everything seems to be working "like a champ."
I've successfully displayed views with "dynamic data", i.e., data I placed in gData[] in the controller.
Now I want to try sucking some data out of a MySQL DB. I set up MySQL on my machine and I can connect to it via MySQL Workbench. But, I cannot seem to connect using the revIgniter functions.
Using the "blog" example from the revIgniter user guide, I have this controller:
Code: Select all
<?lc
# PUT YOUR HANDLER NAMES INTO THE GLOBAL gControllerHandlers AS A COMMA SEPARATED LIST
put "index,blog" into gControllerHandlers
command blog
get rigLoadDatabase()
end blog
command index
put "Tend Chickens,Get Chips,Pay Bills" into gData["toDoList"]
put "My Real Title" into gData["title"]
put "My To Do List" into gData["heading"]
get rigLoadView("blogview")
end index
When I go to "localhost/blog" I get "Internal Server Error". When I comment out "get rigLoadDatabase()", my blogview displays properly.
I've configured the database settings in application/config/database.lc. All of the settings are correct. (Correct port, correct host, correct username & pw, etc.) It does not work regardless of how I have SSL set (i.e., either SSL turned on or off in both the database and my configuration file).
There must be some configuration error, but I cannot figure out what it is.
Any insight is appreciated.
Re: Can't connect to MySQL DB using LC Server & revIgniter
Posted: Thu Apr 23, 2020 8:03 pm
by Klaus
Maybe closing the LC tag will help?
Re: Can't connect to MySQL DB using LC Server & revIgniter
Posted: Thu Apr 23, 2020 8:07 pm
by xyz
Actually, Ralf Bittner (I believe that is his name) recommends NOT closing the LC tag in server scripts. I just do what I am told to do!!
By the way you can omit the closing “?>” tags in LC server scripts.
Generally it is better to leave terminating "?>" tags off, this way whitespace
at the end of the script does not accidentally output content to the browser.
Re: Can't connect to MySQL DB using LC Server & revIgniter
Posted: Thu Apr 23, 2020 8:29 pm
by Klaus
OK, that was just a shot in the dark...

Re: Can't connect to MySQL DB using LC Server & revIgniter
Posted: Fri Apr 24, 2020 1:34 am
by FourthWorld
xyz wrote: ↑Thu Apr 23, 2020 8:07 pm
Actually, Ralf Bittner (I believe that is his name) recommends NOT closing the LC tag in server scripts. I just do what I am told to do!!
By the way you can omit the closing “?>” tags in LC server scripts.
Generally it is better to leave terminating "?>" tags off, this way whitespace
at the end of the script does not accidentally output content to the browser.
Under what circumstances could that happen?
Re: Can't connect to MySQL DB using LC Server & revIgniter
Posted: Fri Apr 24, 2020 3:06 am
by xyz
I don't know, Richard. I guess you would need to ask Ralf. BTW, I tried your 4wDevo plugin. Pretty cool.
Do you have any idea why I am getting this error when I try to connect to the MySQL DB in a normal LC stack using revOpenDatabase? (Not using LC server or revIgniter)
Client does not support authentication protocol requested by server; consider upgrading MySQL client
I'm using LC v 9.5.1 and MySQL v 8.0.19 (MySQL Community Server) I looked up the issue on the MySQL site and it suggests that the problem lies with revOpenDatabase but that I could solve the problem by downgrading my security (by editing a MySQL config file). That seems like a lousy solution. But I did it anyway and that did not solve the problem.
Any insight would be appreciated.
Re: Can't connect to MySQL DB using LC Server & revIgniter
Posted: Fri Apr 24, 2020 3:21 am
by FourthWorld
xyz wrote: ↑Fri Apr 24, 2020 3:06 am
I don't know, Richard. I guess you would need to ask Ralf. BTW, I tried your 4wDevo plugin. Pretty cool.
Thank you. Feel free to email requests and bugs if you have them.
Do you have any idea why I am getting this error when I try to connect to the MySQL DB in a normal LC stack using revOpenDatabase? (Not using LC server or revIgniter)
Is the DB on a remote machine?
Re: Can't connect to MySQL DB using LC Server & revIgniter
Posted: Fri Apr 24, 2020 4:48 am
by xyz
No, it is on the same machine.
I reinstalled MySQL, this time selecting the down-graded "legacy" authentication and it is now working with LC revOpenDatabase. Now I'll see if that was the problem with LC Server & revIgniter.
Re: Can't connect to MySQL DB using LC Server & revIgniter
Posted: Sat Apr 25, 2020 1:52 am
by rabit
FourthWorld wrote: ↑Fri Apr 24, 2020 1:34 am
xyz wrote: ↑Thu Apr 23, 2020 8:07 pm
Actually, Ralf Bittner (I believe that is his name) recommends NOT closing the LC tag in server scripts. I just do what I am told to do!!
By the way you can omit the closing “?>” tags in LC server scripts.
Generally it is better to leave terminating "?>" tags off, this way whitespace
at the end of the script does not accidentally output content to the browser.
Under what circumstances could that happen?
Here is the reason why it is better to leave terminating “?>” tags in handler libraries off:
The LC engine outputs necessary HTTP headers as well as custom headers,
then the content / output follows the headers.
Now what happens if you use a terminating “?>” tag? As long as you make sure
that the angle bracket is the last character everything works as expected.
But any character following the terminating tag, even a single space, will be output
before the actual content (generated by your script), including the default headers.
This means, in this case setting custom headers by script has no effect because
headers can be sent only once.
Re: Can't connect to MySQL DB using LC Server & revIgniter
Posted: Sat Apr 25, 2020 2:52 am
by FourthWorld
Thanks, Ralf. That sounds like a bug. And if it applies when the last character is LF it's definitely a bug, since many editors enforce the old convention of ending things like config files with a blank line.
Do you know offhand if this has been reported?
Re: Can't connect to MySQL DB using LC Server & revIgniter
Posted: Sat Apr 25, 2020 10:48 am
by rabit
FourthWorld wrote: ↑Sat Apr 25, 2020 2:52 am
Thanks, Ralf. That sounds like a bug. And if it applies when the last character is LF it's definitely a bug, since many editors enforce the old convention of ending things like config files with a blank line.
Do you know offhand if this has been reported?
Richard, I really hate to disagree with you but it is not a bug. This is how it is supposed
to work. If a file contains only LC code the closing tag is definitely not needed.
The only reason the closing tag exists is to tell the engine which content needs to be parsed.
But this is only useful and even necessary for example in files which mix HTML with LC code.
In other cases the closing tags may cause unwanted effects.
So, the simple rule is: To be on the safe site don’t use code block terminating tags in files
which contain solely LC code.
By the way PHP works the same, at least if PHP doesn’t use some sort of
output buffering.
Re: Can't connect to MySQL DB using LC Server & revIgniter
Posted: Sat Apr 25, 2020 3:28 pm
by ghettocottage
Code: Select all
..By the way PHP works the same, at least if PHP doesn’t use some sort of
output buffering.
yep.
When developing a Wordpress site or plugin and suddenly confronted with a white-screen-of-death, the first thing I will do is check for blank spaces and closing brackets at the end of the page.
Re: Can't connect to MySQL DB using LC Server & revIgniter
Posted: Sat Apr 25, 2020 6:56 pm
by FourthWorld
Thanks for the explanation, Ralf. After thinking about it for a bit it does make sense for libraries.
But then again, for libraries why even include the opening tag, why not just use a script-only stack?
Re: Can't connect to MySQL DB using LC Server & revIgniter
Posted: Sat Apr 25, 2020 10:49 pm
by rabit
FourthWorld wrote: ↑Sat Apr 25, 2020 6:56 pm
Thanks for the explanation, Ralf. After thinking about it for a bit it does make sense for libraries.
But then again, for libraries why even include the opening tag, why not just use a script-only stack?
I think CGI scripts and script-only stacks are not interchangeable and both have
their raison d'être. For example all revIgniter libraries which are loaded for the purpose
of providing code for a given task are script-only stacks. But revIgniter’s commands/functions,
which should be executed upon inclusion (right away, avoiding the necessity to include
libraryStack handlers) are CGI scripts. A good example of the latter are configuration files.
Re: Can't connect to MySQL DB using LC Server & revIgniter
Posted: Sat Apr 25, 2020 11:35 pm
by FourthWorld
rabit wrote: ↑Sat Apr 25, 2020 10:49 pm
FourthWorld wrote: ↑Sat Apr 25, 2020 6:56 pm
Thanks for the explanation, Ralf. After thinking about it for a bit it does make sense for libraries.
But then again, for libraries why even include the opening tag, why not just use a script-only stack?
I think CGI scripts and script-only stacks are not interchangeable and both have
their raison d'être. For example all revIgniter libraries which are loaded for the purpose
of providing code for a given task are script-only stacks. But revIgniter’s commands/functions,
which should be executed upon inclusion (right away, avoiding the necessity to include
libraryStack handlers) are CGI scripts. A good example of the latter are configuration files.
Exactly. You specified libraries in your earlier explanation, and that helped me to understand the limited scope of the trailing closing tag as an issue, which is why I also specified libraries in my reply.
It seems we're on the same page.