The macosxhints Forums

The macosxhints Forums (http://hintsforums.macworld.com/index.php)
-   Applications (http://hintsforums.macworld.com/forumdisplay.php?f=5)
-   -   netinfo question (http://hintsforums.macworld.com/showthread.php?t=19612)

drone540 08-24-2004 03:53 PM

Here is the contents.

Code:

#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "<H1>Hello World</H1>\n";


Also but this file doesn't even do anything in the terminal
Code:

[jpowermac-g4s-Computer:~] powermac% perl /WebSTAR\ Server\ Suite\ 4.3/cgi-bin/helloworld.cgi
[jpowermac-g4s-Computer:~] powermac% perl /WebSTAR\ Server\ Suite\ 4.3/cgi-bin/helloworld.pl
[jpowermac-g4s-Computer:~] powermac%

but lets say I try this perl_test.pl I get from the terminal

Code:

[jpowermac-g4s-Computer:~] powermac% perl /WebSTAR\ Server\ Suite\ 4.3/cgi-bin/perl_test.pl
Content-type: text/html


<html>
<head>
<title>Ikonboard Path and Environment Test</title>
<style>
BODY          {font: 10pt arial}
#red          {font: 10pt arial;color:red;font-weight:bold}
#bold        {font: 10pt arial;font-weight:bold}
#version      {font: 10pt arial;color:blue;font-weight:bold}
TABLE, TR, TD {font: 10pt arial;font-weight:bold}
#error        {font: 10pt arial;background:#EEEEEE;border:1px solid black; padding-top: 8px; padding-right: 8px; padding-bottom: 8px; padding-left: 8px; text-indent: 8pt}
#plain        {font: 10pt arial}
</style>
</head>
<body>
<center><h4>Ikonboard Path and Environment Test</h4></center>
<p>This script checks your paths and environment variables and prints the results based on its best information available.

<hr noshade>
<br><br><a id="bold">The absolute path to this script is: </a><a id="red">/Users/powermac</a>, on a <a id=red>Unknown</a> based platform.
<br><a id="bold">This server is running perl version: </a><a id="version">5.008001</a>.
<br><a id="bold">DOCUMENT_ROOT: </a><a id="red"></a>.
<br><a id="bold">CGI Version: </a><a id="version">2.98</a>
<br><br>

<table>
<tr><td>Has DB_File Perl module installed?</td><td>Yes</td></tr>
<tr><td>Has CGI Perl module installed?</td><td>Yes</td></tr>
<tr><td>Has DBI Perl module installed?</td><td>Yes</td></tr>
<tr><td>Has DBD-Mysql Perl module installed?</td><td>No</td></tr>
</table>

<br><div id="error"><b>Results:</b>
<br><br></div><br><br><b>Environment:</b>
<br><br>
<table>
<tr><td>$ENV{MACHTYPE}:</td><td id="plain">powerpc</td></tr>
<tr><td>$ENV{SHELL}:</td><td id="plain">/bin/bash</td></tr>
<tr><td>$ENV{OSTYPE}:</td><td id="plain">darwin</td></tr>
<tr><td>$ENV{SHLVL}:</td><td id="plain">1</td></tr>
<tr><td>$ENV{TERM_PROGRAM_VERSION}:</td><td id="plain">100</td></tr>
<tr><td>$ENV{VENDOR}:</td><td id="plain">apple</td></tr>
<tr><td>$ENV{PATH}:</td><td id="plain">/bin:/sbin:/usr/bin:/usr/sbin</td></tr>
<tr><td>$ENV{HOME}:</td><td id="plain">/Users/powermac</td></tr>
<tr><td>$ENV{USER}:</td><td id="plain">powermac</td></tr>
<tr><td>$ENV{SECURITYSESSIONID}:</td><td id="plain">3b23260</td></tr>
<tr><td>$ENV{TERM_PROGRAM}:</td><td id="plain">Apple_Terminal</td></tr>
<tr><td>$ENV{__CF_USER_TEXT_ENCODING}:</td><td id="plain">0x1F5:0:0</td></tr>
<tr><td>$ENV{TERM}:</td><td id="plain">xterm-color</td></tr>
<tr><td>$ENV{HOSTTYPE}:</td><td id="plain">powermac</td></tr>
<tr><td>$ENV{HOST}:</td><td id="plain">jpowermac-g4s-Computer.local</td></tr>
<tr><td>$ENV{GROUP}:</td><td id="plain">powermac</td></tr>
<tr><td>$ENV{PWD}:</td><td id="plain">/Users/powermac</td></tr>
<tr><td>$ENV{LOGNAME}:</td><td id="plain">powermac</td></tr>
</table><br>
<b>Include Path:
</b>
<br><ul><li>/System/Library/Perl/5.8.1/darwin-thread-multi-2level</li>
<li>/System/Library/Perl/5.8.1</li>
<li>/Library/Perl/5.8.1/darwin-thread-multi-2level</li>
<li>/Library/Perl/5.8.1</li>
<li>/Library/Perl</li>
<li>/Network/Library/Perl/5.8.1/darwin-thread-multi-2level</li>
<li>/Network/Library/Perl/5.8.1</li>
<li>/Network/Library/Perl</li>
<li>.</li>

<br><br><center><font size=1>Version 1.0a
<br>&copy; 2002 Luke Dawson for <a href=http://www.ikonboard.com>Ikonboard</a> and <a href=http://www.jarvisgroup.net>Jarvis Entertainment Group</a></font></center>
</body>
</html>
[jpowermac-g4s-Computer:~] powermac%

But when I run it thru webserver I get...

Code:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator,  myemail@hotmail.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.


Apache/1.3.29 Server at www.jpowermacg4.com Port 80

Error log shows:
Code:

[Tue Aug 24 15:50:22 2004] [error] (2)No such file or directory: exec of /WebSTAR Server Suite 4.3/cgi-bin/perl_test.pl failed
[Tue Aug 24 15:50:22 2004] [error] [client 192.168.1.1] Premature end of script headers: /WebSTAR Server Suite 4.3/cgi-bin/perl_test.pl

Access log shows:
Code:

192.168.1.1 - - [24/Aug/2004:15:50:22 -0400] "GET /cgi-bin/perl_test.pl HTTP/1.1" 500 619 "-" "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-us) AppleWebKit/125.4 (KHTML, like Gecko) Safari/125.9"

hayne 08-24-2004 05:20 PM

Quote:

Originally Posted by drone540
Here is the contents.

Code:

#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "<H1>Hello World</H1>\n";

Also but this file doesn't even do anything in the terminal

Ah - I think I know what your problem is.
I think your script files have "Macintosh" line endings instead of "Unix" line endings. This can happen if you choose the wrong editor to create your scripts. Which text editor have you been using?

To fix things, open the file in an editor that is able to handle a variety of line-endings and re-save it with Unix line endings. One such editor is BBedit Lite. Another is SubEthaEdit.

If you open your current script files in 'pico' (in the Terminal, type: pico helloworld.cgi) you should see that the lines are screwed up.

honestpuck 08-24-2004 07:35 PM

Hi,

I've just had a quick read of this thread and my first thought was to wonder if the CGI handler in the web server is barfing at the spaces in the directory you are using. Does the awstats script you mention live in the same directory?

I'd recommend against having your CGI directory under your DocumentRoot, BTW. It's a major security concern.

Tony

honestpuck 08-24-2004 07:53 PM

OK, I've had a better look at your Apache config.

My suggestion would be to move your CGI files to /Library/WebServer/CGI-Executables and change the script alias back to the default of this directory.

Given your current setup this has three advantages.

1/ It gets rid of the suspect spaces in the path. Note that the awstats script that you say is working lives in a directory with no spaces in its path.

2/ It moves your CGI directory out from under your DocumentRoot

3/ It removes the possibility that the problem is the way you are script aliasing a directory back to itself. At the moment the real URL of your CGI directory is exactly the same as the one you are applying via the scriptalias command - making it a waste of time and perhaps a source of error inside Apache.

Oh, and while you are at it - have a serious think about moving your DocumentRoot to a path that doesn't have spaces. It is almost certain to cause you problems further down the track.

Tony

drone540 08-25-2004 12:24 AM

Awww just when I though you were onto something andt it was going to work.. still doesn't work

Code:

[Wed Aug 25 00:21:48 2004] [notice] Apache/1.3.29 (Darwin) PHP/4.3.2 mod_perl/1.26 configured -- resuming normal operations
[Wed Aug 25 00:21:48 2004] [notice] Accept mutex: flock (Default: flock)
[Wed Aug 25 00:21:52 2004] [error] (2)No such file or directory: exec of /Library/WebServer/CGI-Executables/helloworld.cgi failed
[Wed Aug 25 00:21:52 2004] [error] [client 192.168.1.1] Premature end of script headers: /Library/WebServer/CGI-Executables/helloworld.cgi
[Wed Aug 25 00:21:53 2004] [error] (2)No such file or directory: exec of /Library/WebServer/CGI-Executables/helloworld.cgi failed
[Wed Aug 25 00:21:53 2004] [error] [client 192.168.1.1] Premature end of script headers: /Library/WebServer/CGI-Executables/helloworld.cgi

Same thing for test.pl also....



and also.. awstats.pl works in my older directory (no aliases) with space.... but nothing else works.... not even copying that data into another file, or modifying the awstats file.

honestpuck 08-25-2004 01:04 AM

Hmmmm.

OK. Try fixing the line ends - that should improve things.

Then check where perl is installed :

ls -l /usr/bin/perl

should give you a result

-rwxr-xr-x 1 root wheel 19944 28 May 08:53 /usr/bin/perl

and just in case make sure that the line

<Directory "/Library/WebServer/CGI-Executables">

says exactly that with no trailing slash.

Also, to be totally on the safe side, turn off mod_perl by commenting out both the LoadModule and AddModule lines that mention it.

Then tell us what happened.

Tony

drone540 08-25-2004 01:12 PM

Code:

[jpowermac-g4s-Computer:~] powermac% ls -l /usr/bin/perl
-rwxr-xr-x  1 root  wheel  19944 15 Jul 00:24 /usr/bin/perl

Ok and turning off perl.. I still get 500 internal server errors.

I did not comment out the cgi-script .cgi .pl line since that doesn't use perl I don't think... and when I used the commented line below it.. perl-script .cgi .pl it just prints out the text of the file.... Not sure how ASP makes use of perl.

But yeah.. the problem has to do with something with cgi-script.

hayne 08-25-2004 03:01 PM

Please check the line-endings in your script files as I suggested a few posts back. The fact that your Perl script didn't work from the command-line strongly suggests that this is the problem.

drone540 08-26-2004 02:25 AM

it still doesn't work.. plus test.pl executes from terminal.. but it doesn't work in browser... still error 500..... jeez... It's never gonna work... it seems to choke on the cgi-script handler.... Also... With WebSTAR V.. I get errors with cgi files also (not sure which since no errors folder exists.. most likely 500 still.... and it has its own cgi plug-in. :( :confused: :eek: :mad:

drone540 08-31-2004 11:39 PM

Anyone know?


All times are GMT -5. The time now is 02:26 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.