LC server install on a shared host without root

Are you using LiveCode to create server scripts or CGIs?

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
AxWald
Posts: 421
Joined: Thu Mar 06, 2014 2:57 pm

LC server install on a shared host without root

Post by AxWald » Sun May 10, 2020 1:27 pm

Hi all,

I finally did it - after untold frustrating attempts I finally got my first:
Hello World! 12:01 PM
from an LC server. My problem was that I'm on a shared server (allinkl.com), and have no access to the apache configuration & only limited access to the file system, so most of the advises given regarding the installation don't match.

For the benefit of other members of our community I decided to document what I've done, step by step. I'm using "Filezilla" as my FTP program, and "Putty" for SSL (You don't really need SSL, but it makes things easier). I assume that both are installed & configured to access our server.
  1. At first, we determine the type of server we're running on, using Putty:

    Code: Select all

    x$ 	uname -srm
    	Linux 4.4.0-177-generic x86_64
    
    This confirms my suspicion that we're on a 64bit Linux. So we need a Linux 64-bit LC server. (Guess any provider worth its salt will run x86-64 by now ... And "x$" is the long, cryptic linux start of the command line, shortened.)
    .
  2. Second, we grab our server from here.
    Careful, the "last stable" 9.5.1-64 threw "Segmentation faults" reliably, whereas the 8.1-64 runs flawlessly.
    .
  3. Now we use Filezilla to create a directory "cgi-bin" in the base directory of the desired domain: "/" shows all of our webspace, "/domain.com" is where our domain specific data lives.
    So what we create is "/domain.com/cgi-bin", and we change the access to "755".
    .
  4. Assuming we have SSH, we copy the downloaded, zipped LC server file via FileZilla into our "cgi-bin" & run "unzip [servername.zip]" via Putty. This assures we get unaltered files.
    If we don't have SSH, we unzip the server locally & make sure to transfer it in "binary mode". And hope it works ...
    .
  5. We need to "chmod" (change acces privileges) our server application now to "755" via Filezilla or SSH, and we may rename it - I use "lcserver" for easy access. What we have now should look like this (I've renamed some things ...):
    ftp.png
    Filezilla sees our web space like this
    You'll see a file "test.lc" in cgi-bin that is explained below, and 2 zipped server installations - those we can delete.
    .
  6. To test our server we need a simple command file, a very basic one is:

    Code: Select all

    <?lc
    put "Hello World!" && the time
    ?>
    Put this one into your cgi-bin as "test.lc", and make sure you have unix line endings (LF only)!
    .
  7. If we have SSH, we can test it now:

    Code: Select all

    x$ 			cd domain.com/cgi-bin
    x/domain.com/cgi-bin$ 	./lcserver ./test.lc
    			Hello World! 1:34 PM
    wOOt! :)
    .
  8. If not, or if we want to call it as CGI (means using it via POST/ our web browser), we need some lines in the .htaccess file of our domain ("/domain.com/.htaccess"). If not (it exists), create it. If it exists, add these lines:

    Code: Select all

    Options +ExecCGI
    AddHandler livecode-script .lc
    Action livecode-script /cgi-bin/lcserver
    
    (Big "THANK YOU!" to Thierry!)
    If there are already lines like this, you may want to ask someone that's better in web server things than me ...
    Again, make sure you have unix line endings (LF only)!
    .
  9. Last test: We go to our domain in the browser: ("https://domain.com/cgi-bin/test.lc") and get:
    Hello World! 1:51 PM
    Bingo! Done.
Now we have a LC server running that we can call via command line (to do server tasks) or that we can use to provide data to us, via CGI. Be aware, this is just the beginning, now our real work starts:
  • Making sure the installation is safe & will not get captured easily.
  • Finding out which LC server version to use actually - which one is fastest & least buggy?
  • Writing tons of .lc scripts to actually work with it :)
I hope this will help some poor soul (it took me a long time & countless tries to come this far), and that someone will correct my mistakes that I've made unavoidably. I'm especially interested in advice regarding security, and the best suited server version. (Nobody ever tried to compile 6.7.10 for Linux 64-bit?)

Have fun!
Livecode programming until the cat hits the fan ...

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 899
Joined: Fri Aug 15, 2008 7:15 am

Re: LC server install on a shared host without root

Post by bangkok » Sun May 10, 2020 2:39 pm

allinkl.com costs 4,95 euros per month, right ?

No need to increase your blood pressure.

Have a look at :
https://www.hostm.com

3,95 USD per month.

And... LC Server... in standard. Pre-installed.

Works like a charm. Nothing to do. :)

AxWald
Posts: 421
Joined: Thu Mar 06, 2014 2:57 pm

Re: LC server install on a shared host without root

Post by AxWald » Sun May 10, 2020 3:11 pm

Hi,

well, it's not my server - it's one of my customers.
And we'll stay with allInkl - these are production systems, and a lot of ppl are depending on it to earn their bread. This provider so far has proven as:
  • Highly reliable (nearly 100% uptime during the recent years)
  • Very quick support response times, 24/7/365
  • Quick & competent help when required
  • Able to fulfill the legal requirements for businesses (data center location, ADV, DSGVO ...)
You don't change such easily. A few bucks/ month doesn't make this much of a difference.

And, after all it wasn't this complicated, right? Better documentation could have helped a lot - therefore I wrote my sermon above :)

Have fun!

Disclaimer: I'm only customer at AllInkl, don't even have affiliate. And I know next to nothing about hostM.
Livecode programming until the cat hits the fan ...

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7668
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: LC server install on a shared host without root

Post by FourthWorld » Sun May 10, 2020 5:16 pm

Thanks for posting that, AxWald.

The steps you outlined are hopefully similar to the ones posted here - if you find anything here that doesn't work on your shared host please consider filling an enhancement request for that documentation so it can be used for more server configurations:
http://lessons.livecode.com/m/4070/l/36 ... a-htaccess

HostM seems a good service, but to be soberly candid, if installing any program to run as a CGI under Apache is prohibitively difficult, that may be an indicator that the user has not yet acquired the background on how Apache works to be able to use it safely and effectively.

I can appreciate the desire for just-get-it-done, but server work takes on a level of responsibility far greater than making apps for local use only. It's not just that user data must be protected, but even the server's resources too.

When we apply how-tos without also acquiring an understanding of the underlying "why" behind those steps, we not only limit our own abilities when we encounter a slightly different server set-up, but we also miss out on knowing how Apache works, knowledge that pays for its acquisition cost many times over as we move forward with client-server apps over the years ahead.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

Post Reply

Return to “CGIs and the Server”