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?
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.
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.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.