CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: General Discussions: General Questions:
How to get CGI script to run on host server

 



obrien135
Novice

Nov 14, 2012, 2:02 PM

Post #1 of 8 (13943 views)
How to get CGI script to run on host server Can't Post

Hello, I am new to perl CGI script writing. I wrote some code that is so simple that it has to work. Aside from the required lines at the top of the page, it's just a simple print statement. It was working but I think I made one of two mistakes:



Uploaded a copy from windows (server is a different operating system).



or,



Opened the file on the server for editing in the wrong file format (ascii insteatd of some required format).



I don't know how to get it back to normal. The webhost personnel corrected it for me once, but since they don't provide free web development, they told me to consult forums. Can anyone assist me with this problem?


FishMonger
Veteran / Moderator

Nov 14, 2012, 2:15 PM

Post #2 of 8 (13940 views)
Re: [obrien135] How to get CGI script to run on host server [In reply to] Can't Post

It would be helpful if you post the script and the error message from the webserver error log.

Based on the limited info you've given I'd guess that you uploaded the file in binary mode. You should upload in ascii mode especially when the OS of the 2 systems don't match.

If you have shell access to the server, you could use the dos2unix utility to convert the line endings from Windows to Unix. Or, you can re-upload the script in ascii mode.


obrien135
Novice

Nov 14, 2012, 2:42 PM

Post #3 of 8 (13936 views)
Re: [FishMonger] How to get CGI script to run on host server [In reply to] Can't Post

   

use CGI::Carp qw(fatalsToBrowser);

print "Content-type:text/html\r\n\r\n";

#my $i = 1;
#my $TheReq = "0";

#if($ENV{"REQUEST_METHOD"} eq 'GET')
#{ $TheReq = $ENV{"QUERY_STRING"}}
#else
#{ read(STDIN, $TheReq, $ENV{"CONTENT_LENGTH"})}

#open(OUT, '>>file.txt') || die "Couldn't open file.txt file, \n";#for($i = 1; $i <= 10; $i + 1){
#print OUT "$TheReq\n";
#print $TheReq;
print ("hi");
#}
#print $TheReq;



[Wed Nov 14 17:35:45 2012] [error] [client 75.22.163.197] File does not exist: /home/colpitts/public_html/500.shtml, referer: http://www.colpittsoscillator.com/
[Wed Nov 14 17:35:45 2012] [error] [client 75.22.163.197] (2)No such file or directory: exec of '/home/colpitts/public_html/cgi-bin/CGI_code.pl' failed, referer: http://www.colpittsoscillator.com/


obrien135
Novice

Nov 14, 2012, 2:47 PM

Post #4 of 8 (13931 views)
Re: [FishMonger] How to get CGI script to run on host server [In reply to] Can't Post

I posted the code and the errors. I also am wondering how do you select the type of format to upload in when uploading a cgi file in perl. Is there supposed to be a way to select it on the FTP? I haven't seen one. How would I make sure to upload in ascii or whatever the format is that is required?


FishMonger
Veteran / Moderator

Nov 14, 2012, 2:53 PM

Post #5 of 8 (13930 views)
Re: [obrien135] How to get CGI script to run on host server [In reply to] Can't Post

Did you re-upload it in ascii mode?

Is the script actually in the /home/colpitts/public_html/cgi-bin/ directory?

What are the permission settings?

Is the filename correct i.e., does it match exactly to what the error message indicates?


FishMonger
Veteran / Moderator

Nov 14, 2012, 2:54 PM

Post #6 of 8 (13929 views)
Re: [obrien135] How to get CGI script to run on host server [In reply to] Can't Post

What ftp client are you using?


obrien135
Novice

Nov 14, 2012, 3:20 PM

Post #7 of 8 (13926 views)
Re: [FishMonger] How to get CGI script to run on host server [In reply to] Can't Post

The answer to the first question is no, I haven't figured out how to upload it in ascii yet.



The next three are all yes.



The ftp client is the file manager on Host24.com webhosting service.



I just tried to run dos2unix which I downloaded from a website and then uploaded to the host swerver. But I can't get it to run. I tried to download the cgi file in question to my harddrive so I can run dos2unix on it there and then upload it again to the server, but I couldn't get it to download. It seemed like it did it but no sign of the file on the harddrive. Searched the whole thing.


FishMonger
Veteran / Moderator

Nov 15, 2012, 6:26 AM

Post #8 of 8 (13906 views)
Re: [obrien135] How to get CGI script to run on host server [In reply to] Can't Post


Quote
The ftp client is the file manager on Host24.com webhosting service.


Then you need to talk with them to find out how to use their file manager app.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives