FINAL: Setting up LiveCode Server on MacOS (9.6.9/Ventura)
NOTES
Web directory is /Library/WebServer/Documents/
cgi-bin folder is /Library/WebServer/CGI-Executables/
User web directory is /Users/<username>/Sites/
Apache configuration files are in /private/etc/apache2/
BBEdit is the easiest tool to edit configuration files
Outline of installation
Download and copy server files to cgi-bin folder
Set permissions and codesign all server files/executable
Edit 3 apache configuration files
Restart apache & test
SERVER FILES
Download zip file with server files - put the contents of the unzipped folder (current version is LiveCodeServerPro-9_6_9-Mac) into the cgi-bin folder Library/WebServer/CGI-Executables.
Set permissions
The server executable and it’s containing folder need to be made executable by all:
Code: Select all
sudo chmod 755 /Library/WebServer/CGI-Executables
sudo chmod 755 /Library/WebServer/CGI-Executables/livecode-server-pro
Codesign server files
Create a text file to shell script (in this example named ’sigd’ — no extension) with the text below - script provided on the forums by
@aetaylorBUSBnWt to simplify this task that
@LCMark explained was necessary to codesign all server files on more modern MacOS versions.
Code: Select all
#!/bin/zsh
cp $1 $1-copy
codesign -s - -f $1-copy
rm $1
echo "did codesign & remove"
mv $1-copy $1
Save it to /Library/WebServer/CGI-Executables/ and cd there in the terminal. Run this shell script on all server files:
Code: Select all
./sigd livecode-server
./sigd revpdfprinter.dylib
./sigd drivers/dbmysql.dylib
./sigd drivers/dbodbc.dylib
./sigd drivers/dbpostgresql.dylib
./sigd drivers/dbsqlite.dylib
./sigd externals/mergJSON.dylib
./sigd externals/mergMarkdown.dylib
./sigd externals/revdb.dylib
./sigd externals/revxml.dylib
./sigd externals/revzip.dylib
Gatekeeper
right-click and ‘open’ the server executable and *all* .dylib files to whitelist them in gatekeeper
APACHE CONFIG FILES
These are:
/private/etc/apache2/httpd.conf
/private/etc/apache2/extra/httpd-userdir.conf
/private/etc/apache2/users/<username>.conf
** If unable to save changes to these files then assign read/write permissions to yourself (eg via Finder -> Get info). Using BBEdit you'll be asked to authenticate to save changes.
httpd.conf
Summary: Uncomment 5 lines, Change 1 line, Add 3 lines
Uncomment (remove the ‘#’) the following lines:
Code: Select all
LoadModule cgi_module libexec/apache2/mod_cgi.so
LoadModule actions_module libexec/apache2/mod_actions.so
LoadModule userdir_module libexec/apache2/mod_userdir.so
LoadModule alias_module libexec/apache2/mod_alias.so
Include /private/etc/apache2/extra/httpd-userdir.conf
Edit section <IfModule mime_module>. This is the main change from previous tutorials/guides/lessons, but was valid for installing Community version of livecode-server in 2016 on MacOS El Capitan, so probably valid for most/all MacOS configurations.
Source:
https://www.linkedin.com/pulse/livecode ... ark-clark/
If you have these lines any in
any other location,
delete them or the installation won't work.
Below the line
#AddHandler cgi-script .cgi add the optional comment and 2 lines of code:
Code: Select all
# LIVECODE CONFIG
AddHandler livecode-script .lc
Action livecode-script /cgi-bin/livecode-server-pro
Edit section for CGI directory declaration by
changing Options from
None to
Indexes MultiViews ExecCGI, and
add a ScriptAlias line below this declaration
Code: Select all
# "/Library/WebServer/CGI-Executables" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/Library/WebServer/CGI-Executables">
Options Indexes MultiViews ExecCGI
AllowOverride None
Require all granted
</Directory>
ScriptAlias /livecode-cgi/ /Library/WebServer/CGI-Executables/
OPTIONAL: To remove the warning generated by the terminal command apachectl configtest, uncomment the
Servername directive and change it to
httpd-userdir.conf
Uncomment the line
Code: Select all
Include /private/etc/apache2/users/*.conf
<username>.conf
Set the text of this file to the below (where <username> is the short account name)
Code: Select all
<Directory "/Users/<username>/Sites/">
Options Indexes MultiViews
AllowOverride None
Require all granted
AddHandler livecode-script .lc
Action livecode-script /livecode-cgi/livecode-server
</Directory>
Make everything in the user directory executable by the special user _www, as per advice on a •User tip• on the Apple forums, by running this in terminal, but unsure if this is actually needed (I did however do this in my long attempt to get this working):
Source:
https://discussions.apple.com/docs/DOC- ... login=true
RESTART AND TEST
Test file
Create a text file with the suffix .lc, eg test.lc with the following text and save to /Library/WebServer/Documents and /Users/<username>/Sites
Code: Select all
<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>
Restart apache
In the terminal, restart apache and check it’s configuration
Code: Select all
sudo apachectl restart
apache configtest
Assuming syntax is OK then check installation by opening the files in a browser:
http://localhost/test.lc — for the /Library/WebServer/Documents/test.lc file
http://localhost/~<username>/test.lc — for the /Users/<username>/Sites/test.lc file
If all goes well, you should see a page stating:
Code: Select all
My LiveCode Server Test Page
Hello World! from LiveCode Server
The date is 5/3/23
I hope this helps!
Stam