Page 1 of 2

newlisp-apache-win7

PostPosted: Wed Feb 04, 2015 8:08 pm
by dukester
Can they "play nice" together? How? :D

I've got apache up and running. I've conf it to accept .cgi and .lsp scripts

I'm not sure how to write the initial "shebang" line??? I've been using the FQP to the newlisp executable, but no joy yet!!

Any ideas!! TIA

[follow-up]

I keep getting this apache error:
[Wed Feb 04 15:16:51.241193 2015] [cgi:error] [pid 5544:tid 984] [client ::1:50169] End of script output before headers: index1.cgi

It means that the http headers are not being sent to the server by newlisp. Don't know why not ...

I seem to get less errors with this first line:

#!"C:\Program Files (x86)\newlisp\newlisp.exe"

but no cigars yets!! lol

Re: newlisp-apache-win7

PostPosted: Thu Feb 12, 2015 5:56 pm
by dukester
UPDATE

I've reached point where Apache is able to find newlisp.exe and fork a process!!

Now I get getting this error:

[Thu Feb 12 08:45:36.121954 2015] [cgi:error] [pid 1356:tid 984] [client 127.0.0.1:50078] End of script output before headers: index.lsp



Here's the test code:

Code: Select all
#!c:\bin\newlisp\newlisp.exe
(print "Content-type: text/html\n\n")
(println "<h2>Hello, World!!</h2>")
(exit)


Simple enough! Should work, but I'm stuck!! The required HTTP header is not being sent by newlisp!!!

Anybody know why not?

Re: newlisp-apache-win7

PostPosted: Thu Feb 12, 2015 8:37 pm
by Lutz
should be:

Code: Select all
(print "Content-Type: text/html\r\n\r\n")

Re: newlisp-apache-win7

PostPosted: Thu Feb 12, 2015 9:45 pm
by dukester
Lutz wrote:should be:

Code: Select all
(print "Content-Type: text/html\r\n\r\n")


Thanks for getting back to me Lutz!!!

Tried that too!! No Joy!!! Yet it works under *nix boxes.

I've even made sure that the editor I use to write the script defaulted to using *nix line endings! Do you think that using utf8 character encoding in my editor is hosing the script? I've been using jEdit, so maybe I'll try another editor. If you've got _any_ wild ideas about fixing this, please don't hesitate to fire 'em at me! TIA ...

Re: newlisp-apache-win7

PostPosted: Fri Feb 13, 2015 5:06 pm
by Lutz
I believe somehow the script file extension must be enabled in Apache as an executable CGI file extension. So, either enable .lsp ore better, instead of index.lsp call it index.cgi. That extension many times is already enabled for CGI scripts and of course it must have executable permissions for Apache or for the user grpup under which Apache runs. I imagine things ar similar on Windows.

Re: newlisp-apache-win7

PostPosted: Fri Feb 13, 2015 5:56 pm
by dukester
Lutz wrote:I believe somehow the script file extension must be enabled in Apache as an executable CGI file extension. So, either enable .lsp ore better, instead of index.lsp call it index.cgi. That extension many times is already enabled for CGI scripts and of course it must have executable permissions for Apache or for the user grpup under which Apache runs. I imagine things ar similar on Windows.


Thanks for the extra tips Lutz!!! It's appreciated!

However, renaming the file with a .cgi extension did not help. Neither did renaming the file from "index" to "test" for example. Nothing works.

Yet Apache on my win7 box is serving perl .cgi and .pl scripts!! Even scripts in the obsolete ICI language and a few others give zero problems.

So I'm convinced that there's an issue with the newLISP/Apache interaction on a win32/64 box. Not sure what, but I can confirm that newLISP in HTTP daemon mode works fine on win7.

Too bad there aren't any folks in the community that are running Apache/newLISP on some Windows incarnation!! Thanks for the input!!

Re: newlisp-apache-win7

PostPosted: Sat Feb 21, 2015 11:43 pm
by xytroxon
I don't think it is your script's fault dukester!

newLISP Windows versions 10.5.7, 10.5.8, 10.6.0, 10.6.1, and 10.6.2 crash on Apache web server.

Versions 10.5.6, 10.5.5, and earlier work fine!!!

Last year my newlisp scripts on Uniform Server stopped working for no reason. I thought my server was borked and switched back to using Abyss Web Server. On Abyss, you can setup scripting languages and file extensions or use shebang lines for cgi. I couldn't get shebangs to work, so I just configured newlisp under Abyss' "Scripting Parameters" screen in its console, and that got my newlisp wiki and my other newlisp page scripts working again.

I had about an hour a week of "free time" to program last year, so couldn't troubleshoot it then. I would download the new versions of newlisp, but didn't have time to install or check them out. Sometime around July 4th I updated newlisp, but didn't run my server afterwards. A week later I power it up and... WTF??? No clue what happened... I thought I had been hacked.

This year I have my normal life back and I've spent the last two months cleaning house on my disk drive and updating software that I hadn't updated since 2012-2013. This week, after seeing your problem, I tried to get a new Uniform Server install going - and it would not play nice with newlisp! (Of course I had just erased a bunch of my "useless" Uniform Server files last month telling how to set the damn thing up correctly.)

Today I came across my cache of old newlisp windows installers and had an idea. I started installing and uninstalling those old versions while trying to load newlisp wiki under each version.

Bingo, I got newlisp wiki to work on the older newlisp verisons!!!

------------------------------------------------------
------------------------------------------------------
Software used for test:

Uniform Server: 11.7.1 ZeroXI
Apache 2.4.12 VC10 OpenSSL/1.0.1j-fips
http://www.uniformserver.com/

Abyss Web Server: X1 -(version 2.9.3.6
non-Apache
http://www.aprelium.com/

Opera Browser

FireFox Browser

------------------------------------------------------
------------------------------------------------------
Errors occurring:

------------------------------------------------------
Browser web page error for: http://localhost/wiki
------------------------------------------------------

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at admin@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

------------------------------------------------------
Win 7 Message Box: newlisp.exe
------------------------------------------------------

newlisp.exe has stopped working

Windows can check online for a solution to the problem.

> Check online for a solution and close the program.
> Close the programn.

View problem details.
---------
Problem signature:
Problem Event Name: APPCRASH
Application Name: newlisp.exe
Application Version: 0.0.0.0
Application Timestamp: 5303758e
Fault Module Name: newlisp.exe
Fault Module Version: 0.0.0.0
Fault Module Timestamp: 5303758e
Exception Code: c0000005
Exception Offset: 0000b60f
OS Version: 6.1.7600.2.0.0.768.3
Locale ID: 1033
Additional Information 1: 0a9e
Additional Information 2: 0a9e372d3b4a9135b953a7833882e789
Additional Information 3: 0a9e
Additional Information 4: 0a9e372d3b4a9135b9533a78882e789

------------------------------------------------------

-- xytroxon

Re: newlisp-apache-win7

PostPosted: Sun Feb 22, 2015 12:52 am
by Lutz
Unfortunately, I have no Apache-on-Windows setup to test. Perhaps you can repeat your test with a minimum script, e.g.:

Code: Select all
#!/usr/bin/newlisp 
# change above to Windows path

(print "Content-Type: text/html\r\n\r\n")

(print "<html>")
(print "<h4>CGI by newLISP v" (sys-info -2)" on " ostype "</h4>")
(println "</html>")
(exit)


looking into the change log between 10.5.6 to 10.5.7, I cannot find anything suspicious.

If it still crashes, we at least know, it has nothing to do with some newLISP built-in function not working anymore, but must be some other reason.

If it does not crash, one would have to look at the specifics of the scripts, cutting them smaller until the error disappears.

Re: newlisp-apache-win7

PostPosted: Sun Feb 22, 2015 1:03 am
by dukester
@xytroxon

Thanks a bunch for going the extra mile with such a great (but disappointing) reply!

I didn't know why, but I had a hunch that there was something haywire somewhere. I might just have to revert back to an older version of newLISP like you. Thanks again for the confirmation!!

Re: newlisp-apache-win7

PostPosted: Sun Feb 22, 2015 1:06 am
by Lutz
We posted at the same time. Perhaps when trying different versions, you can try the above in my last post.

Re: newlisp-apache-win7

PostPosted: Sun Feb 22, 2015 1:10 am
by dukester
@Lutz

I'll give it a shot - but my original test script was pretty simple also! :) I'll get back to the list ...

Re: newlisp-apache-win7

PostPosted: Sun Feb 22, 2015 1:12 am
by xytroxon
These shebang forms all fail:

#!C:\Program Files (x86)\newlisp\newlisp.exe

#!"C:\Program Files (x86)\newlisp\newlisp.exe"

#!"C:/Program Files (x86)/newlisp/newlisp.exe"

http://localhost/test.lsp

Code: Select all
#!C:\Program Files (x86)\newlisp\newlisp.exe

(print
   "Content-type: text/html\n\n"
   "<html>\n"
   "<head>\n"
   "  <title>newLISP test</title>"
   "</head>\n"
   "<body>\n"
   "  <H1>Hello World</h1>\n"
   "</body>\n"
   "</html>\n"
)
(exit)



This python code works fine: http://localhost/test.py

Code: Select all
#!C:\Python27\python.exe

print "Content-type: text/html\n\n"
print "<html>\n"
print "<head>\n"
print "  <title>newLISP test</title>"
print "</head>\n"
print "<body>\n"
print "  <H1>Hello World</h1>\n"
print "</body>\n"
print "</html>\n"


.htacess file
Code: Select all
#------------------------------------------------------------------------------
# Server root folder www .htaccess
# This file provides server security limiting access to the localhost only.
# Comment next four lines to deactivate. (Allows external access)
#------------------------------------------------------------------------------

Order Deny,Allow
Deny from all
Allow from 127.0.0.1
Allow from ::1

#------------------------------------------------------------------------------
# To allow execution of cgi scripts in this directory uncomment next two lines.
#------------------------------------------------------------------------------

AddHandler cgi-script .pl .cgi .lsp .py
Options +ExecCGI +FollowSymLinks

#------------------------------------------------------------------------------
# Activate this section to use the Private Server Feature!
# Defaults: Username - root; Password - root
# Note AuthUserFile: File path is relative to server root
# To lock server, uncomment the next 4 lines. (A name and password is required)
#------------------------------------------------------------------------------

#AuthName "Uniform Server - Server Access"
#AuthType Basic
#AuthUserFile ../../htpasswd/www/.htpasswd
#Require valid-user


-- xytroxon

Re: newlisp-apache-win7

PostPosted: Sun Feb 22, 2015 1:20 am
by dukester
@xytroxon
@lutz

I get the very same results -- shebangs do not work!! I even re-installed newLISP in c:\newlisp\ in order to eliminate the space BS in "Program Files (x86) ....." etc etc

Zero Joy!!!

Re: newlisp-apache-win7

PostPosted: Wed Mar 04, 2015 3:21 pm
by dukester
@lutz
Have you had a chance to look into this issue any further? Can I be of some help in that regard?

Re: newlisp-apache-win7

PostPosted: Wed Mar 04, 2015 7:28 pm
by Lutz
unfortunately, I don't have a Windows installation with Apache server available .

I wonder if anybody else runs Apache on Windows and could check this out?

Re: newlisp-apache-win7

PostPosted: Wed Mar 04, 2015 8:46 pm
by rickyboy
I too don't have Windoze, but this sounds more like an Apache question than a newLISP question.

You might want to try other web servers that do CGI, to narrow down the issue as Apache-related or not. Maybe try the Nginx stack here: https://bitnami.com/stacks/infrastructure

Good luck.

Re: newlisp-apache-win7

PostPosted: Wed Mar 04, 2015 8:50 pm
by ralph.ronnquist
I also don't have it set up to test myself, but is it possible that the script exits too fast, so the output gets discarded before delivery? Maybe a sleep before exit would help? Or perhaps just closing stdout?

Re: newlisp-apache-win7

PostPosted: Wed Mar 04, 2015 9:17 pm
by rickyboy
Also, have you remembered to do things in the httpd.conf, like add "AllowOverride Options" and "AllowOverride FileInfo", so that your .htaccess directives have any effect? Do you have access to httpd.conf to change this, if not?

https://httpd.apache.org/docs/2.2/howto ... s.html#cgi

https://httpd.apache.org/docs/2.2/howto/cgi.html

Re: newlisp-apache-win7

PostPosted: Thu Mar 05, 2015 12:25 am
by dukester
Like I indicated up the thread, CGI scripts run with zero problems using other language interpreters!!

So there is NO http.conf issue as far as I can determine.

I have a compiled C script that runs extra quick. I haven't yet seen problems with quick scripts - but I might have missed a lot. :)

xytroxon has had the very same issue (again, look up-thread) - but NOT with older versions of newLISP!!

For me, newLISP would be more attractive in an Apache/CGI context, than in anything else. I'm sure that it could compete admirably if it could be made to play nice - consistently.

So Lutz - what do you need to know to get a better handle on this problem? How can I help?

Re: newlisp-apache-win7

PostPosted: Thu Mar 05, 2015 1:34 am
by Lutz
OK, let's start by verifying that the problem starts with 10.5.7 and that 10.5.6 is still fine.

From this directory: http://newlisp.org/dukester/

Take env-cgi.txt and rename to env.cgi and change to the correct #! line for your Windows/Apache installation. Then try both of the newlisp executables renamed to newlisp.exe. Make sure that all files have executable permissions for Apache.

If we can repeat xytroxon's observation, I will start rolling back changes in 10.5.7 to the point where it works and we hopefully know what is going on and can try a fixed 10.6.3 executable.

Re: newlisp-apache-win7

PostPosted: Thu Mar 05, 2015 1:56 am
by dukester
Here you go my friend ....

#!D:\Downloads\newlisp10507\newlisp10507.exe
(print "Content-Type: text/html\r\n\r\n")

(print "<html>")
(print "<h4>CGI by newLISP v" (sys-info -2)" on " ostype "</h4>")
(dolist (e (env)) (println (e 0) " : " (e 1) "</br>"))
(println "</html>")
(exit)


[Wed Mar 04 18:48:52.963460 2015] [cgi:error] [pid 1176:tid 712] [client ::1:50059] End of script output before headers: env.cgi



#!D:\Downloads\newlisp10506\newlisp10506.exe
(print "Content-Type: text/html\r\n\r\n")

(print "<html>")
(print "<h4>CGI by newLISP v" (sys-info -2)" on " ostype "</h4>")
(dolist (e (env)) (println (e 0) " : " (e 1) "</br>"))
(println "</html>")
(exit)


CGI by newLISP v10506 on Win32
HTTP_HOST : localhost
HTTP_USER_AGENT : Mozilla/5.0 (Windows NT 6.1; WOW64; rv:35.0) Gecko/20100101 Firefox/35.0
HTTP_ACCEPT : text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_ACCEPT_LANGUAGE : en-US,en;q=0.5
HTTP_ACCEPT_ENCODING : gzip, deflate
HTTP_DNT : 1
HTTP_CONNECTION : keep-alive
HTTP_PRAGMA : no-cache
HTTP_CACHE_CONTROL : no-cache
PATH : C:\Smalltalk\;C:\Program Files (x86)\Icon\bin;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;c:\ansicon;C:\Unicon\bin;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\GtkSharp\2.12\bin;C:\Program Files\nodejs\;C:\Program Files (x86)\PDFtk\bin\;C:\Program Files (x86)\GNU\Claws Mail\pub;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files\Microsoft Windows Performance Toolkit\;C:\agena\bin;C:\bin\;C:\Go\bin;
SystemRoot : C:\Windows
COMSPEC : C:\Windows\system32\cmd.exe
PATHEXT : .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.tcl;.groovy;.gy;.ICX
WINDIR : C:\Windows
SERVER_SIGNATURE :
SERVER_SOFTWARE : Apache/2.4.12 (Win64)
SERVER_NAME : localhost
SERVER_ADDR : ::1
SERVER_PORT : 80
REMOTE_ADDR : ::1
DOCUMENT_ROOT : C:/Apache24/htdocs
REQUEST_SCHEME : http
CONTEXT_PREFIX : /cgi-bin/
CONTEXT_DOCUMENT_ROOT : c:/Apache24/cgi-bin/
SERVER_ADMIN : admin@example.com
SCRIPT_FILENAME : C:/Apache24/cgi-bin/nLISP/env.cgi
REMOTE_PORT : 50063
GATEWAY_INTERFACE : CGI/1.1
SERVER_PROTOCOL : HTTP/1.1
REQUEST_METHOD : GET
QUERY_STRING :
REQUEST_URI : /cgi-bin/nLISP/env.cgi
SCRIPT_NAME : /cgi-bin/nLISP/env.cgi
NEWLISPDIR : newlisp

Re: newlisp-apache-win7

PostPosted: Thu Mar 05, 2015 3:17 pm
by Lutz
Thanks Duke, having the 10.5.6 to 10.5.7 good to bad transition confirmed is a good starting point.

Here: http://newlisp.nfshost.com/dukester/ are 4 more versions newlisp10507a-d rolling back changes. More to come if necessary. The bulk of changes from 10.5.6 to 10.5.7 is from eliminating strncat() for security reasons and replacing it with memcpy() and these changes could affect processing when Apache feeds the script to newlisp.exe.

Re: newlisp-apache-win7

PostPosted: Thu Mar 05, 2015 3:30 pm
by dukester
No worries!!! My pleasure ...

Got the other "sub" versions DLed - will get back to you when I'm done testing. Got to have breakfast first!! lol

Re: newlisp-apache-win7

PostPosted: Thu Mar 05, 2015 4:21 pm
by dukester
Versions a & b bombed out!!!

BUT - c & d worked great!!

This is rendered by newLISP v10507d
CGI by newLISP v10507 on Win32
HTTP_HOST : localhost
HTTP_USER_AGENT : Mozilla/5.0 (Windows NT 6.1; WOW64; rv:35.0) Gecko/20100101 Firefox/35.0
HTTP_ACCEPT : text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_ACCEPT_LANGUAGE : en-US,en;q=0.5
HTTP_ACCEPT_ENCODING : gzip, deflate
HTTP_DNT : 1
HTTP_CONNECTION : keep-alive
HTTP_PRAGMA : no-cache
HTTP_CACHE_CONTROL : no-cache
PATH : C:\Smalltalk\;C:\Program Files (x86)\Icon\bin;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;c:\ansicon;C:\Unicon\bin;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\GtkSharp\2.12\bin;C:\Program Files\nodejs\;C:\Program Files (x86)\PDFtk\bin\;C:\Program Files (x86)\GNU\Claws Mail\pub;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files\Microsoft Windows Performance Toolkit\;C:\agena\bin;C:\bin\;C:\Go\bin;
SystemRoot : C:\Windows
COMSPEC : C:\Windows\system32\cmd.exe
PATHEXT : .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.tcl;.groovy;.gy;.ICX
WINDIR : C:\Windows
SERVER_SIGNATURE :
SERVER_SOFTWARE : Apache/2.4.12 (Win64)
SERVER_NAME : localhost
SERVER_ADDR : ::1
SERVER_PORT : 80
REMOTE_ADDR : ::1
DOCUMENT_ROOT : C:/Apache24/htdocs
REQUEST_SCHEME : http
CONTEXT_PREFIX : /cgi-bin/
CONTEXT_DOCUMENT_ROOT : c:/Apache24/cgi-bin/
SERVER_ADMIN : admin@example.com
SCRIPT_FILENAME : C:/Apache24/cgi-bin/nLISP/env.cgi
REMOTE_PORT : 50608
GATEWAY_INTERFACE : CGI/1.1
SERVER_PROTOCOL : HTTP/1.1
REQUEST_METHOD : GET
QUERY_STRING :
REQUEST_URI : /cgi-bin/nLISP/env.cgi
SCRIPT_NAME : /cgi-bin/nLISP/env.cgi
NEWLISPDIR : newlisp

****************************************

This is rendered by newLISP v10507c
CGI by newLISP v10507 on Win32
HTTP_HOST : localhost
HTTP_USER_AGENT : Mozilla/5.0 (Windows NT 6.1; WOW64; rv:35.0) Gecko/20100101 Firefox/35.0
HTTP_ACCEPT : text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_ACCEPT_LANGUAGE : en-US,en;q=0.5
HTTP_ACCEPT_ENCODING : gzip, deflate
HTTP_DNT : 1
HTTP_CONNECTION : keep-alive
HTTP_PRAGMA : no-cache
HTTP_CACHE_CONTROL : no-cache
PATH : C:\Smalltalk\;C:\Program Files (x86)\Icon\bin;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;c:\ansicon;C:\Unicon\bin;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\GtkSharp\2.12\bin;C:\Program Files\nodejs\;C:\Program Files (x86)\PDFtk\bin\;C:\Program Files (x86)\GNU\Claws Mail\pub;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files\Microsoft Windows Performance Toolkit\;C:\agena\bin;C:\bin\;C:\Go\bin;
SystemRoot : C:\Windows
COMSPEC : C:\Windows\system32\cmd.exe
PATHEXT : .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.tcl;.groovy;.gy;.ICX
WINDIR : C:\Windows
SERVER_SIGNATURE :
SERVER_SOFTWARE : Apache/2.4.12 (Win64)
SERVER_NAME : localhost
SERVER_ADDR : ::1
SERVER_PORT : 80
REMOTE_ADDR : ::1
DOCUMENT_ROOT : C:/Apache24/htdocs
REQUEST_SCHEME : http
CONTEXT_PREFIX : /cgi-bin/
CONTEXT_DOCUMENT_ROOT : c:/Apache24/cgi-bin/
SERVER_ADMIN : admin@example.com
SCRIPT_FILENAME : C:/Apache24/cgi-bin/nLISP/env.cgi
REMOTE_PORT : 50611
GATEWAY_INTERFACE : CGI/1.1
SERVER_PROTOCOL : HTTP/1.1
REQUEST_METHOD : GET
QUERY_STRING :
REQUEST_URI : /cgi-bin/nLISP/env.cgi
SCRIPT_NAME : /cgi-bin/nLISP/env.cgi
NEWLISPDIR : newlisp

Re: newlisp-apache-win7

PostPosted: Thu Mar 05, 2015 5:49 pm
by Lutz
Great news, looks like the bug is fixed. newlisp10507c-ab.exe and newlisp10603.exe should both work:

http://newlisp.nfshost.com/dukester/new ... 07c-ab.exe
http://newlisp.nfshost.com/dukester/newlisp10603.exe

Ps: this was posted 1/2 hour ago with wrong files and I removed this post, so download files again.