Setting up a Rev CGI Environment in your Dreamhost Web Space

Are you using LiveCode to create server scripts or CGIs?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
phildavis
Posts: 2
Joined: Sat Apr 08, 2006 6:24 pm
Location: West Linn, Oregon USA

Setting up a Rev CGI Environment in your Dreamhost Web Space

Post by phildavis » Fri Apr 14, 2006 5:24 am

A few months ago I opened a web hosting account at dreamhost.com. You may have seen Dreamhost mentioned on the use-revolution list as a 'preferred host', and they do deliver a lot of bang for the buck. The URL is http://dreamhost.com .

With the help of other Rev users on the use-revolution list, I recently set up a Revolution CGI environment on my dreamhost.com web site. It wasn't hard!

Here's what I did:

Download the Linux version of Revolution to my local computer. My Dreamhost web space is on a Debian Linux server (so says their support people), so I downloaded the Rev Linux install from here:
http://downloads.runrev.com/revolution/ ... /linux.tgz

Decompress and extract the download. The .tgz means it's a 'gz' compressed .tar file. The .tar file was created by 'gluing' all parts of the Revolution installation together into one big 'tarball'; then the .tar file was compressed.

The standard unzip feature in Windows XP doesn't know what to do with a .tgz file, but WinZip does. On Mac OS X, the standard archive tool can handle it.

Upload the essential parts to your web space. I was able to get Rev CGI scripts to work by uploading only the revolution.x86 file. I created a directory in my server space and put this file and all my CGI's in there.

Set permissions. You can do this with most FTP applications - any that has a CHMOD function. Dreamhost supports only FTP connections, so it's a good thing! Traditionally, the permissions for an executable thing (including your CGI scripts) are set to '755'.

You're Done! Now you're ready to create, upload and run Rev CGIs.

toddgeist
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 21
Joined: Sat Apr 15, 2006 9:12 pm

Can't get it to work

Post by toddgeist » Tue Apr 18, 2006 4:47 pm

Hello,

I tried to follow the directions, but I am getting an 500 Internal Server Error.

I placed both the engine and my very simple "hello world" script in a folder called rev. My FTP client (Transmit) reportsd that both are set to 755. My text editor (TextWrangler) reports that the line breaks are Unix.

Here is my script

Code: Select all

#!revolution

on startup
  put "Content-Type: text/plain" & cr & cr
  put "Hello World!"
end startup
IN my Dreamhost Control Panel I have the "Extra Security" box checked, and I have "fast cgi support" checked.

Any ideas why this is not working?

Thanks

Todd

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

Post by FourthWorld » Fri Apr 20, 2007 9:05 pm

FWIW, I just learned something about working with DreamHost servers which may save some of you some time:

Apparently if your file ends in suffixes other than ".cgi", rather than execute it'll just return the file's contents. This is true even when the execute bit is set correctly for the file's permissions.

On other server's I've used the suffix is unimportant, and I commonly use ".mt" as is the old MetaCard convention.

But with DreamHost, your files will work great once you rename them to end with ".cgi".

cyoung_mi
Posts: 4
Joined: Mon Mar 17, 2008 12:31 am

Post by cyoung_mi » Thu May 15, 2008 3:29 am

Now that the new version is out..
the above links no longer work.

Where do we go to download what we need to get CGI's working?

thatkeith
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 346
Joined: Mon Mar 01, 2010 7:13 pm
Location: London, UK
Contact:

Re: Setting up a Rev CGI Environment in your Dreamhost Web Space

Post by thatkeith » Wed Jun 26, 2019 7:42 pm

EDIT: I have found the answer! What I wrote originally (below) is not correct. Read the subsequent posts for the solution.

After trying this for a while and chatting with Dreamhost's support team (who are always helpful) it turns out that running LiveCode Server as CGI is NOT possible in a shared server environment in Dreamhost. Two of the required Apache modules (mod_cgi and mod_alias) are enabled by default, but the third required one (mod_actions) is not, and it can't be enabled in a shared server.

This can be enabled in a DreamCompute instance or in a dedicated server, but not for regular shared-server web space.
Last edited by thatkeith on Fri Jun 28, 2019 4:50 pm, edited 2 times in total.
Technical Writer, Meta
University Lecturer
Technical Editor, MacUser (1996-2015)
360 VR media specialist

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

Re: Setting up a Rev CGI Environment in your Dreamhost Web Space

Post by FourthWorld » Wed Jun 26, 2019 11:15 pm

thatkeith wrote:
Wed Jun 26, 2019 7:42 pm
After trying this for a while and chatting with Dreamhost's support team (who are always helpful) it turns out that running LiveCode Server as CGI is NOT possible in a shared server environment in Dreamhost. Two of the required Apache modules (mod_cgi and mod_alias) are enabled by default, but the third required one (mod_actions) is not, and it can't be enabled in a shared server.
Without mod_actions most useful things one would do with .htaccess cannot happen. Are you certain they've changed their configuration so that module is no longer active?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

thatkeith
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 346
Joined: Mon Mar 01, 2010 7:13 pm
Location: London, UK
Contact:

Re: Setting up a Rev CGI Environment in your Dreamhost Web Space

Post by thatkeith » Wed Jun 26, 2019 11:30 pm

EDIT: I have found the answer! What I wrote originally (below) is not correct. Read the subsequent posts for the solution.

Mod_alias is available but I was in a support chat today and this was what I was told – after he went through a few things to check. Perhaps things that need more than _alias provides have been deemed to fall into higher-end territory than basic shared hosting. The DreamCompute service looks good. But then so does Hostm, and that’s already configured. Hmm.
Last edited by thatkeith on Fri Jun 28, 2019 4:49 pm, edited 1 time in total.
Technical Writer, Meta
University Lecturer
Technical Editor, MacUser (1996-2015)
360 VR media specialist

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

Re: Setting up a Rev CGI Environment in your Dreamhost Web Space

Post by FourthWorld » Thu Jun 27, 2019 12:18 am

If all you need is shared hosting, DreamCompute doesn't seem a good fit.

As for mod_alias, your previous posts already noted it's included. That post specified mod_action as not installed, which is the one I referred to because no custom CGI can be installed without it; indeed a great many other things .htaccess is used for depend on ACTION statements as well.

HostM has a good reputation, no harm in moving. But given how popular Dreamhost is I'm inclined to double-check this on one of my domains there when I get a chance, and see if I can determine when they made that unusual change, and more importantly why they made it.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

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

Re: Setting up a Rev CGI Environment in your Dreamhost Web Space

Post by FourthWorld » Thu Jun 27, 2019 12:26 am

Try this URL:
http://fourthworldlabs.com/t.lc

It uses this LCS script:

Code: Select all

<?lc put "<em>Hello World! It's <em>"& the long time ?>
<br>
version: <?lc  put version() ?>
The .htaccess file making that possible is:

Code: Select all

#Options ExecCGI FollowSymLinks
AddHandler livecode-script .lc
DirectoryIndex index.irev index.lc index.php index.html
Action livecode-script /cgi-bin/lcs9dp5
Given the Action statement there, it would seem there was a misunderstanding with DH Support. LC Server apparently runs as well there as it always has, even on DH's latest system upgrade to Ubuntu 18.04.2 LTS.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

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

Re: Setting up a Rev CGI Environment in your Dreamhost Web Space

Post by FourthWorld » Thu Jun 27, 2019 12:34 am

FWIW I had been using v9.0 DP 5 there (I only use that domain for testing, so I don't keep it current). I just added v9.5.0 DP 1, and changed the .htaccess file to point to the new engine, which is what that URL is now using. Seems to work well with LC's latest and greatest.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

thatkeith
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 346
Joined: Mon Mar 01, 2010 7:13 pm
Location: London, UK
Contact:

Re: Setting up a Rev CGI Environment in your Dreamhost Web Space

Post by thatkeith » Fri Jun 28, 2019 4:47 pm

For a while I was still getting the same old error. In the end, after browsing the htaccess section of askapache.com, I put ".cgi" at the end of the livecode-server name and tweaked the htaccess reference – and it's working! Curious that you don't have to do that, but I am delighted to have found the solution.

To sum up the solution:
I added .cgi to the livecode-server file name, adjusted the Action reference in the .htaccess file, and it worked.

In .htaccess:

Code: Select all

#Options ExecCGI FollowSymLinks
AddHandler livecode-script .lc
# DirectoryIndex index.irev index.lc index.php index.html
Action livecode-script /cgi-bin/livecode-server.cgi
In the cgi-bin directory the LiveCode Server engine is named livecode-server.cgi

The test file is called test.lc and it contains this:

Code: Select all

<?lc put "<em>Hello World! It's <em>"& the long time ?>
<br>
version: <?lc  put version() ?>
<p><?lc put the random of 25 ?>
Many thanks for persuading me to try again!
Technical Writer, Meta
University Lecturer
Technical Editor, MacUser (1996-2015)
360 VR media specialist

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Setting up a Rev CGI Environment in your Dreamhost Web Space

Post by bogs » Fri Jun 28, 2019 4:50 pm

Congrats on finding a solution. I remember doing something similar back in the old days of hosting setups with a css file, when they weren't allowed on the host. I renamed it to .text, and that was acceptable to the rules they had setup. Goofy stuff.

You can also see an example of it on these bulletin boards, to some degree.
Image

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

Re: Setting up a Rev CGI Environment in your Dreamhost Web Space

Post by FourthWorld » Fri Jun 28, 2019 7:41 pm

thatkeith wrote:
Fri Jun 28, 2019 4:47 pm
For a while I was still getting the same old error. In the end, after browsing the htaccess section of askapache.com, I put ".cgi" at the end of the livecode-server name and tweaked the htaccess reference – and it's working! Curious that you don't have to do that, but I am delighted to have found the solution.

To sum up the solution:
I added .cgi to the livecode-server file name, adjusted the Action reference in the .htaccess file, and it worked.
Glad you got that going.

The .cgi thing may be default permissions for files with that extension. With my .lc setup on DH I did have to set permissions correctly, esp. executable and turning off writability, but I do that with scripts as a matter of habit anyway.

So now we know there are at least two ways to use LC Server successfully on Dreamhost. They're a fine company and a long-time sponsor of the SoCal Linux Expo, so I'm very pleased to continue using them.

And we've also learned why I haven't written an installer script for LC Server: this is what I referred to in an earlier post, about differences in shared hosting configurations. Hosting companies vary in config specifics according to the judgment of their CTO. So while writing an installer script for a bare straight-install Ubuntu distro on a VPS or dedicated server would be reasonably straightforward, accommodating shared hosting would mean a much longer script with a lot of host-specific branching.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

scottsen11
Posts: 1
Joined: Sat Jun 29, 2019 6:55 pm

Re: Setting up a Rev CGI Environment in your Dreamhost Web Space

Post by scottsen11 » Sat Jun 29, 2019 6:58 pm

When I add this code and restart my server all of my sites quit working. I obviously don't have it configured right and I don't know enough about fast-cgi to know what I'm doing wrong.

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

Re: Setting up a Rev CGI Environment in your Dreamhost Web Space

Post by FourthWorld » Sat Jun 29, 2019 9:10 pm

If you're using FastCGI, don't. It's not well suited for single-threaded engines like LC, and is far more work to support.

If you're having issues with straight CGI, please note the error code returned from the server. Better, also check the last couple lines of your Apache error log.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply

Return to “CGIs and the Server”