| View previous topic :: View next topic | 
	
	
		| Author | Message | 
	
		| Mats Högman -
 
 
 Joined: 13 Jun 2004
 Posts: 7
 
 
 | 
			
				|  Posted: Sun Jun 13, 2004 5:50 pm    Post subject: Using MzScheme as interpreter. |   |  
				| 
 |  
				| Hi, I'm into Scheme programming and learned that it is possible to use MzScheme in cgi scripting.
 I encountered a problem... how do I use Scheme with Abyss Web Server?
 
 I did all the things said in adding Pearl support, but for MzScheme instead. In the beginning of the *.scm file I put
 
 #!/bin/sh
 ":";exec /usr/local/bin/mzscheme -r $0
 
 but it doesn't work. I get an HTTP 500 error.
 
 What is wrong?
 
 Mats
 |  | 
	
		| Back to top |     | 
	
		|  | 
	
		| Anonymoose -
 
 
 Joined: 09 Sep 2003
 Posts: 2192
 
 
 | 
			
				|  Posted: Sun Jun 13, 2004 7:02 pm    Post subject: |   |  
				| 
 |  
				| Are you running the Linux or Windows version of Abyss ? |  | 
	
		| Back to top |     | 
	
		|  | 
	
		| Mats Högman -
 
 
 Joined: 13 Jun 2004
 Posts: 7
 
 
 | 
			
				|  Posted: Sun Jun 13, 2004 10:26 pm    Post subject: |   |  
				| 
 |  
				| I'm running the Windows version of Abyss. |  | 
	
		| Back to top |     | 
	
		|  | 
	
		| TRUSTAbyss -
 
 
 Joined: 29 Oct 2003
 Posts: 3752
 Location: USA, GA
 
 | 
			
				|  Posted: Sun Jun 13, 2004 10:36 pm    Post subject: |   |  
				| 
 |  
				| You setup your path wrong , you should install this language like  you installed Perl , without using the scripts #! line , the
 problem should be solved now  , I HOPE !
 |  | 
	
		| Back to top |       | 
	
		|  | 
	
		| Mats Högman -
 
 
 Joined: 13 Jun 2004
 Posts: 7
 
 
 | 
			
				|  Posted: Sun Jun 13, 2004 11:27 pm    Post subject: |   |  
				| 
 |  
				| That doesn't work either... |  | 
	
		| Back to top |     | 
	
		|  | 
	
		| Anonymoose -
 
 
 Joined: 09 Sep 2003
 Posts: 2192
 
 
 |  | 
	
		| Back to top |     | 
	
		|  | 
	
		| Mats Högman -
 
 
 Joined: 13 Jun 2004
 Posts: 7
 
 
 | 
			
				|  Posted: Mon Jun 14, 2004 12:00 pm    Post subject: |   |  
				| 
 |  
				| I saw that post too, but I couldn't figure out what to do. Using .bat files in Windows is more like scripting in the local computer. In the DrScheme manual they made a difference in that kind of script and cgi-script. 
 I will try to install Pearl and see how that work and perhaps I can work it out that way. If someone have some solution on this problem please let me know.
 |  | 
	
		| Back to top |     | 
	
		|  | 
	
		| aprelium -
 
 
 Joined: 22 Mar 2002
 Posts: 6800
 
 
 | 
			
				|  Posted: Tue Jun 15, 2004 1:12 pm    Post subject: |   |  
				| 
 |  
				| Mats Högman, 
 We'll download MzScheme and see how things works on Windows. FYI, we've already tested MzScheme on Linux and it works fine for CGI scripting with Abyss. So there should be no problem with Windows.
 Please contact us at support@aprelium.com to have the answer quickly.
 _________________
 Support Team
 Aprelium - http://www.aprelium.com
 |  | 
	
		| Back to top |       | 
	
		|  | 
	
		| Anonymoose -
 
 
 Joined: 09 Sep 2003
 Posts: 2192
 
 
 | 
			
				|  Posted: Tue Jun 15, 2004 3:44 pm    Post subject: |   |  
				| 
 |  
				| I'd also be interested to see the answer - looks like it could be useful...  I did download it and try to get it running but with no luck. |  | 
	
		| Back to top |     | 
	
		|  | 
	
		| Mats Högman -
 
 
 Joined: 13 Jun 2004
 Posts: 7
 
 
 | 
			
				|  Posted: Tue Jun 15, 2004 4:09 pm    Post subject: |   |  
				| 
 |  
				| I have installed Perl and that works fine. Perhaps I'm doing something wrong when I try to install MzScheme. I added a path to MzScheme in autoexec.bat as they did with Perl, but it will not work. |  | 
	
		| Back to top |     | 
	
		|  | 
	
		| Anonymoose -
 
 
 Joined: 09 Sep 2003
 Posts: 2192
 
 
 | 
			
				|  Posted: Tue Jun 15, 2004 4:20 pm    Post subject: |   |  
				| 
 |  
				| Seems to be more to do with how the interpreter included in MzScheme outputs under Windows, none of the .exe's I found could handle being passed a script to execute and return output to the server. |  | 
	
		| Back to top |     | 
	
		|  | 
	
		| aprelium -
 
 
 Joined: 22 Mar 2002
 Posts: 6800
 
 
 | 
			
				|  Posted: Thu Jun 17, 2004 10:16 am    Post subject: |   |  
				| 
 |  
				| You should modify slightly your CGI configuration as follows: * Open the console, select Server Configuration > Advanced > CGI Parameters
 * Set "Resolve the interpreter using the #! line" to "Yes"
 * In the CGI Paths, press Add and enter /*.scm in the Virtual Path field.
 Press OK
 * Remove any previous Scheme interpreter that you have declared in the CGI
 Interpreters table
 * Press OK
 * Press Restart
 
 Now go to any of you web site directory (htdocs/ by default) and create a
 file called test.scm containing the following code:
 
 
  	  | Code: |  	  | #!"C:\Program Files\MzScheme\MzScheme.exe" -r %1 
 ;Identify content-type as plain text.
 (display "content-type: text/plain")
 (newline)
 (newline)
 ;Generate a page with the requested info. This is
 ;done by simply writing to standard output.
 (for-each
 (lambda (env-var)
 (display env-var)
 (display " = ")
 (display (or (getenv env-var) ""))
 (newline))
 '("AUTH_TYPE"
 "CONTENT_LENGTH"
 "CONTENT_TYPE"
 "DOCUMENT_ROOT"
 "GATEWAY_INTERFACE"
 "HTTP_ACCEPT"
 "HTTP_REFERER" ; [sic]
 "HTTP_USER_AGENT"
 "PATH_INFO"
 "PATH_TRANSLATED"
 "QUERY_STRING"
 "REMOTE_ADDR"
 "REMOTE_HOST"
 "REMOTE_IDENT"
 "REMOTE_USER"
 "REQUEST_METHOD"
 "SCRIPT_NAME"
 "SERVER_NAME"
 "SERVER_PORT"
 "SERVER_PROTOCOL"
 "SERVER_SOFTWARE"))
 | 
 
 Replace in the first line C:\Program Files\MzScheme\MzScheme.exe with the
 full path of MzScheme.exe on your computer.
 
 Now browse this file (using http://127.0.0.1/test.scm for example), does it
 work? If not, please send us your abyss.conf file, your test.scm file and
 tell us what is the full path of you have installed MzScheme on your hard
 drive.
 
 If it works, congratulations. Any Scheme file will only need adding the #!
 line in order to run correctly by the web server (the server will use #! to
 know how to run it, and adding /*.scm to the CGI Paths instructs the server
 to consider /*.scm files as CGI scripts.)
 _________________
 Support Team
 Aprelium - http://www.aprelium.com
 |  | 
	
		| Back to top |       | 
	
		|  | 
	
		| iNaNimAtE -
 
 
 Joined: 05 Nov 2003
 Posts: 2381
 Location: Everywhere you're not.
 
 | 
			
				|  Posted: Thu Jun 17, 2004 7:18 pm    Post subject: |   |  
				| 
 |  
				| Now if you set the #! to "yes," will that also start to resolve perl scripts using the #! also? Or will it still continue to use the set interpreter in the abyss.conf file? _________________
 Bienvenidos!
 |  | 
	
		| Back to top |                | 
	
		|  | 
	
		| Mats Högman -
 
 
 Joined: 13 Jun 2004
 Posts: 7
 
 
 | 
			
				|  Posted: Fri Jun 18, 2004 7:07 am    Post subject: |   |  
				| 
 |  
				| I tested if it was possible to run both Scheme and Perl with this configuration and its not. If I add the path for Perl, Scheme would not work but Perl does. If I remove the path for Perl in the CGI Interpreters table Scheme will work but not Perl. 
 It would be nice if the Abyss software could choose interpreter by itself. Perhaps it could be solved with some sort of plugin. If I choose to install Scheme but I would like to use Perl or some other script in some other language. What to do?
 Well I know that it is possible to write Scheme code and include C++, Java, Ada or whatever. Then it must be possible to write some scheme code to execute Perl or any other script language.
 |  | 
	
		| Back to top |     | 
	
		|  | 
	
		| iNaNimAtE -
 
 
 Joined: 05 Nov 2003
 Posts: 2381
 Location: Everywhere you're not.
 
 | 
			
				|  Posted: Fri Jun 18, 2004 7:22 am    Post subject: |   |  
				| 
 |  
				| There must be a workaround somehow, though. When you had the #! set to yes, and both interpreters set up, did you set the Perl's #! line accordingly? _________________
 Bienvenidos!
 |  | 
	
		| Back to top |                | 
	
		|  | 
	
		| Mats Högman -
 
 
 Joined: 13 Jun 2004
 Posts: 7
 
 
 | 
			
				|  Posted: Fri Jun 18, 2004 6:20 pm    Post subject: |   |  
				| 
 |  
				| Yes |  | 
	
		| Back to top |     | 
	
		|  | 
	
		| aprelium -
 
 
 Joined: 22 Mar 2002
 Posts: 6800
 
 
 | 
			
				|  Posted: Sat Jun 19, 2004 3:04 pm    Post subject: |   |  
				| 
 |  
				| Mats Högman, 
 We don't understand what is the problem with Scheme and Perl. If you install Perl as explained in http://www.aprelium.com/abyssws/perl.html, Abyss will rely on the file extension to know what interpreter it should run. If it can't find the extension associated with an interpreter, it will use the #! line. So Perl and Scheme will both work without any problem.
 
 If this doesn't help, please send us your abyss.conf file.
 _________________
 Support Team
 Aprelium - http://www.aprelium.com
 |  | 
	
		| Back to top |       | 
	
		|  | 
	
		|  |