• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Reply to: cgi on Cobalt RaQ

Collapse

You are not logged in or you do not have permission to access this page. This could be due to one of several reasons:

  • You are not logged in. If you are already registered, fill in the form below to log in, or follow the "Sign Up" link to register a new account.
  • You may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
  • If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.

Previously on "cgi on Cobalt RaQ"

Collapse

  • Guest's Avatar
    Guest replied
    perl/cgi on UNIX, just like the old days
    sign...

    Leave a comment:


  • Guest's Avatar
    Guest replied
    Re: chown and chmod

    Ta guys - think I understand that!

    Leave a comment:


  • Guest's Avatar
    Guest replied
    chown and chmod

    chown and chmod change the file permission information on files.

    chmod changes the access rules to the file (who has read, write and execute access to the file). Permissions are set on three levels, the individual user who owns the file, the group of users that own the file and everyone else. Chmod 777 gives everyone read, write and execute access to a file chmod 400 gives the owner of the file (and only the owner of the file) read access only.

    Chown allows you to change the owner of the file. chown ben script.cgi changes the owner of script.cgi to the user ben (if he exists).

    For a script to run on unix (be it a cgi program or anything else you want to run) you need to ensure that the user who wants to run the file has executable rights to it (say by entering chmod 755 script.cgi on the command line).

    Furthermore there is a weird issue with the httpduser on cobalt and files owned by the admin / root users. The easiest solution I've used is to telnet or ssh into the server as admin, change user to root, create another user and chown any cgi scripts on the server to that user).

    Leave a comment:


  • Guest's Avatar
    Guest replied
    chown

    usage
    chown [:] filespec

    (bet the board screws that up)

    chown fredeople myfil*

    will change the files matching myfil* to be owned by user fred and the owning group set to people

    if the file was originally
    -rwxr-wr-w jon staff myfile1

    ls -l will then give
    -rwxr-xr-x fred people myfile1

    In this case I think eek is saying that the best user to own the scripts is user httpdthe and group httpddaemon (or vv)

    Leave a comment:


  • Guest's Avatar
    Guest replied
    Re: Its a permissions issue

    Eek - thanks very much for your comment, but being a complete ignoramus in this area I don't really understand what chowning the script or h..ding the h..daemon really means - can you elaborate a bit?

    Leave a comment:


  • Guest's Avatar
    Guest replied
    Its a permissions issue

    Cobalt treat the admin user as a junior root. Best solution is simply to chown the script to someone else (or httpdthe httpddaemon) and everything will be fine.

    Leave a comment:


  • Guest's Avatar
    Guest replied
    Re: Come on xogoth - we are all on tenterhooks !

    Mark - have had a bit of a fiddle but no joy yet.Have not really had much time due to work (ech!) - nothing much for weeks and now I've got a major re-write and full retest to do by yesterday - may actually earn a whole 2k this month at this rate! Will let you know when get back to it.

    Leave a comment:


  • Guest's Avatar
    Guest replied
    Come on xogoth - we are all on tenterhooks !

    Is it working yet - what was the problem ?

    Leave a comment:


  • Guest's Avatar
    Guest replied
    Re: RE:cgi on Cobalt RaQ

    curious, why would the file extension make any difference? Surely, this, as I pointed out already, is UNIX and the interpreter loaded is really going to depend on the shell magic ? And, I see that the cgi has the exec magic.

    Are you thinking of windoze and some weird file association thing from the registry?

    Leave a comment:


  • Guest's Avatar
    Guest replied
    RE:cgi on Cobalt RaQ

    Sorry about the previouse. Bugger, this technology


    Try swapping your script extensions

    PL > CGI or
    CGI > PL

    Leave a comment:


  • Guest's Avatar
    Guest replied
    HTML Comments are not allowed

    Leave a comment:


  • Guest's Avatar
    Guest replied
    "This is UNIX-like, and this "outdated and outclassed" technology actually has some security which has I understand has been removed from more modern technology in the interest of improved ease of use. "
    ah, i see!

    Leave a comment:


  • Guest's Avatar
    Guest replied
    It's a perfectly simple error message, the permission denied most likely refers to the web server not being able to read or execute the cgi script. I'd suggest you get a shell prompt up and look at the permission and set it to 555 or something similar. This is UNIX-like, and this "outdated and outclassed" technology actually has some security which has I understand has been removed from more modern technology in the interest of improved ease of use.

    Leave a comment:


  • Guest's Avatar
    Guest replied
    Ta guys - will give it a try.

    I'm using outdated technology??? it all seemed spiffingly new fangled to me, didn't even have to feed the paper tape in first.

    Leave a comment:


  • Guest's Avatar
    Guest replied
    I am not familiar with the raq - but most common problem with people writing cgi code is the lack of a http header. My guess is that in debug mode it puts a false header on to allow you to see all your headers ?

    HTML is the format of the output document, but the delivery mechanism is http, which provides a header which allows among other things errors, redirects etc.

    Typical format (Its about 4 years since I last did this - so forgive me if I am in error ) would be a response code 200 being OK (5xx are redirects, 4xx are errors, 2xx is it worked, plus others), protocol version and message then a mime content type, then a blank line followed by your output.

    So :

    200 HTTP/1.1 OK
    Content-type: text/html

    (HTML)
    (BODY)
    your current program output is everything from the (HTML) to the (/html) inclusive - using () because I dont thing ezboard allows html type tags in messages.
    for cgi it needs to also provide the header
    ...
    (/BODY)
    (/HTML)

    If you try doing a telnet to a web server on port 80 and type get index.html (return) you will see the header as well as the output.
    http has lots of other headers defined but I think that this is the absolute mimimum


    modify your code to do

    print "200 HTTP/1.1 OK\nContent-type: text/html\n\n"

    (actually might need \n\r - cant remember...)

    The header is interpreted by the web browser and allows it to decide how to process the following data stream. You might need a Content-length: header as well - but I think that is optional these days most browsers should just take what they get

    Leave a comment:

Working...
X