not able to run cgi scripts.

Status
Not open for further replies.

carun

New Member
Messages
9
Reaction score
0
Points
0
i put few scripts in cgi-bin directory. Whenever I run them, I get the following:
Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@arun.x10hosting.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.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache/2.2.9 (Unix) mod_ssl/2.2.9 OpenSSL/0.9.8b mod_mono/1.9 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 Server at www.arun.x10hosting.com Port 80


What might be the problem. Should I configure my cPanel to run cgi-scripts?
 

Russ

<b>Retired *****</b>
Messages
3,168
Reaction score
2
Points
38
Go to the scripts in file manager, select them and click on change permissions at the top of the file manager, make sure they are set correctly, should be 755.
 

carun

New Member
Messages
9
Reaction score
0
Points
0
I have set the permissions as 755 only. But I am getting that error.:dunno:
Edit:
I also ran tested it with the apache server 1.3 installed in my machine. It works. I have uploaded the file in www/cgi-bin. Am I uploading it in the wrong place?
 
Last edited:

Corey

I Break Things
Staff member
Messages
34,551
Reaction score
204
Points
63
There is something wrong with whatever text editor you used to create that file. It has hidden characters in it.

I retyped your test file and named it test.pl, it now executes fine with an exact copy of your code.

http://arun.x10hosting.com/cgi-bin/test.pl

-Corey
 

carun

New Member
Messages
9
Reaction score
0
Points
0
Thank you! But I don't understand why the binary file print.cgi is showing up problems. Its a c program. The source code is

Code:
#include<stdio.h>

int main(){
	printf("Content-type: text/html\n\n");
	printf("<html><head></head><body>why is this</body></html>");
}

I have changed the permissions to 0755 for pring.cgi. Is it because my system using different byte ordering?
 

Corey

I Break Things
Staff member
Messages
34,551
Reaction score
204
Points
63
It's possible...

Are you copy & pasting the code in?
 

carun

New Member
Messages
9
Reaction score
0
Points
0
No. I compiled the c code to create the binary print.cgi. I used gcc compiler.

Source file : survey.c
Command used : gcc survey.c -o print.cgi

Then, I uploaded the print.cgi to cgi-bin and changed permissions to 0755.

I am using Windows XP (x86).

output produced when print.cgi was executed from command line:
Code:
C:\Documents and Settings\arun\My Documents\hosting>print.cgi
Content-type: text/html

<html>
<body>
<h1>Hello there!</h1>
</body>
</html>
 

Corey

I Break Things
Staff member
Messages
34,551
Reaction score
204
Points
63
Hmm, weird, we do use GCC locally on that server. It's been a while since I've worked with C or any other language besides PHP... is there an option to compile in a different format?
 

carun

New Member
Messages
9
Reaction score
0
Points
0
Yup it's weird. As far as I know, the only format is this. '-c' option will just compile without linking. But that wouldn't help anyway. As you said, I also find no need to use 'c' for that when it can be done much simpler with php. I found in a tutorial that 'c' can also be used for cgi. I was just trying things out :) Thanks :)
 

Corey

I Break Things
Staff member
Messages
34,551
Reaction score
204
Points
63
No problem, let me know if you have any other questions that I may be able to help with. PHP next time maybe? =P
 

tnl2k7

Banned
Messages
3,131
Reaction score
0
Points
0
Seeing as this got solved in the end I'll close it. Feel free to post back if you need support with anything else, we'll be happy to help :).

-Luke.

* Thread Closed *
 
Status
Not open for further replies.
Top