LiveCode LessonsHow To - LiveCode Server Tasks Installing LiveCode ServerHow do I install LiveCode Server with Apache via .htaccess?

How do I install LiveCode Server with Apache via .htaccess?

The LiveCode Server product brings our english like language to the server environment. The server engine is a separate build of the LiveCode engine with specific syntax and functionality that makes it suitable for use in command-line contexts and, in particular, as a CGI processor.

If you are trying to set up LiveCode Server on a shared server, it will often be the case that you do not have access to the server's Apache config file.  In this situation, you can configure LiveCode Server using a .htaccess file.  This lesson will walk you through the steps required to install LiveCode Server with Apache using .htaccess files.

Prerequisites

Before starting, read the lesson "How do I install LiveCode Server".

Apache is the most most popular web server package available today.  Installing Apache will allow your machine to function as a web server, hosting websites and serving web pages.  If you do not have Apache set up on your systems already, you will need to download and install the latest version.  Apache installers for Apache can be found here: http://httpd.apache.org/download.cgi#apache22.

If you are trying to set up LiveCode Server on a shared server, it will often be the case that you do not have access to the server's Apache config file.  In this situation, you can configure LiveCode Server using a .htaccess file.  In order to use this method, your Apache installation will need to have .htaccess file enabled (http://httpd.apache.org/docs/current/howto/htaccess.html).

Additionally, you will need to ensure that the following three Apache modules are enabled:

  • mod_cgi
  • mod_actions
  • mod_alias

These modules are usually enabled.  If not, contact your service provider or server administrator to see if they will set them up for you.

Using .htaccess file is not the recommended method of configuration.  If you have access to your server's Apache configuration files, you should follow the steps in the lesson appropriate for your platform:

 

Download LiveCode Server

Begin by downloading the LiveCode server zip file using the instructions detailed in the lesson "How do I install LiveCode Server".   Unzip the package and upload it to your "cgi-bin" folder.

Create your .htaccess file

In your "public_html" folder create a file name ".htaccess" with the following content:

Options ExecCGI

AddHandler livecode-script .lc

Action livecode-script /cgi-bin/livecode-server

This file will tell Apache to map files with a .lc extension to livecode-script files, which should then get executed by the LiveCode Server CGI.

Creat e& view a web page

Creat e& view a web page

You are now ready to test your set up.  To do this, create a file named "test.lc" in your "public_html" folder on your server.  To access the test script, navigate to http://<your host>/test.lc using your browser.  The above image shows the expected output if "test.lc" contains the following script:

<html>

<head>

  <title>My LiveCode Server Test Page</title>

</head>

<body>

  <h1>My LiveCode Server Test Page</h1>

<?lc

  put "<p>Hello World! from LiveCode Server</p>"

  put "<p>The date is" && the date & "</p>"

?>

</body>

</html>

For more detailed information on installing LiveCode server, see the server release notes distributed with the server package.

0 Comments

Add your comment

E-Mail me when someone replies to this comment