Solved

Writing to a File on NT using CGI-PERL

Posted on 1998-11-30
6
177 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 your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now