Problem with "Cgi-script"

I tried again and i said too many arguments...whta does it mean ? and the same thing came up on the execute thing
 
i also cannot get cgi to load the perl script. here is the error from the server error log.

Code:
[Sat May  4 12:44:46 2002] [error] (2)No such file or directory: exec of /Library/WebServer/CGI-Executables/eforms.cgi failed
[Sat May  4 12:44:46 2002] [error] [client 127.0.0.1] Premature end of script headers: /Library/WebServer/CGI-Executables/eforms.cgi

i don t understand what you re saying... the printenv script didn t work? you couldn t make it executable? the file wasn t there? what do you mean?
 
I don´t know if its good but its working maby my script will work?...but if it din´t work for it shouldn´t for me:confused: but what does the printenv do? it stands...now i tested my script but that didn´t work....maby i should try another one...do you now any site? but do i have to make all the scripts i want to use executable ? i dont know what it means in swedish?
 
I saw a thread in the macosx forum about perl and it stood this to make a program executable:


sudo chmod +x /Library/WebServer/CGI-Executables/eforms.cgi
 
yes, chmod +x is an alternate way to make a file executable.

i don t know any swedish, so i can t tell you what it means, but yes, every script must be made executable before it will run. perhaps a swedish-english dictionary?

an executable file is just a file that can be run like a program. if that makes any sense...

anyway, i added a newline in your script after the first line #!/usr/bin/perl, and then it worked for me. i posted it back up.
 
yup. i saw that error. also, if i went directly to the cgi script at http://217.208.118.177/cgi-bin/eforms.cgi
i got the error: invalid email address.

however, both times the page i saw was html which came out of the script, which means that your web server is working and executing the cgi script correctly.

the perl script is a little bit too long for me to want to go through it and figure out why it isn t emailing you the data. you should get help from the guy who wrote the script for that. or maybe someone here will want to debug this script for you.
 
So if i have an already clean and working script all i have to do is to make it executable and then but i in the cgi-executables map ant the html page on my Documents map in the webserver map:D ? hope so now im going to try another who is maby working ....by the way do you know any site with good cgi-scripts? ....Thanx for all help and support!:)
 
yes, your summary is correct. make it executable, and put it in the cgi directory, is all that is required to make a working cgi script.

an email script is a little complicated. you will notice that your script, near the top, asks you to either define an smtp host, or define the location of sendmail, but not both. you have defined both. this might be causing the script to break.


i do not know of any sites to download cgi scripts. you might be better served if you found a place that made scripts specifically for OSX. best yet would be to do it yourself.
 
Now i have run the coomadn olus executed it and then this is comming:


Error : Cannot write to file : Permission denied

now what and i took the line with $mail_path beacause i could use only one and thats tge SMTP...Please help.. :rolleyes:
 
it s about time you showed up, testuser! i was running out of answers.

by the way, how did you spot the DOS text formatting issue? good call.

does OSX use the same line endings as unix? i was under the impression that classic macos used a different convention from both dos and unix, but i don t really remember.
 
Know wen i made the email.db that store all the mail or what it was . Can the cgi really locate it in the shared map in the user directory i got this message during the email form...or exactly when i pressed the post button:

Error : Communication error : Reason Bad file descriptor

will i ever make som cgi script work:confused:
 
the same problem still excists:( i´ll just have to find a good site for cgi scripts for mac osx ...any suggestions?
 
First, download the attached perl script and place in your cgi-bin. Make it executable and try to connect to it with your browser. Don't worry it is nothing more than a simple hello world script. Read it if you like. This script does nothing more than run an html page with "Hello World!!" coded in the body.

Let me know what happens when you try to connect. Because when I tried to run this .pl script from my cgi-bin, I got an internal error like yours. However, if I ran it as a .cgi script, no problem. I then added the handlertype .pl in my httpd.conf file and the .pl script worked. Don't know why but it works now. So you may want to find the line:
AddHandler cgi-script .cgi

and add the following line right after it:
AddHandler cgi-script .pl

Then stop and restart Apache. Please make sure these lines are NOT commented out.

If this basic script does not work, then something else is broke in either Apache or Perl.

Be sure to change the .txt extension to .pl on the attached script and make it executable.

Good Luck.:)
SA
 

Attachments

  • hello.txt
    229 bytes · Views: 7
I got an internal server error . But how can i ad that line you whrote and into wich file? please tell me...That must be the problem because the ending .cgi on the hello script worked fine for me
 
This means that your Apache server is set to run .cgi scripts. We can do one of two things here:
1. Probably the simplest, is to run .cgi scripts only.
2. The next idea would be to change your httpd.conf file located in /etc/httpd. This file is a root file so you will have to edit through sudo.(ie. sudo vi somefilename) Search your .conf file for the line I mentioned in the previous post. All you have to do is the file handler for .pl like I mentioned in the previous post, save it, and restart Apache in your System Preferences. This worked for me, so I imagine it will work on your system.

The only other issue you would have is as Testuser mentioned. If your perl script is meant for Dos, you will have to change the line endings for Unix and the directory paths for Unix. Directory structure in DOS is a whole lot different than Unix.

Give this a go. You really should peruse the Apache documentation before hand so you don't break anything.

Good Luck.:)

SA
 
So the only problem is to download a unix (mac osx) friendly script. So do you now any sites offering cgi/perl scripts? I would like to have a good one with many scripts :) Because i haven´t found any by myself:rolleyes:
 
Hi TestUser,

That may be but, it does not explain why he and I both got an error running the .pl script from the cgi-bin, while the same script worked fine with a .cgi extension and run from the cgi-bin. Why would this be? It is nothing more than a simple Hello, World script.

Thanks.:)
SA
 
While I'm thinking of it. Does this mean that the AddHandler for .cgi should be commented out also? I thought, if you did this .cgi scripts would not run in Apache. Maybe I'm wrong, If so please lead me down the correct path here.

Thanks.:)
SA
 
Back
Top