Setting up a Rev CGI Environment in your Dreamhost Web Space
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Setting up a Rev CGI Environment in your Dreamhost Web Space
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.
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.
Can't get it to work
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
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
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
Any ideas why this is not working?
Thanks
Todd
-
- VIP Livecode Opensource Backer
- Posts: 9857
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
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".
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".
-
- 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
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.
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
University Lecturer
Technical Editor, MacUser (1996-2015)
360 VR media specialist
-
- VIP Livecode Opensource Backer
- Posts: 9857
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Setting up a Rev CGI Environment in your Dreamhost Web Space
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?thatkeith wrote: ↑Wed Jun 26, 2019 7:42 pmAfter 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.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- 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
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.
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
University Lecturer
Technical Editor, MacUser (1996-2015)
360 VR media specialist
-
- VIP Livecode Opensource Backer
- Posts: 9857
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Setting up a Rev CGI Environment in your Dreamhost Web Space
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.
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
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- VIP Livecode Opensource Backer
- Posts: 9857
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Setting up a Rev CGI Environment in your Dreamhost Web Space
Try this URL:
http://fourthworldlabs.com/t.lc
It uses this LCS script:
The .htaccess file making that possible is:
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.
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() ?>
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
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- VIP Livecode Opensource Backer
- Posts: 9857
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Setting up a Rev CGI Environment in your Dreamhost Web Space
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
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- 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
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:
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:
Many thanks for persuading me to try again!
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
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 ?>
Technical Writer, Meta
University Lecturer
Technical Editor, MacUser (1996-2015)
360 VR media specialist
University Lecturer
Technical Editor, MacUser (1996-2015)
360 VR media specialist
Re: Setting up a Rev CGI Environment in your Dreamhost Web Space
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.
You can also see an example of it on these bulletin boards, to some degree.
-
- VIP Livecode Opensource Backer
- Posts: 9857
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Setting up a Rev CGI Environment in your Dreamhost Web Space
Glad you got that going.thatkeith wrote: ↑Fri Jun 28, 2019 4:47 pmFor 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.
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
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- Posts: 1
- Joined: Sat Jun 29, 2019 6:55 pm
Re: Setting up a Rev CGI Environment in your Dreamhost Web Space
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.
-
- VIP Livecode Opensource Backer
- Posts: 9857
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Setting up a Rev CGI Environment in your Dreamhost Web Space
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.
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
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn