starting to play a bit more with LC Server I've come to some questions I'd like to ask you who are more experienced here.
For clarification, it's about CGI mode - I want to talk to the server via
Code: Select all
put URL (myServerURL & "test.lc") into myVar -- returns "Hello world!"
Code: Select all
put URL (myServerURL & "aFunction.lc?data=42") into myVar -- returns a permutation of 42
The server is contacted from my LC programs on Desktop or Mobile (maybe even from PHP ...), it's NOT meant as a web server.
So far, so fine. Works like a charm. Let's go further. I want to use a lib that I can call from another .lc script. The lib be "alib.lc" & contain:
Code: Select all
<?lc
function upme what
return upper(what)
end upme
?>
Code: Select all
<?lc
require alib.lc
put upme($_GET["data"])
?>
Code: Select all
put URL (myServerURL & "upperme.lc?data=axwald") into myVar --> AXWALD
Q1.) In "upperme.lc" I use "require alib.lc" to specify the lib where my function resides, but "include alib.lc" works as well. I don't really understand the differences - what should I use?
Thinking about specifying the use case leads to another, related question:
Q1.a) I'll have a lot of functions (string/date/table formatting, db access, crypto etc.). In my projects these usually live in libraries - mainly a "base lib" (pure script size ~100 KB) and a "database lib" (pure script size ~20 KB). For good measure let's throw in 30 KB of yet unknown code, makes 150 KB of library code that needs to be read, loaded, kept in memory, unloaded - for each single call to the server!
Assuming frequent calls from any single instance of my project, and quite a number of such instances running concurrently, doesn't this smell like a classic server strangler? (There's other stuff on the server, too, and I don't mean to get it choking ...)
So, how to distribute these functions in libraries to get best speed & least wasted resources?
To keep 'em in lots of tiny script files, or group 'em thematically as best possible, or just throw all in 1 big "lib chunk"? Guess Apache caching will play a role here, too. Any advises?
Q2.) I read about hashBangs. I don't see a real difference - either using "#! /path/to/livecode" or "<?lc ?>" - to me it looks cosmetic. Is there a penalty using "<?lc ?>"? (Additional call to get this info from .htaccess maybe?)
Having "/path/to/executable" hard coded in every single script file looks rather strange to me, when I can have a single entry in .htaccess - but I admit, I'm not a Linux guy & know these to be fond of quite strange things ;-)
Q3.) Important: Will I find the parameters passed around between the scripts (as the "axwald"/ "AXWALD" in my last example above) somewhere in the logs of a plain vanilla Linux Debian web server?
These may be sensitive data and, even if not leaving the web server, shouldn't be logged in plain text anywhere. Anybody knows?
Thx a lot for any answers! Have fun!