World: r3wp
[CGI] web server issues
older newer | first last |
Volker 1-Mar-2006 [460] | #!/rebol -sc of course. the -s swiches sandbox of. i then usually do a secure to my own folder first in the cgi. |
Thør 4-Apr-2006 [461] | . |
Louis 8-May-2006 [462] | I am running XP on my local computer. Out web host's server is running Red Hat Linux. Which version of core should I use on the host server to run the cgi scripts? If I download the proper Linux core interpreter to my XP computer, and uncompress it using WinZip, will it be corrupted by XP? How do I get a clean version of core to the Linux server? |
Graham 8-May-2006 [463] | ftp |
Louis 8-May-2006 [464x3] | Hi Graham, I am, of course, using ftp. I'm sending core 042 for Red Hat to the server using binary mode. |
The script using text mode. | |
Both files are set to 755. | |
Sunanda 8-May-2006 [467] | <<Which version of core should I use>> Use the most recent Core version that is supported on Red Hat and XP. That way. you'll hit the least code incompatibilites when testing locally |
Louis 8-May-2006 [468x2] | But testing using http returns an error saying that rebol is not in the cgi-bin directory where it in fact is. |
500 Server Error A misconfiguration on the server caused a hiccup. Check the server logs, fix the problem, then try again. URL: http://www.dayspringpublisher.com/cgi-bin/now.cgi /home/daysprin/public_html/cgi-bin/now.cgi: Invalid shebang /dayspringpublisher.com/cgi-bin/rebol: Does not exist! | |
Sunanda 8-May-2006 [470] | Sounds like either: -- your script does not start wityh a shebang -- it does, but the rebol.exe it points to is not there -- you don;t have teh right line endings |
Louis 8-May-2006 [471x2] | #!/dayspringpublisher.com/cgi-bin/rebol -cs REBOL [Title: "Hi"] print "content-type: text/html^/" print [<HTML><BODY>] print ["Hi"] print [</BODY></HTML>] |
Does that shebang look right? | |
Graham 8-May-2006 [473] | no, it is not correct |
Sunanda 8-May-2006 [474x2] | ?? should be be rebol.exe at the end? ?? try an absolute path |
as you don't know for sure where the webserver is starting from | |
Louis 8-May-2006 [476] | exe on Linux? |
Graham 8-May-2006 [477x2] | try #!/home/daysprin/public_html/cgi-bin/rebol -cs |
or check the shebang for any perl scripts you have in your cgi-bin directory to see what it should be. | |
Sunanda 8-May-2006 [479] | okay, forget my fisrt one :-) |
Graham 8-May-2006 [480] | the perl scripts may point to a common perl interpreter so may not help you either. |
Louis 8-May-2006 [481x2] | Graham, that worked! Thanks!. Why did you use daysprin instead of dayspringpublisher.com? |
Thanks also to Sunanada. | |
Graham 8-May-2006 [483x2] | shebangs only refer to the local filing system. They know nothing of web servers which are virtual paths for the web server which is an application. |
And your web server reported the actual path in the 500 server error message. | |
Louis 8-May-2006 [485x3] | It sure did. I didn't notice that. I will have to start paying better attention to what is before my eyes. Thanks again! |
OK, now that cgi is working, I want to make a form that will allow people to give their name and email address to be saved in a rebol db file on the server for me to download at my convenience. Has anyone already done this so that I don't have to reinvent the wheel? | |
Of course, I need the cgi scrpt for this also. | |
Louis 10-May-2006 [488x3] | What is wrong with this script? #!/home/daysprin/public_html/cgi-bin/rebol -cs REBOL [] print "Content-type: text/html^/" html: make string! 2000 emit: func [data] [repend html data] read-cgi: func [ ;Read CGI data. Return data as string or NONE. /local data buffer ][ switch system/options/cgi/request-method [ "POST" [ data: make string! 1020 buffer: make string! 16380 while [positive? read-io system/ports/input buffer 16380][ append data buffer clear buffer ] ] "GET" [data: system/options/cgi/query-string] ] data probe data ] cgi-data: decode-cgi read-cgi print cgi-data write/append %nr.txt reform [ now/date system/options/cgi/remote-addr mold cgi-data newline ] |
It writes the date and remote-add to the file, but does not write cgi-data to the file. What is wrong? | |
No, I was wrong. It does work. :>) | |
Janeks 11-Aug-2006 [491] | I am trying for first time to setup rebol for cgi on remote Apache web server on Linux. I am working from WinXP Site management is done with EnsimPro. Ftp does not yet working. So what is done up to now: Uploaded file Rebol from rebol-core-2602042.tar package for Linux to cgi-bin directory; Set permisions to owner read, write, execute and for group and others to read, execute; Test script -> write file read file, Test script uploaded (throught web broeser by using EnsimPro web interface) test script: #!/var/www/cgi-bin/rebol -cs REBOL [Title: "CGI Basics"] print ["Content-type: text/html" newline] print "Hello!!!" to cgi-bin directory; Set the same permisions. Pointing to the test file I am getting "500 Internal server errror" What else could be wrong? Interesting that I have interpreters directory on this web server where are couple files regarding php and perl. Could it be connected with my problem? |
Pekr 11-Aug-2006 [492x2] | hi, just playing with cgi too .... your cgi-bin directory seems ok having 755 rights .... |
when I upload my script, I don't feed it with full path, just !#rebol -cs, if the interpreter is from the same directory .... | |
Janeks 11-Aug-2006 [494] | It does not help! |
Pekr 11-Aug-2006 [495] | what is your precise mask for script itself? Try giving it 777 for a while, to see, if it is permission problem or not ... try to print newline at the end of the script ... |
Janeks 11-Aug-2006 [496] | Is it o' k that it is just rebol file from linux package and that I extracted it on WinXp then uploaded? What you meant under "mask"? |
Pekr 11-Aug-2006 [497x5] | btw - always build your resulting string first out: copy "" ... and then everything append out stuff-you-want-to-add .... print out at the end ... it is MUCH faster to print everything at once, then to print incrementally to the client ... |
permissions - xwr-xwr-xwr = 777 | |
uploading should be ok .... | |
what is your script suffix? | |
if it is .r, try to change it to .cgi for a while | |
Janeks 11-Aug-2006 [502] | Already tried! |
Pekr 11-Aug-2006 [503] | does any other, etc. pl or shell script work i cgi directory .... |
Janeks 11-Aug-2006 [504] | Btw content of one of file in the interpreters dir: #!/bin/bash if [ -z "$REDIRECT_STATUS" ]; then echo -e "Content-Type: text/html\r\n\r <b>Security Alert!</b> The Perl CGI cannot be accessed directly. <p>This Perl CGI launcher is configured to require a redirect. This means that a page will only be served up if the REDIRECT_STATUS CGI variable is set, e.g. via an Apache Action directive.</p> <p>For more information as to <i>why</i> this behaviour exists, see the <a href=\"http://php.net/security.cgi-bin\"> PHP manual page for CGI security</a>.</p> else export SCRIPT_NAME=${PATH_TRANSLATED##${DOCUMENT_ROOT}} export SCRIPT_FILENAME=$PATH_TRANSLATED /usr/bin/perl $SCRIPT_FILENAME" fi As newcomer in linux and apache I can only ques what it mean, but I am thinking about this line: This Perl CGI launcher is ... |
Pekr 11-Aug-2006 [505x3] | ah, then this apache is configured strangely imo .... in Apache httpd.conf, you normally specify ScriptAlias for directory, where cgi is going to be placed. Then you can always manually set whatever directory, to perform cgi action by adding SetHandler cgi-script for specific directory .... but then all files in there are regarded being a cgi and Apache could try to run them ... |
mostly, if you want to perform cgi outside scriptalias location, following directive is uncommented - AddHandler cgi-script .cgi | |
it seems to me, that this apache, if the perl script is right, is unnecessarily configured other way, but du not know ... | |
Janeks 11-Aug-2006 [508x2] | That web server is hosting and I think that I can not access httpd.conf. Btw - where it resides? |
The web server service providers told/wrote that it is possible to run cgi scripts on this server. | |
older newer | first last |