Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying to make a basic form work with a perl cgi program

Status
Not open for further replies.

etweb

IS-IT--Management
Jan 15, 2003
1
AU
i got a program, and there are no errors, but when i put it on my online server, it never works. it will just say "server error". are there any comon problem here?
 
yup, there are.....

If you are writing your code on a DOS box and are then uploading/copying it to a UNIX box, then you need to do two things.

1 - make sure that you convert the code to have UNIX line endings. UNIX text files have '\n' line endings and DOS text files have '\n\r' endings. You must convert to the UNIX style if you are going to a UNIX box. Most ftp clients will let you do that on-the-fly.
2 - make sure you are setting the execute bits once the code is on the UNIX box. UNIX systems assign attributes to files as 'read, write, execute'. If the execute bits are not set, then the file will not run.
3 - be sure you are putting the code in a vailid 'cgi-bin' directory. Web servers will only execute a file if the file is in a predefined area as specified by the web server configuration.


On both DOS and UNIX servers,

1 - make sure that you have an appropriate first line in your code that points to the location of the perl interpreter on the box that is running the code. That may be (probably is) different on your box and on the server.

#!perl
or
#!/usr/local/bin/perl
or, something like that.


'Hope this helps.


keep the rudder amid ship and beware the odd typo
 
If you were running your script on windows system using one of the free win. server program.Beware, most of those program will allow you to print to browser without having a proper header. To play safe make sure you have a correct header. Use CGI.pm .... It make your life as perl programmer much easier. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top