If may use LiveCode to create web pages as a webserver. This guide will get you started. The guide explains how to install LiveCode Server on Mac, Windows and Linux servers, create a “Hello World” example, handle user input using Post and Get and debug your scripts.

Introduction Edit

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.

The principal difference between the server engine and desktop/mobile engines is that it is able to process scripts from text files. There scripts consist of content to output directly interspersed with LiveCode segments. As a result you can now mix LiveCode script with HTML, CSS and Javascript to build webpages in much the same way as you would with other web scripting languages:

< html>
< head></head>
 < body>
    put "< H1>hello world</H1>"

Notice that the LiveCode script is contained within special tags. Code within these tags is executed as the page loads allowing you to dynamically generate webpage content. The example above outputs the title “hello world”. The following tags are recognized by LiveCode Server:

<?lc ... LiveCode script ... ?>
<?livecode ... LiveCode script ... ?>
<?rev ... LiveCode script ... ?>

File Extensions Edit

As with PHP and other scripting languages HTML/CSS/Javascript/LiveCode scripts are saved as files with a particular file extension. By default, the installation instructions below show you how to configure the server to recognise the .lc file extensions as containing LiveCode script to execute:


You can configure your server to accept the file extension(s) of your choice.

Installation Edit

LiveCode Server can be installed on Mac, Windows and Linux servers.

For each supported platform, LiveCode Server is distributed as a single .zip file containing the server engine, drivers and externals as well as release notes. The engine can be run in two separate modes, command line mode or CGI mode. To run the engine in command line mode, unzip the appropriate archive for your platform, then execute the livecode-server binary (e.g. livecode-server.exe on Windows) from the command line, passing the initial script as the first argument. For example:


To run the engine in CGI mode, the engine needs to be integrated with the web server software running on your machine. There are various web server packages available, most of which should be compatible with LiveCode Server. In the lessons below we describe how to setup for the most popular package, Apache. Here some guides:

Getting Started Edit

Hello World Example Edit

The most basic example using LiveCode Server is to display the text “Hello World” on the screen. To do this create a new file in any text or script editor and add the following line of script:

<?lc put "< i>Hello World!</i>" ?>

Save the file as:

Upload the file to your newly configured server and navigate to the file:

The result: Hello World!

To see the hello world example in action along with other practical uses of LiveCode on the server go to samples page

Using Stacks Edit

The LiveCode Server engine supports loading stacks in a similar manner to that of the desktop engines. Stacks provide the programmer with an additional means to store data and manage code, allowing for improved scope and function name management.

Note: Visual and graphical commands are not supported (e.g. export snapshot).

For a detailed guide on using stacks with LiveCode Server, take a look at lesson:

Using Post / Get Edit

There are two main ways of handling user input when developing for the web:


Web forms are a common way to get user input. They take the user’s entries and pass the data to your scripts using a method called POST. For a detailed step by step guide of how to set up a form and process the POST data with LiveCode script, take a look at lesson You can also try out a practical example here:


You can also pass data to your scripts via the page URL and the ‘query string‘. Take the following URL as a example: The part of the URL in bold, everything after the question mark, is known as the ‘query string’. The GET method provides a way to access that information. For a guide and example on how to use this in LiveCode take a look at this lesson: You can also try out a practical example here:

Using Include / Require Edit

LiveCode Server provides include and require commands as a way of linking scripts together. This is useful if you want to create libraries which are then used by a variety of other website pages. For example a database library script:

To include the libary:

<?lc require "" ?>

The example below shows the inclusion of the LiveCode database library and the use of two commands contained within it:

 require ""
   put databaseShowData()
  • include: Includes the given script each time it is called.
  • require: Only includes the given script if it has not already been included or required.

For more information and a detailed example of these two commands in use see the lesson:

Debugging / Errors Edit

When developing on the server it is vital that you receive as much information on script errors as possible. You to tell LiveCode Server to output error messages in a variety of different ways.

The error mode specifies the action the engine takes when an error occurs. The errorMode property can be set dynamically to one of 4 types:

  • inline – Indicates that errors should be output to the browser.
  • stderr – Specifies that the error should be written out to stderr.
  • quiet – Indicates that nothing is output anywhere when an error occurs.
  • debugger – For information only and indicates that the script is being run in ‘remote debug’ mode. This is only relevant to the on-rev engine.

For an example of how to use this see the lesson:

Uploading filesEdit

See uploading files on livecode web server

Additional Tutorials and Examples Edit

Community content is available under CC-BY-SA unless otherwise noted.