• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 232
  • Last Modified:

From Unix to Win 95 to Unix

I have download a working perl file with a .cgi ext and the .htm file that call the perl file.
I have chanch the name of the .cgi file but the ext is the same
I also change the name in the .htm file the same name as the .cgi file.
i also open the .cgi file with dos edit.
i upload the 2 files on the web on a unix server.
When i open the .htm file and try to run the .cgi file it dont want to run the .cgi file.
Will a .cgi program that is edit in dos edir work on a unix server and what must i do to let it work?
  • 3
1 Solution
Whats probably happening is when you open the .CGI file with dos edit and then resave it its saving it as a 'windows' textfile which have newline/carridge return pairs rather than just a newline (on a unix text file). The solution would be to edit the file in a text editor that will save text files as unix file type. Textpad (www.textpad.com) does this.
oops I forgot to say UNIX perl gets upset with newline/carridge return pairs and wont work.
> From: matthewallum Date: Thursday, September 03 1998 - 08:17AM PDT                      
 >    oops I forgot to say UNIX perl gets upset with newline/carridge return pairs and        
 >    wont work.

It's good that your forgot to say it.... it's flat out wrong.  perl in
unix, or any other os, treats both newlines and carriage returns in
scripts as white space, and completely ignores it.  You may feel free
to test this for yourself.

As for the original question, an answer that might indeed have some
effect is to check that the attributes of the new .cgi file include
the world executable bits.  If you have telnet or shell access to the

chmod +x file.cgi

where file is whatever the new name of your cgi program is.
Well the problem's definetly happed to me in the past.
Another thing to check is that your uploading the CGI file as text NOT Binary.

Before 5.004 newline and carriage returns were distinguished when looking for the end of a <<here string.

Does the script run from the command line?
What errors do you get running the script on unix?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

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.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now