How do i install Livecode Server on Windows with Apache

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.

This lesson will walk you through the steps required to install LiveCode Server on Windows with Apache.

If you have Apache already installed, make sure that you have  access to your system's Apache configuration files.  If you do not access, then see the the lesson "How to install LiveCode Server with Apache via .htaccess?"

The steps in this lesson were successfully tested on Windows 10, Windows 11 and Windows Server 2019 with Livecode Server 9.6.8, 9.6.9 RC-1" and Apache 2.4.

1. Download and install the needed software

1.1. Notepad++ Editor (free)

Download the free Notepad++ Editor.  https://notepad-plus-plus.org/downloads/

This is not required, but recommended if you only have Notepad from Microsoft installed. Please do not use Microsoft Notepad for editing tasks in this lesson.

 

1.2. Apache 2.4

Download Apache 2.4. For this lesson we used the following download https://www.apachelounge.com/download/VS17/binaries/httpd-2.4.56-win64-VS17.zip

Extract the zip file and copy the folder Apache24 to the root folder c:\

 

Note:

By default, Apache comes with all the required modules enabled.  If you are using a custom install of Apache, you will need to ensure that the following three modules are enabled:

 Apache can also be installed as part of a WAMP package (https://www.wampserver.com/en/download-wampserver-64bits/) or as part of a XAMPP package  (https://www.apachefriends.org/de/download.html) and also as a Mamp package (https://www.mamp.info/de/downloads/). All those packages include Apache,MySQL and PHP.

But his lesson here uses an official Apache download.

 

1.3. Livecode Server

Download Livecode Server 9.6.11 for Windows 64-bit from your Livecode Account, extract it and copy the files and folder to c:\Apache24\cgi-bin

That folder should already contain one file called printenv.pl.  You can leave that file in that folder. If you want you can delete the file LivecodeNotes-9_6_11-Server.pdf. In this lesson I kept it in the folder.

 

2. Configuration of the Apache server

2.1. Allow execution of CGIs

1. Make a backup copy of the file c:\Apache24\conf\httpd.conf

2. Open the file c:\Apache24\conf\httpd.conf in NotePad++ or any other text editor.

3. Search  for <Directory "${SRVROOT}/htdocs">

4.  Some lines below you find a line Options Indexes FollowSymLinks. Replace that line with Options ExecCGI Indexes FollowSymLinks

 

Press CTLR-S or click on the little Floppydisk icon in the menubar to save the current changes

 

2.2. Add a handler and action for Livecode Server scripts

About 13 lines below you should see </Directory> which closes the  section.

Add the following lines after that closing line </Directory>

AddHandler livecode-script .lc
Action livecode-script /cgi-bin/livecode-server
ScriptAlias /cgi-bin/livecode-server c:/apache24/cgi-bin/livecode-server.exe

Press CTLR-S or click on the little Floppydisk icon in the menubar to save the current changes

2.3. Add index.lc to the Directory Index

Search for <IfModule dir_module> and replace the next line DirectoryIndex index.html with DirectoryIndex index.lc index.html

This will tell Apache that it should open index.lc by default if both index.html and index.lc files are found. If no index.lc file is found in the directory, then Apache will use index.html as default. The order of the filenames specify the priority.

Press CTLR-S or click on the little Floppydisk icon in the menubar to save the current changes

2.4. Change the port on which Apache listens

If you want Apache to listen on an other port, for example, because you have also Microsofts Internet Information Server running on Port 80,  then search for Listen 80 and change the value 80 for example to 81. This will tell Apache to listen on port 81 instead of 80

Press CTLR-S or click on the little Floppydisk icon in the menubar to save the current changes

3. Starting Apache

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.

This lesson will walk you through the steps required to install LiveCode Server on Windows with Apache.

This lessons assumes you have access to your system's Apache configuration files.  If you do not, see the the lesson "How to install LiveCode Server with Apache via .htaccess?"

3.1. Start Apache manually

Manually

Open the folder c:\Apache24\bin and double click the file httpd.exe to start the Apache server. You will see an almost empty black window opening. This shows that the Apache server is started. If you just see that window for some seconds  and then it closes again, this shows us, that something is wrong with our modifcated configuration file c:\Apache24\conf\httpd.conf

In this case please check your previous modifications and try to correct any errors or restore the configuration file from the backup file you've created and restart from start.

To close Apache, just close the black Window.

3.2. Start Apache automatically

Automatically

You can install Apache as a Windows service. This way the Apache server will start automatically when Windows starts up.

Open the command prompt  (cmd.exe) as Administrator and type:

c:\Apache24\bin\httpd.exe -k install

If you see the message

The 'Apache2.4' service is successfully installed.

then Apache was successfully installed as service. But it was not yet started.

To start Apache just type services.msc in the  command prompt. This will open the Windows Service Manager. Select Apache2.4 from the list of services and start that service.

or just restart Windows.

There is also a little taskbar tool c:\Apache24\bin\ApacheMonitor.exe that allows to start, restart and stop the installed Apache service.

 

4. Testing the installation

1. Create a file index.lc with Notepad++ or any other text editor in c:\Apache24\htdocs\  and add some Livecode Server script code. e.g

<?lc
put "Hello World!"
?>

2. Open your browser and enter http://localhost/index.lc or http://localhost:81/index.lc in case to changed the listening port to 81. If you also have added index.lc to the DirectoryIndex you could even just open the file with http://localhost or http://localhost:81.

Please keep in mind  Apache server needs to be restarted to detect any changes made to the httpd.conf file.

 

 

0 Comments

Add your comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.