how to get scripts working

Are you using LiveCode to create server scripts or CGIs?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
planix
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 47
Joined: Tue Mar 10, 2009 12:47 pm

how to get scripts working

Post by planix » Thu Mar 06, 2014 12:12 pm

Hi,

I have set up a server on my Windows PC (XAMMP) to try and get my head around using livecode-server.

I am using LCS 6.1

I decided to use .htaccess in the first instance as I am planning to move to an external solution once I have a better understanding of how this all works.

I have put the LCS in the cgi-bin folder. I have set up a folder called livecode-server and put the exe and dll folders into that. I have an .htaccess file in the cgi-bin outside of the livecode-server folder.

-cgi-bin
--.htaccess
--<livecode-server>
---<drivers>
---<externals>
----livecode-server.exe

Now, this seems to work. I put the test.lc script suggested in the livecode tutorials into htdocs(which is equivalent to public-html on XAMMP).

The file with the script reads:
<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>
The first part of the script stuff works. But the second put statement doesn't seem to be processed.

I get a page that reads
My LiveCode Server Test Page

Hello World! from LiveCode Server
" put "
The date is " && the date & "

" ?>
Does anyone have some clues as to what might be going wrong here?

cheers
****************************************
PLANIX
"Knowing anything is better than knowing nothing. But knowing that nothing ain't anything, why that's just plain nirvana."

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1236
Joined: Sat Apr 08, 2006 1:10 pm
Location: Zurich
Contact:

Re: how to get scripts working

Post by BvG » Thu Mar 06, 2014 8:24 pm

LC depends on proper returns at the end of lines. It's possible that the engine on windows expects script files to use crlf, and the example file is probably made for unix/linux.

You can use the LC ide to convert the file into crlf, but make sure you do this with a copy, so you can try other solutions if crlf is actually not the problem.

Code: Select all

--untested
on mouseUp
answer file ""
put url ("binfile:" & it) into theData
if not theData contains crlf then
put url ("file:" & it) into theData --creates file with crlf when run on windows system
end if
end moseup
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

planix
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 47
Joined: Tue Mar 10, 2009 12:47 pm

Re: how to get scripts working

Post by planix » Thu Mar 06, 2014 10:13 pm

Thanks. I tried this and the output was the same. Though it does look like something of that kind is happening doesn't it.

cheers
****************************************
PLANIX
"Knowing anything is better than knowing nothing. But knowing that nothing ain't anything, why that's just plain nirvana."

Post Reply

Return to “CGIs and the Server”