# cgi script



## osxmatrix (Dec 26, 2002)

hallo,
can someone help me?

I can't execute script!
I put my cgi script in CGI-Executables folders. I chmod 755 and I used Explorer --> http://127.0.0.1/cgi-bin/perl_test.cgi.

this is what appear:

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

Please contact the server administrator, [no address given] 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.


So I opened error_log:

[Thu Dec 26 12:15:17 2002] [error] (2)No such file or directory: exec of /Library/WebServer/CGI-Executables/perl_test.cgi failed
[Thu Dec 26 12:15:17 2002] [error] [client 127.0.0.1] Premature end of script headers: /Library/WebServer/CGI-Executables/perl_test.cgi

My script path is ok (/usr/bin/perl) and it works fine on solaris machine.

NOW:
I know that OsX is already configured to run cgi script, so what's happening!
My Mac runs OsX 10.2.3 client. Must I use OsX server for this?

I'm sure you can help me

Thanks in advance


----------



## osxmatrix (Dec 26, 2002)

I solved my problem:

change the line break to UNIX using BBEdit!!

I hope this will be useful for someone!


----------



## TommyWillB (Dec 26, 2002)

Since we are in the Darwin forum I have to ask this question...

Isn't there some easy way to make Unix programs able to handle Mac line breaks natively? Isn't there some what to build this into Perl, vi, etc...?

If Apple were doing thier job we would not even need to know that Mac and Unix (and PeeCee) line breaks are all different.

Even my Mom using Dreamweaver (she'd doing our family tree online) has run into this, and I have to tell you it is VERY hard to explain something like this too a "user" like her...


----------



## hannibal (Feb 6, 2003)

I have exactly the same problem, exept, I can't solve the problem with the unix-linebreaks.

Now I don't have any idea, how to get my pl's working.

Maby you?
Thanks


----------



## jwalk76 (Feb 6, 2003)

hannibal,

a common error when writing CGI scripts for the web is to forget to print the header...and it must be the first thing the program outputs.

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

there are modules that are better suited for printing headers, but the previous line will suffice.


----------



## symphonix (Feb 6, 2003)

Make sure your perl script is executable, by using the "chmod a+x myscript.cgi" command.

Then, test it from the command line by calling "perl myscript.cgi"

I've never encountered line-break trouble editing in pico, but obviously that can be an issue.


----------



## hannibal (Feb 9, 2003)

Thank you,

I mostly use: chmod 755 and it work also.

With the Unix-linebreak it works too.
But it's strange to habe linebreakincompatibilities on the same computer, isn't it?
With OSX I have problems, I never had before.

ciao and greetings from Berlin


----------



## TommyWillB (Feb 9, 2003)

> _Originally posted by hannibal _
> *But it's strange to habe linebreakincompatibilities on the same computer, isn't it?...*


 Yes!

Apple ought to "fix" this so that it is invisible to us... But to do that they'd have to go in an "fix" all of those old unix cli tools like pico/vi/perl/etc...

I think one of the reasons I'm liking PHP so much more than Perl is simply because you do not have to deal with this stuff...


----------



## hannibal (Feb 9, 2003)

since I have OSX I thougt all will be easy - now and for ever
But now I think I have the same problems like PC-Users.

i.e. the integrated Python in OSX. It is in a invesible Folder and for me its impossible to install new modules, because of serveral reasons. But in Python its essential to have the possibility to do this.
So I search Apple Knowledbase and found nothing about this.
I can't understand politict like that.

(pardon for my broken english)


----------



## TommyWillB (Feb 9, 2003)

You can use TinkerTool (Look on Version Tracker) and some others to control GUI folder visibility...


----------

