Solved

Writing to a File on NT using CGI-PERL

Posted on 1998-11-30
6
191 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
How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

 

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
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.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

791 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