PDA

View Full Version : CGI problems


wicksy
03-20-2007, 01:28 PM
Hi all,
I am very new to cgi and perl and am struggling to debug a problem i'm having.
Basically i have been requested to update a website for a company that has previously been written by someone else that cannot be contacted.
What i thought i would do is download all the files from the current server and then upload them onto my university server where i can test and update the pages before putting them back onto the original server. But when i transferred them onto the new server and tried to run them i get a '500 internal server error'.
I have been through a lot of forums and i have checked that that #!/usr/bin/perl is correct and is on the first line which it is. I have also uploaded the cgi files as ascii and have set the file permission to 755.
What i don't understand is that it is exactly the same code that was the original server that worked fine.
I know that this is probably something really simple but cgi is still a bit over my head.
Also i have opened up the cgi files in notepad but they are unreadable. When i run this file i get an error saying "unrecognizeable character \x7F at content.cgi line 1. Would this be the problem??
Thankyou in advance to anyone who can provide me with some help.

cheers
wicksy

mlseim
03-20-2007, 02:46 PM
Have you tried running a simple Perl script like the infamous "Hello World"
script just to test out the cgi-bin?

Other than that, it sounds like some weird formatting characters are
getting in the files ... even though you transferred using ASCII.

You should be able to open them with Notepad and view them.

wicksy
03-20-2007, 03:39 PM
yeh ive tried using just a basic perl program but am still getting the 500 internal server error. As i said i didn't write the perl code. All i did was download it straight from one server and uploaded it on another server so i could change the files.
I've tried opening the content.cgi file in notepad, frontpage, textpad and wordpad and it all displays as binary basically.
Also i dont know whether this matters but the content.cgi file which is being called from the majority of the webpages is in a folder called scgi-bin.
The cgi-bin contains 2 cgi files called "entropybanner.cgi" and "randhtml.cgi", and 2 other files called cgiecho and cgiemail.
I have no idea what to do next but what i do know is the deadine for this webpage aint far away and i'm stressin out big time.. lol:(

KevinADC
03-20-2007, 06:55 PM
sounds like you downloaded the original files in binary mode instead of text. If you can download them again, make sure to downlaod all text files, including perl scripts, in ASCII (text) mode. Download any image files or other binary data in binary mode. Upload text files in ASCII mode and upoad images and other binary files in binary mode.

wicksy
03-21-2007, 12:45 AM
Tried that Kevin but still didn't work. Something i think i forgot to mention is that i can view and edit the files that are on the original server using cpanel. When i have viewed the content.cgi file there it doesnt make sense (binary) Also there are two cgi files - content.cgi and members.cgi and they both sit outside the cgi-bin directory. In the scgi-bin directory there are files called content.pl, content.pm, members.pl and member.pm. From reading around a bit i thought that the cgi file was supposed to contain the #! usr/bin/perl line however its the .pl files that contain this information. lol im so confused...sorry everyone for being a noob but basically i just wanna be able to fix this so i can start altering the webpage. All i really want to do is alter the look of the page whilst leaving the core of it still in place.
Is there any other information that would help you guys understand what i'm talking about??
cheers

KevinADC
03-21-2007, 04:59 PM
If you can't download the files in a sensible text format then you will have to convert them to text manually I guess. Attach one of the files to a post so we can see it.

FishMonger
03-21-2007, 06:19 PM
Since the files can only be viewed properly within the cpanel, then I'd say that there is some code in the cpanel that is somehow encryptind/decrypting the files.

Have you talked to your web hosts support people?