Installing Server on the MAMP

Are you using LiveCode to create server scripts or CGIs?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Simon Knight
Posts: 854
Joined: Wed Nov 04, 2009 11:41 am
Location: Gunthorpe, North Lincs, UK

Installing Server on the MAMP

Post by Simon Knight » Thu Apr 05, 2012 5:59 pm

I have just managed to get LC-server installed on the MAMP. The MAMP being Mac Apache MySQL Php or a local server to use to develop web sites on your computer.

I have written a screensteps document that describes the process including getting a reluctant MySQL to start.

I think the same basic instructions will work on Windows under the WAMP.
Attachments
Install Livecode Sever on MAMP under Mac OS 10.6.pdf.zip
Its a zip of a PDF as this forum does not allow PDFs
(236.68 KiB) Downloaded 558 times
best wishes
Skids

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Installing Server on the MAMP

Post by Klaus » Thu Apr 05, 2012 6:04 pm

Hi Simon,

cool, thanks for sharing!


Best

Klaus

Simon Knight
Posts: 854
Joined: Wed Nov 04, 2009 11:41 am
Location: Gunthorpe, North Lincs, UK

Re: Installing Server on the MAMP

Post by Simon Knight » Fri Apr 06, 2012 11:39 am

Hi,

I keep modifying my document as I learn more, I have also just created a "Clarify" account. I hope that the following link will take you to the latest version of the instructions : http://smk.clarify-it.com/d/rty2lw

best wishes
Simon
best wishes
Skids

kavemaniac
Posts: 4
Joined: Sat Nov 10, 2012 1:01 am

Re: Installing Server on the MAMP

Post by kavemaniac » Sat Nov 10, 2012 2:42 pm

Hello,

I am creating a development machine with an iMac running the latest OS X 10.8. I also have MAMP Pro and have done everything that I can think of to get LiveCodeServer to work, but to no avail. I followed the directions in the PDF that comes with the server. I've followed the directions in Simon's living document. Thanks, Simon. But I still cannot discern where the problem is. The apache log files do not indicate any kind of issue.

Could it be the combination or the components of Mountain Lion or MAMP Pro instead of an older version of OS X and MAMP?

Am confused also with the changing filename suffixes. The PDF talks about .lc, .rev or .livecode. Does the <? markup inside the file have to be the same? Can I have <?rev ?> inside a .lc file? I can name the file index.crapola and it performs the same when called explicitly. The code inside the LiveCode markup does nothing.

I have an OnRev server that .irev used to work. Does not seem to do that any more. I change it to .rev and it still does not work. I change it to .php and at least it displays the html parts.

Kevin

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Installing Server on the MAMP

Post by sturgis » Sat Nov 10, 2012 5:18 pm

Just tried it here. Downloaded mamp, installed it, i'm ignoring mamp pro and editing files by hand.

I know you've already got it installed but i'm going to go through all the steps I took to get there.

1) install mamp (drag the folder to applications
2) open terminal
3) copy livecode-server and its 2 folders (externals and drivers) to /Applications/MAMP/cgi-bin (and changed to cgi-bin)
4) check permissions and ownership of livecode-server I have mine set with me as owner, admin as group. permissions are 755 (chmod 755 livecode-server)
5) I have the 2 folders and their contents also owned by me and admin. Permissions are 755 though I suspect 744 would work ok too. (read, write, exe by me, readable only by group and everyone)
6) switch to the conf directory /Applications/MAMP/conf/apache
7) edit httpd.conf with whatever editor you wish, I use vi but anything that doesn't hork the line endings should be fine
8) search for AddHandler and locate the line that looks like #AddHandler cgi-script .cgi
9) add a line after the #addhandler that looks as follows: AddHandler lc-script .lc .rev .irev
10) add another line right after that looks as follows: Action lc-script /cgi-bin/livecode-server
11) Locate the line that says <Directory />
12) there should be a line in that section for Options. Change it to add ExecCGI as an option so that it looks like this: Options Indexes FollowSymLinks ExecCGI

If MAMP is running, shut it down, and restart.

Place a file in your /Applications/MAMP/htdocs folder named something like test.lc (or .rev or .irev since we added those extentions to the addhandler line)
In the file, something simple to test would be cool.
Something like:

Code: Select all

<?lc 
put random(1000) & fred
?>
One other thing. MAMP seems to be set to port 8888 by default so if you prefer to use the default port 80 you would need to locate the "listen" line in httpd.conf file and change it there. (if you're on lion server there could be some conflict, but if you're using lion server you probably want to use the built in stuff)



Then, hit http://localhost:8888/test.lc and see if it works. (or http://localhost/test.lc if you changed to port 80)

IF this doesn't work, you'll want to check logs and see if there are any clues there.

kavemaniac
Posts: 4
Joined: Sat Nov 10, 2012 1:01 am

Re: Installing Server on the MAMP

Post by kavemaniac » Sun Nov 11, 2012 5:29 pm

Interesting the slight changes from the previous instructions. Am having same results, however. Have dispensed with MAMP Pro for now and am just utilizing MAMP. I am getting no entries in error_log file for what follows.

Code (file=index.lc):

Code: Select all

<html><head><title>Test</title></head>
<body>

Hello.<br>
<?lc 
put "<center>This should be seen.</center>" 
?>

</body>
</html>
Results:
Hello.
This should be seen." ?>

If I do a show source I am shown the code as above. If I remove the <center> tags the result is merely the 'Hello.' line. So that would indicate to me that something is happening somewhere in there, just not the right stuff.

Am interested in the distinction between Linux and OS X LiveCode Server. Does it make a difference when installing the OS X version of it whether you're installing it for the OS X installed Apache versus the MAMP version of Apache?

Is there a command line call that I can make in terminal to determine that LiveCode Server is actually working? Is there an error_log file somewhere for LiveCode Server?

Thank you very much for your help on this.

Kevin

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Installing Server on the MAMP

Post by sturgis » Sun Nov 11, 2012 7:22 pm

Interestingly enough, I copied and pasted your sample into my own test.lc file and it works fine.
The only difference between lc server for linux vs the version for osx is that they were built for each os. The underlying functionality is identical.

If you wish to test your copy to make sure it is working you can do something simple. Place a copy of your index.lc file in cgi-bin next to the livecode-server executable. Then switch to the cgi-bin directory (the one in MAMP) and execute the following line.

./livecode-server index.lc

It should output (line breaks may differ)
<html><head><title>Test</title></head>
<body>

Hello.<br>
<center>This should be seen.</center>
</body>
</html>
IF not you will probably see some type of error that might give a clue. Since it is merely a unix type command line executable it should run fine from a terminal shell and take a filename as input.

Also, while i'm sure this is not the case, you are hitting http://localhost not just hitting the file itself directly right?


As for osx installed apache, and MAMP apache, the only real difference is that the setup files are in different locations. In fact on my system they are in SEVERAL locations.
/etc/httpd
since I have MAMP now, /Applications/MAMP/conf/apache
also one in /Applications/MAMP PRO..../MAMP PRO.app/Contesnts/Resources/
/Library/Server/Migrated/private/etc/apache2/httpd.conf
/Library/Server/Migrated/private/etc/apache2/original/httpd.conf
/Library/Server/Web/Config/Apache2 -- this is the one used for mountain lion server
/private/etc/apache2/httpd.conf
/private/etc/apache2/original/httpd.conf

Now, some of those are links to each other, but for lion server I used the files on /Library/Server/Web/Config/Apache2 . And the file in question for lion server is NOT httpd.conf. (things are set up different) For MAMP I used /Applications/MAMP/conf/apache/httpd.conf
I don't know anything about MAMP pro, its possible that something done with it has overridden the location the conf is read from. If thats the case you might look at the one in the app package as well as read up on mamp pro. I was going to test with the mamp pro stuff to see if I could get it working that way but the fresh download that isn't supposed to expire yet, seems to think that it is.

The 2 most likely things that could cause your issue are a) the permissions on the executable and its folders are wrong (but there should be some type of error in that case) or b) the file being edited is wrong. (or possibly the servers are not being properly shutdown and restarted between configuration file edits)

Also noticed that the mamp control panel itself lets you specify the port so you hopefully don't have to edit the listen directive of the conf file directly. Just tell mamp which ports you want before startup.
kavemaniac wrote:Interesting the slight changes from the previous instructions. Am having same results, however. Have dispensed with MAMP Pro for now and am just utilizing MAMP. I am getting no entries in error_log file for what follows.

Code (file=index.lc):

Code: Select all

<html><head><title>Test</title></head>
<body>

Hello.<br>
<?lc 
put "<center>This should be seen.</center>" 
?>

</body>
</html>
Results:
Hello.
This should be seen." ?>

If I do a show source I am shown the code as above. If I remove the <center> tags the result is merely the 'Hello.' line. So that would indicate to me that something is happening somewhere in there, just not the right stuff.

Am interested in the distinction between Linux and OS X LiveCode Server. Does it make a difference when installing the OS X version of it whether you're installing it for the OS X installed Apache versus the MAMP version of Apache?

Is there a command line call that I can make in terminal to determine that LiveCode Server is actually working? Is there an error_log file somewhere for LiveCode Server?

Thank you very much for your help on this.

Kevin

kavemaniac
Posts: 4
Joined: Sat Nov 10, 2012 1:01 am

Re: Installing Server on the MAMP

Post by kavemaniac » Mon Nov 12, 2012 6:54 am

In my experiences there are always two things wrong (probably more in this case). First thing I found when going back to check the httpd.conf file is I had typed the Action line wrong, entering lc=script instead of lc-script... I do that all the time when I'm coding, something to do with changing keyboards on different machines.

Anyway, I thought I also might have those lines in the wrong place in the httpd.conf file. Where I find the line #AddHandler cgi-script .cgi is within the <IfModule mime_module> section. There is no <Directory> directives within that section. I had modified the line for Options Indexes FollowSymLinks ExecCGI but that is a couple hundred lines up in the file from the mime section.

The original PDF file that came with the LiveCodeServer talks about adding the AddHandler lines to the document root <Directory section. I have tried the corrected lines in both the mime section and the document root section and find that it does the following either way in the browser:

Not Found
The requested URL /cgi-bin/LiveCodeServer-5_0_2-Mac/livecode-server/index.lc was not found on this server.

I don't know if this is a step forward or backward.

Kevin

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Installing Server on the MAMP

Post by sturgis » Mon Nov 12, 2012 4:23 pm

Hmm. First thing I noticed, did you put the whole livecode server (LiveCodeServer-5_0_2-Mac) folder into cgi-bin? Or did you put livecode-server (the executable) in the root of cgi-bin and its 2 support folders there also? Either way make sure your directive matches how your directory structure is laid out for your Action line.

As mentioned yes you should be able to add the lines to the directory root. In the case of the file I have it was simple enough to add them as "unsectioned" lines and they are working fine. If you do it as I did then yes the directory block is in a different location. I'm wondering what changes have occurred due to the use of mamp pro. After a little bit of reading it looks like it may use separate directory files rather than a monolithic httpd.conf file. (which is also easy enough to accomplish, but its hard to know without seeing your files)

If you want, back up your httpd.conf file and try my working file. https://dl.dropbox.com/u/11957935/httpd.conf nothing changed except what is required to get lc server working.


Also noticed this in the mamp pro handbook but don't know if it might be part of the issues..
2.4 Can I use “MAMP Standard” at the same time as MAMP PRO?
MAMP PRO is a configuration tool for MAMP. Your MAMP installation will run whenever MAMP PRO is active, as well as after uninstalling MAMP PRO. However, sporadic problems may occur if you try to continue running MAMP after uninstalling MAMP PRO, because MAMP does not know some configuration options of MAMP PRO.
If you want me to look at your conf, adjust anything you might not want public and post here and i'll see what I can figure out.

kavemaniac
Posts: 4
Joined: Sat Nov 10, 2012 1:01 am

Re: Installing Server on the MAMP

Post by kavemaniac » Tue Nov 13, 2012 1:35 am

I put the addhandler lines outside of the 'if mime module' section and then Apache would not start.

So I decided to start over. I uninstalled MAMP and MAMP Pro. Reinstalled that so I made sure I was using a fresh, virgin version of httpd.conf. Ran MAMP alone without MAMP Pro being involved initially. I edited httpd.conf and set it up the same way with the add handler lines outside of any section. I also placed livecodeserver in the cgi-bin instead of inside the other folder like in the other example. I like it better to be simpler, too.

Now it works. I then tried MAMP Pro and it went back to doing those things it was doing before - not quite rendering the output correctly. I guess I'm just not supposed to run MAMP Pro on this deal. I'm okay with that.

Thank you very, very much for your help. I appreciate it.

Kevin

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Installing Server on the MAMP

Post by sturgis » Tue Nov 13, 2012 1:44 am

Glad you got it working. If I can get the trial of mamp pro to run on my machine i'll see if I can figure out how to make it work, but as long as you have things set up so that it is working then hopefully for now it will be sufficient.

So far no luck on my end getting a valid trial started.

icouto
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 92
Joined: Wed May 29, 2013 1:54 am
Location: Sydney, Australia

Re: Installing Server on the MAMP

Post by icouto » Mon Oct 07, 2013 6:09 am

MAMP PRO allows you to have a custom 'cgi-bin' folder - with different cgi scripts - for each virtual host.

In MAMP PRO, while you have your host/domain selected, click in the 'Advanced' tab, and add the following line to the field titled "Customized virtual host general settings":

Code: Select all

ScriptAlias /cgi-bin/ /full/path/to/your/virtualhost/cgi-bin/
Note that the 'full path to your virtual host cgi-bin' should not contain any spaces.

Now, to install LiveCode Server on your virtual host:
1: copy your downloaded 'livecode-server' and its 2 accompanying folders into your virtual host's cgi-bin folder.
2: create the .htaccess file - and the test.lc file - as described here:

http://lessons.runrev.com/s/lessons/m/4 ... a-htaccess

This works with the current versions of LiveCode Server (6.1) and MAMP PRO (2.2).

I hope this helps.

keithglong
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 348
Joined: Sun Jul 03, 2011 2:04 am
Location: Gulf Breeze, Florida

Re: Installing Server on the MAMP

Post by keithglong » Wed Nov 26, 2014 2:17 am

Hi All,

Just to let everyone know, I successfully installed LiveCode Server on MAMP on a Mac running Yosemite. No issues/problems. I simply followed Simon's excellent instructions. Thanks Simon!

Sincerely,

- Boo

EDIT: I am unable to use the encrypt/decrypt commands via my newly installed LiveCode Server, so I suspect it is some kind of configuration issue. Will keep playing with it... Otherwise (at least for now), all seems to be working fine.

Post Reply

Return to “CGIs and the Server”