Solved

Writing to a File on NT using CGI-PERL

Posted on 1998-11-30
6
194 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
Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

 

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Using a hta file with MSSQL agent to schedule a script job 4 51
Selecting Right Partition 6 82
List all Printers with anmes and Ip address 3 38
-OutVariable to Global 1 22
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

730 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