Gossamer Forum
Home : General : Perl Programming :

move cgi.pm script to host with mod_perl

Quote Reply
move cgi.pm script to host with mod_perl
hi ,
moving to a new web host who has mod_perl.
As you can guess I have little idea about mod_perl although I was just starting to get the hang of perl and cgi.

My script worked fine on the old server although on the new it returns error 500 premature end script headers

I ran the file from the command line in putty (perl filename.pl) and it outputs as expected.

checked syntax (perl -c filename.pl) syntax ok. Have also saved the files in unix format(for the correct line endings) and uploaded to server using ascii.

What changes do I need to make for this file to execute.
(its a fairly simple prog that recieves data from a html form,emails me those details and responds to the user with a confirmation page) I shall attatch the file.

mod_perl gurus your help is greatly appreciated.
regards
rex
Quote Reply
Re: [rexona] move cgi.pm script to host with mod_perl In reply to
You should be able to just use;

print $query->header();

CGI.pm automatically assumes that you are going to print a text/html document, unless otherwise specified.

Not sure if that will fix your problem though. ... but its worth a try :)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] move cgi.pm script to host with mod_perl In reply to
cheeeers Andy,
Made the change to print $query->header(); ,unfortunatley same result...

cheeers , i'll keeep trying!
Quote Reply
Re: [rexona] move cgi.pm script to host with mod_perl In reply to
If you turn mod_perl off, and run it again ... does it work?

This page may help;

http://stein.cshl.org/...ftware/CGI/#mod_perl

Code:
#!/usr/bin/perl
use CGI::Apache qw(:standard);

print header,
start_html("CGI Script"),
h1("CGI Script"),
"Not much to see here",
hr,
address(a({href=>'/'},"home page"),
end_html;
}

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] move cgi.pm script to host with mod_perl In reply to
cheers again,
uploaded that snippet of code and still same prob,im wonderous about this server!!

How do i turn mod_perl off/on?

I'll do some research on that page you suggest , cheers.

cheers
Quote Reply
Re: [rexona] move cgi.pm script to host with mod_perl In reply to
Quote:
uploaded that snippet of code and still same prob,im wonderous about this server!!

Do you mind me asking who your server is hosted with? May shed so light / be able to warn you away (I've used my fair share of "bad" hosts Unimpressed).

Quote:
How do i turn mod_perl off/on?

Normally you can do it in the admin panel of your site; but not all servers have this functionality, and you have to manually edit the config files, to get mod_perl to turn off Frown

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] move cgi.pm script to host with mod_perl In reply to
the host is smarty host, theyve told me to consult a website designer!!!!
They said if permissions were correct the file was uploaded with ascii and correct paths are used its out of there hands which i guess is fair.
Quote Reply
Re: [rexona] move cgi.pm script to host with mod_perl In reply to
Did you definatly upload it in ASCII mode? Also, is the path to Perl correct? (running from Telnet won't matter, as the "perl" command tells the server where perl is located anyway, so it ignores the #!/usr/bin/perl, or similar, in your script).

Different variations I've seen are;

#!/usr/bin/perl
#!/usr/bin/perl5
#!/usr/local/bin/perl
#!/usr/local/bin/perl5

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] move cgi.pm script to host with mod_perl In reply to
tks Andy,
this is what I have done
Shebang is !#/usr/bin/perl as instructed.
Wrote file in textpad, saved in unix format- ansii.(in textpad).
Uploaded file via ws_ftp set to ascii mode into the cgi-bin.
Set the link to the site www.mygoldcoastlimo.com/cgi-bin/limo-booking.cgi
error 5oo premature end of scrip headers
Opened Putty
/usr/bin/perl limo-booking.cgi
will display headers and the output including tags to the console
/usr/bin/perl -c limo-booking.cgi
displays 'syntax ok'

Does this give any more clues as too what i may be doing wrong?
cheeers
Quote Reply
Re: [rexona] move cgi.pm script to host with mod_perl In reply to
Send over FTP details and a URL if you want, and I'll take a quick look. Don't have time really to write long PM's back I'm afraid :(

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [rexona] move cgi.pm script to host with mod_perl In reply to
Fixed.

Your mainwebsite_cgi folder was CHMOD 777 Tongue (in case anyone has a similar problem in the future, and comes across this thread).

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] move cgi.pm script to host with mod_perl In reply to
cheers Andy,
thanks for the lengths you went to to check that out for me , greatly appreciated.

cheers again
Rex