Mo El-Awaisi wrote:

> hi
>
> i have installed red hat 8 on my computer along with Apache, Perl/ MySQL and
> PHP. i am having problems getting PERL to work.
>
> i try to run the following script, but no luck:

I'd suggest you sort out your issues one at a time.  Do not test the performance of 
Perl on a new web server with an untested script.

Either:

Find a CGI script that has already been tested on an Apache server successfully.  Use 
this when evaluating your Perl installation.

Or

To test a new CGI script, use a server that is already successfully run Perl.  You may 
have to change ISPs to do this--preferably to a local, public, networking 
organization.  Just make sure that the web server is up and running Perl before you 
try to debug the CGI aspects of your script.

Testing two unknowns together is a recipe for frustration.

> #! /usr/bin/perl
> print "Content-type: text/plain\r\n\r\n";

Dump the "\r"s, as well as the spaqce after #!.  They are non-standard, and may be the 
source of the problem.  It's hard to say.  I don't know Apache or its configuration 
interface, and hand -coding the config for any application I did not write myself 
seems pretty chancy.  I do know that you should almost never have to use the 
carriage-return escape when writing Perl, and certainly never when writing web content.

The opening line of a CGI response, unless you, as a VERY experienced Perl programmer, 
know a specific reason to differ, is:
print "Content-type: text/html\n\n";
If you must send as plain text [and why are you using the CGI for that?] then use 
text/plain instead of test/html.  Even so, do not gum up the critical format of the 
CGI header with illegal characters.

Likewise, your script header should always be:
#!/usr/bin/perl -w
Unless you know for a certainty that there is some reason why this won't work. For 
instance, the Perl executable on my prior Win 2000 system was 
F:\Perl\bin\perl5.6.1.exe.  That was not sufficient reason to vary from the standard.  
I didn't need to.  Windows knows where to find the application to run Perl scripts, 
and it totally ignores the path.

Make your script and CGI headers conform to standards.  Even if it means re-installing 
Perl, it would quickly pay for itself by making your code more portable.

Joseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to