perl/cgi on UNIX, just like the old days
sign...
- 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.
Logging in...
Previously on "cgi on Cobalt RaQ"
Collapse
-
Guest replied
-
Guest repliedRe: chown and chmod
Ta guys - think I understand that!
Leave a comment:
-
Guest repliedchown 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 repliedchown
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 repliedRe: 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 repliedIts 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 repliedRe: 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 repliedCome on xogoth - we are all on tenterhooks !
Is it working yet - what was the problem ?
Leave a comment:
-
Guest repliedRe: 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 repliedRE: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 repliedHTML Comments are not allowed
Leave a comment:
-
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 repliedIt'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 repliedTa 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 repliedI 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:
- Home
- News & Features
- First Timers
- IR35 / S660 / BN66
- Employee Benefit Trusts
- Agency Workers Regulations
- MSC Legislation
- Limited Companies
- Dividends
- Umbrella Company
- VAT / Flat Rate VAT
- Job News & Guides
- Money News & Guides
- Guide to Contracts
- Successful Contracting
- Contracting Overseas
- Contractor Calculators
- MVL
- Contractor Expenses
Advertisers
Contractor Services
CUK News
- Streamline Your Retirement with iSIPP: A Solution for Contractor Pensions Sep 1 09:13
- Making the most of pension lump sums: overview for contractors Sep 1 08:36
- Umbrella company tribunal cases are opening up; are your wages subject to unlawful deductions, too? Aug 31 08:38
- Contractors, relabelling 'labour' as 'services' to appear 'fully contracted out' won't dupe IR35 inspectors Aug 31 08:30
- How often does HMRC check tax returns? Aug 30 08:27
- Work-life balance as an IT contractor: 5 top tips from a tech recruiter Aug 30 08:20
- Autumn Statement 2023 tipped to prioritise mental health, in a boost for UK workplaces Aug 29 08:33
- Final reminder for contractors to respond to the umbrella consultation (closing today) Aug 29 08:09
- Top 5 most in demand cyber security contract roles Aug 25 08:38
- Changes to the right to request flexible working are incoming, but how will contractors be affected? Aug 24 08:25
Leave a comment: