Solved

Writing to a File on NT using CGI-PERL

Posted on 1998-11-30
6
186 Views
Last Modified: 2013-12-25
I am trying to get a cgi perl script to run on an NT Server which was previously used with a unix box. The problem that I am having is trying to write some sample data to a temporary file, which is then used by a program and outputs the proper output.

This worked fine under UNIX, but I am having problems even writing to the file through the cgi-script. So basically whatever is in the temporary file before the script is running is then outputed to the html page. I was wondering if there is a way to do this in NT?

Any help is appreciated

Quinn Liddicoat
qoliddic@gulf.uvic.ca
0
Comment
Question by:qoliddic
6 Comments
 

Author Comment

by:qoliddic
ID: 1829831
Edited text of question
0
 
LVL 1

Expert Comment

by:squimph
ID: 1829832
Can you be more specific what you mean by "problems"? What error message does your script get? When does happen... when opening the file for writing, or when actually trying to write to the file? What is in the $! and $? variables in perl after the error occurs?
0
 
LVL 11

Expert Comment

by:mouatts
ID: 1829833
I don't know what version of PERL you are using but the best one for NT is available from www.ActiveState.com (as I've said in a previous answer I have nothing to do with this company).

With this you should be able to run the CGI script unaltered including the use of forward slashes (yes on NT).

I have ported a number of systems from Unix to NT using this version and have had no major problems.

Steve
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

Author Comment

by:qoliddic
ID: 1829834
There is no error message that prints out, just the unaltered data, and sometimes the process will run rampent across the server taking up cpu space, and the temp file will still unchanged.

I alreday have active state installed, but I will try the original script and see what happens.

Thanks for your comments
0
 
LVL 8

Accepted Solution

by:
shlomoy earned 100 total points
ID: 1829835
I'd check the permissions on the files you want to alter.
the have to have read/write/execute permissions for user/group/other

use the following on the filr you want to alter (from the command prompt):

$ chmod 777 yourFile.

now - assumming that was your problem - this should do the trick.

I'd also make sure that the directory which holds that altered file has 777 permissions too.

if you're wondering why - it's because your CGI runs as user "nobody" - and so it needs to have permission to alter files (to be exact - the files need to have permissions).
You could run it as a unix user because it was your script and there were your files - so no permissions problem here. but as soon as you're running it as a CGI - it's not you who runs it but user nobody.
0
 

Author Comment

by:qoliddic
ID: 1829836
Well figured, what i was doing wrong, thanks for all your help though. The problem was with the path of the file in NT
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most of the sites are being standardized with W3C Web Standards. W3C provides lot of web standard services to the web. They have the web specification, process and documentation for all the web standards. You can apply HTML, CSS and Accessibility st…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question