Hi,
I hit the errors described in this thread and others and after a few days of going in circles, got a response back from Panos that pointed me to another thread that had more information and finally a mistake I made that eventually got the problem solved. That "mistake" happened while I was trying to do this "install" on another machine.
I suspect that there were two or three specific problems:
1. providing "755" permission access high enough UP the directory levels that contain the LiveCodeServer.
2. application signature issues that Apple introduced at some point that cause liveCodeServer-968 to not function unless you "re-signature" all executable files in the LiveCodeServer distribution.
3. I forget.
Reiterating some of the information in the lesson, changes you need to make, top to bottom:
In httpd.conf, remove the leading "#" (uncomment) to enable the following directives:
(these are not sequential in the httpd.conf file)
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
There is also a cgid_module line in httpd.conf. In my last round of modifications I did NOT enable that line despite the fact that the Apache documentation suggests that it will run the cgi_module if the cgid_module does not execute. In my past testing, the cgid_module seemed to cause a problem, but it might have been other things wrong.
In the /private/etc/apache2/extra/httpd-userdir.conf, remove the leading "#" (uncomment)
for the following line:
Include /private/etc/apache2/users/*.conf
Now where does the LiveCodeServer-xxxxxx folder go?
Well wherever it goes, you need to make sure that there is executable permission high enough UP the directory chain.
I wanted to make the installation more general, not something living in my User folders.
There appears to be a standard directory for WebServers - at least for Apache on the Mac that is not associated with the logged in User.
/Library/WebServer/CGI-Executables
So for me I put the LiveCodeServer-9_6_8-Mac folder in there.
Followed up with the commands:
sudo chmod 755 /Library/WebServer/CGI-Executables
sudo chmod 755 /Library/WebServer/CGI-Executables/LiveCodeServer-9_6_8-Mac
sudo chmod 755 /Library/WebServer/CGI-Executables/LiveCodeServer-9_6_8-Mac/livecode-server
THE FIRST chmod command is the CRUCIAL, NEVER DONE BEFORE that I did when trying this whole process over again on another machine. You need to be certain that the folder that you put the downloaded LiveCodeServer-9_6_8-Mac folder into has the correct permissions TOO!
The next step is somewhat dependent upon what version of MacOS that you have. It is definitely required for a MacBook Pro M1 or M2 running on macOS 13.
The livecode-server file and the .dylib files accompanying it do not have the appropriate Apple signature to execute. (Hopefully RunRev will fix this ASAP!) So for now, it has to be done after it has been copied into the destination folder you want to execute from. You can either execute these commands individually for each file or try using the script I include below. This set of commands came from LCMark via the "LiveCode Server and M2 processor" thread
(if anybody knows how to generalize this and apply it to the directories - please enhance and let the rest of us know!)
I named the script "sigd" for signature dance. - call it what you want. I put it in the LiveCodeServer-9_6_8-Mac folder.
Code: Select all
#!/bin/zsh
cp $1 $1-copy
codesign -s - -f $1-copy
rm $1
echo "did codesign & remove"
mv $1-copy $1
Caveat: The above shell script is stating it uses z shell - what Apple recommends now. If you are running a different shell in Terminal, maybe the script will work or delete the first line or find out how to specify the shell you are running in Terminal. (it may be as simple as replace zsh for bash in the case of running bash)
Now with "LiveCodeServer-9_6_8-Mac" as the current directory in Terminal...
So now you do:
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
Hah, well that is easier for you all, since I just copied all the commands that I had to type.
Well maybe the above set can be a script too!
Hey RunRev, how about you fix the download so it has a script in it that does the chmod changes and then the signature dance process!
(or if some steps have to be done manually, put those in the script file too (with documentation) so people have one place to find out how to do all this.)
Next step you have to do manually. (stam discovered this nuisance)
Control Click - Open each of the above files and click Open (or NOT cancel if it is not "Open") in the dialog box that comes up. You need to run each of these executables manually once because otherwise the macOS will refuse to run them ever.
OK, now I believe you have an executable livecode-server.
Now for setting up Apache to notice the livecode-server.
From what I have discovered so far, in whatever directory you want to have LiveCode scripts, you need to tell Apache about that via a .conf file.
Two standard folders would be the logged in user and what appears to be an Apache standard:
/Library/WebServer/Documents
For the logged in user, your LiveCode scripts (files with a suffix of .lc) go into a folder named "Sites".
In my case: /Users/andrewtaylor/Sites/
I have a .conf file named: andrewtaylor.conf and it lives in the /private/etc/apache2/Users/ folder.
Below are the contents of that file.
Code: Select all
<Directory "/Users/andrewtaylor/Sites/">
Options Indexes MultiViews
AllowOverride None
Require all granted
AddHandler livecode-script .lc
Action livecode-script /livecode-cgi/livecode-server
</Directory>
Caveat:
IF you are running an Apache PRIOR to 2.4:
then instead of "Require all granted"
use:
Order allow,deny
Allow from all
Now since I want to have the LiveCode Server in a spot where it can be used by any User, I put it at a system level instead of in a folder in my user area.
So I put the following at the end of the httpd.conf file that was modified up above.
Code: Select all
<Directory "/Library/WebServer/CGI-Executables/LiveCodeServer-9_6_8-Mac/">
Options Indexes MultiViews ExecCGI
AllowOverride None
Require all granted
AddHandler livecode-script .lc
Action livecode-script /livecode-cgi/livecode-server
</Directory>
#ScriptAlias /livecode-cgi/ /Users/andrewtaylor/Sites/LiveCodeServer-9_6_8-Mac/
ScriptAlias /livecode-cgi/ /Library/WebServer/CGI-Executables/LiveCodeServer-9_6_8-Mac/
Caveat:
IF you are running an Apache PRIOR to 2.4:
then instead of "Require all granted"
use:
Order allow,deny
Allow from all
IF instead you are going to put LiveCode Server in your User folder somewhere (I had it in "Sites" for a while), then you would add the above code to the end of your "username".conf file. You would also uncomment and modify the ScriptAlias line to point to your user folder. (uncomment means delete the '#').
Then comment out the line with ScriptAlias point to the CGI-Executables folder.(or just delete the line).
SetHandler vs AddHandler?
I came across a website that recommends using SetHandler for security purposes. If you use SetHandler then Apache will only execute files it finds in that directory - it will NOT display. So hackers can't look at your files.
If you use SetHandler livecode-script instead, then .html and .lc files still execute, but the PosterChild HTML5 lesson example will NOT work.
I don't know what other advantages or disadvantages occur as a result of that change.
All done? (almost!)
Be good to test all this.
So you need a .lc file. (here is the one from the lesson - as updated by Panos today)
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>
Call it what you want: "something.lc" and put it in the "Sites" folder.
That is: /Users/username/Sites, where username is your login, in my case: andrewtaylor.
For testing the general installation, .lc files that live in WebServer/Documents, you need one for there too.
Make a copy of the above file, I suggest you give it a different name just so you are sure it ran
When you are putting stuff into the "not your user folder" areas you will need to deal with permissions to write into those areas. Not a big deal if you are your machine's admin.
A couple more things, then you can test!
From the Terminal command line:
sudo apachectl restart
Then double check the configuration by:
apachectl configtest
You should only get one error from the above. It will complain about server's domain name:
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.1.233. Set the 'ServerName' directive globally to suppress this message
This is not a problem - you can ignore it unless you want to be public. In which case search for "ServerName" in the httpd.conf and update per the information in there. The IP address above is my machine at the moment - I move around so it changes - it will be whatever your machine is at the moment you run the command.
NOW YOU CAN TEST!
Go to your browser and type:
http://localhost/~andrewtaylor/sitesScript.lc
or
http://localhost/docscript.lc
In the above replace "andrewtaylor" with your username and "sitesScript" with what you named that test script file.
NOTE THE '~' THAT IS BEFORE THE username! IT IS REQUIRED!
For the second test, I named the script I put into WebServer/Documents, "docscript.lc"
Both should return the following:
Hello World! 1/29/23 8:41 PM
(actually the date and time you run the script)
I had no knowledge of Apache and how to interact with it prior to spending a couple days digging this out from the lesson and various posting from others trying to solve this problem. Hopefully I have documented the entire process properly and completely in one place so others need not go through this yet again!