cgi execute problem

Status
Not open for further replies.

Mooseman

New Member
Messages
89
Reaction score
0
Points
0
Hello ,)
I am new here at x10, and I have read through some posts concerning cgi errors, but I still cannot
manage to solve my own problem.

I have a cgi file that wont execute, I get a 500 error on this file
http://mbp.exofire.net/cgi-bin/installer.cgi

I have tried CHMOD both 755 and 777, but no luck so far.

My username is mooseman

Is there anyone who can guide me in the right direction, or help me out ??
I am not experienced in cgi, so I am afraid my knowledge is close to zero :dunno:
 

DefecTalisman

Community Advocate
Community Support
Messages
4,148
Reaction score
5
Points
38
If the script is written in Perl, try changing the extension on the file to .pl. No one wants to listen to me on this. I have tried identical scripts for both these extensions and the .pl is the only one that worked.

The only perl script I could get to work with .cgi was:

Code:
#!usr/bin/perl

my $hat = "Hello";

print "$hat, wolrd";

The second I brought in:
Code:
$file = 'examples/text.txt';

open(FILE01,  ">>$file");
    print FILE01"$hat";
 close(FILE01);

It returned as a 500 error.
Edit:
Another thing, its amazing how many perl scripts out there gave undefeined variables. I am not sure if some servers are more leaniant towards scripts and variables. but this one is "strict". Thus using "use strict" will help you alot when checking syntax.
 
Last edited:

Mooseman

New Member
Messages
89
Reaction score
0
Points
0
If the script is written in Perl, try changing the extension on the file to .pl. No one wants to listen to me on this. I have tried identical scripts for both these extensions and the .pl is the only one that worked.


Hi ;)
I tried this, but still no luck, same errors occuring...
 

DefecTalisman

Community Advocate
Community Support
Messages
4,148
Reaction score
5
Points
38
hmm... there was another chap complaining he couldn't run cgi scripts in the bin, yet he could outside of it.

Maybe the server was configured wrong...

I am on ciroc and things work fine for me...

What script are you trying to run?
 

Mooseman

New Member
Messages
89
Reaction score
0
Points
0
It is an IkonForum installation script, and it doesnt work outside the bin either.
 

DefecTalisman

Community Advocate
Community Support
Messages
4,148
Reaction score
5
Points
38
Is the script in Perl?

If so you could download a syntax checker.

SciTE Source Code Editor, is great for perl. I have tried a few different editors and ended up using this for the last few versions.

Open up the scripts in the editor (allows multiple files open with tabs bar).

just after the "#!usr/bin/perl", put the following:
Code:
use strict;

Then under tools run, check syntax or press "ctrl+1" on the keyboard and wait and see what errors the script throws out.

If you see "script name".pl/cgi had compilation errors, then no doubt it wont work. If all that pops up is "explicit package requiers..."."$something/@something/%something" then these are undefined variables. This doesn't mean they have fallen out of scope though.

This could be solved by the following:

Code:
#!usr/bin/perl

......

my($something,$something_else);
my(@something,@something_else);
my(%something,%something_else);
# put these near the top, after your modules.
# They are now defined and when checking the syntax, should not show as an error
(doing this to a script that is over 500 lines or multiple scripts can be taxing though)

If it comes up clean, then it must be the server or a specific module that the script uses that isn't on the server. Most well written perl scripts will put this at the top.

Code:
#!/usr/bin/perl

# these are how modules are defined.
use strict;
use tk;
use cgi;
use URL::URI;

.....
 

Mooseman

New Member
Messages
89
Reaction score
0
Points
0
I downloaded the Scintilla editor and ran the file.
I got this message :

>perl -cw installer.cgi
System cannot find this file.


At the very beginning of this file, I have this :
#!/usr/bin/perl
package iF;
use strict;


I am very sorry, but I am not familiar with perl, so I have no idea what may be wrong...
 

DefecTalisman

Community Advocate
Community Support
Messages
4,148
Reaction score
5
Points
38
Please change the extension from *.cgi to *.pl.
Edit:
Then it will find the file(i think).
Edit:
Scintilla does syntax checking on many languages. It picks up what rules to use via the file extension.

Else you could try and force it to read it as perl by clicking language and then select pl(Perl)
Edit:
you could even try this:

Code:
#usr/bin/perl -w

this tells perl to use warnings.
 
Last edited:

Mooseman

New Member
Messages
89
Reaction score
0
Points
0
I gave it a shot, but no luck on either parts :(
Same message occurs, except it now say installer.pl
 

DefecTalisman

Community Advocate
Community Support
Messages
4,148
Reaction score
5
Points
38
Has the filename got any spaces?

Is that the name of the file you are trying to check, is there no line reference in the error?

Do you have perl installed on your system(this is the most obviouse and I think of it last, DOH)?
Edit:
How many files and lines in them?

If its small I can check it for you.
 
Last edited:

Corey

I Break Things
Staff member
Messages
34,553
Reaction score
204
Points
63
I have verified CGI is working correctly on your account, beyond that I'm not sure I can be much help.

-Corey
 

DefecTalisman

Community Advocate
Community Support
Messages
4,148
Reaction score
5
Points
38
Total lines : 1609
errors : 3
Code:
>perl -cw tmp.pl
[Tue Sep 18 08:12:59 2007] tmp.pl: "my" variable @files masks earlier declaration in same scope at tmp.pl line 276.
[Tue Sep 18 08:12:59 2007] tmp.pl: "my" variable $libraries masks earlier declaration in same statement at tmp.pl line 640.
[Tue Sep 18 08:13:00 2007] tmp.pl: Name "iF::EXT" used only once: possible typo at tmp.pl line 78.
tmp.pl syntax OK
>Exit code: 0

These are arb, the one scalar is quite complex, yet it only appears once in the script.

Noticing the "package iF" at the top, do you have that file?
It also looks like it is trying to open a archive file(rar), is that also in the folder?

Try making this file to do a check if perl is running in your bin?
(copy and past in to notepad, save as check_mod.pl, upload to cgi-bin and then set to 755)

Code:
#!/usr/bin/perl -w
my ($w,$x,$y) = ($ENV{'REMOTE_ADDR'},$ENV{'REMOTE_HOST'},$ENV{'HTTP_REFERER'});

use ExtUtils::Installed;
use Sys::Hostname;
use Net::Domain qw(hostname hostfqdn hostdomain);
use Socket;


my $inst    = ExtUtils::Installed->new() or &error('1',"Couldn't get modules");
my @modules = $inst->modules() or &error('2',"Couldn't get modules");


my $h_name = hostname();
my $d_name = hostfqdn();


my $address1 = inet_ntoa(
  scalar gethostbyname( $h_name || 'localhost' )
  );
my $address2 = inet_ntoa(
  scalar gethostbyname( $d_name || 'localhost' )
  );

&print_html;

sub print_html { 
print "Content-type: text/html\n\n" or &error('3',"Couldn't print Header");;
print <<ENDHTML or &error('4',"Couldn't print to HTML");
<HTML>
<HEAD>
<TITLE>Perl Module Test</TITLE>
</HEAD>
<BODY>
These are all the modules installed on this server!\n
ENDHTML
foreach (@modules) {
print "$_\n";
print "<P>\n" or &error('5',"Couldn't print modules");
}
print "Your IP: $w\n<br>";
print "Where you just came from : $y\n<br>";
print <<ENDHTML
This is the host name : $h_name : $address1
<br>
This is the domain name : $d_name : $address2
</BODY>
</HTML>

ENDHTML

}

sub error {
my ($no,$reas) = @_;	
	print "Error, $no\n<br>";
	print "$reas\n<br>";
}

Then run it and let me know what it says!
 
Last edited:

Mooseman

New Member
Messages
89
Reaction score
0
Points
0
The archive files are tar files, which are supposed to unpack when you run the installer and they are inside the cgi-bin too

I uploaded the check_mod.pl and it gives me a 500 internal server error
 

bonbon

New Member
Messages
67
Reaction score
0
Points
0
Help me to unsuspend my account!!!

hmmm...I agree
 
Last edited:

DefecTalisman

Community Advocate
Community Support
Messages
4,148
Reaction score
5
Points
38
Bugger man... Sorry my bad. There was 2 errors in the script I wrote for you to test. Am about to edit it, once the previouse post says edited copy it again and upload/overwrite the previouse.

Shouldn't of given a 500 error. I got a 404 error.

What sever are you on? The changes in the script will also tell you this now, along with your IP.
 

DefecTalisman

Community Advocate
Community Support
Messages
4,148
Reaction score
5
Points
38
Your IP: 81.166.97.35
Where you just came from :
This is the host name : absolut : 10.12.13.196
This is the domain name : absolut.x10hosting.com.x10hosting.com : 74.86.117.241

You are on absolut server.

Perl has to be running fine for that script to run.

Therfore it has to be errors in the forum scripts.

Give me some time and will check it out... Just got the cops here and trying to sort them out.
Edit:
Ok found the problem/s.

The script usses and requiers modules that arn't installed on the server.

There seems to be quiet a few, to many to install just for one script i would say. That is Corey's department though. I am just a meer mortal.

Are you set on using that forum script or could you not use one of the easy to install ones under your cPanel?
 
Last edited:

Mooseman

New Member
Messages
89
Reaction score
0
Points
0
The script usses and requiers modules that arn't installed on the server.

What modules are we talking about ?


Are you set on using that forum script or could you not use one of the easy to install ones under your cPanel?

Yes, I would very much like to use this one, because in a way I 'own' the software and have complete control on every single character and all the files used.
I used to run this software on another host with no problems at all, until the server got hacked.
I dont like SMF or phpbb2 much, and I have a database with lots of history to go along with it

But if this is not possible, thats ok

I really appreciate all the help you have already given. :biggrin:


EDIT :

I unzipped the tar files locally and the installer runs now, but it still cant find the
files it is looking for. I still get error, but that may be because it is renamed to .pl
I will try rename the installer to .cgi an see how it goes
 
Last edited:

DefecTalisman

Community Advocate
Community Support
Messages
4,148
Reaction score
5
Points
38
If you own it, can you not ask the people who wrote it?

Ask them what modules are requiered when installing it and for it to run.
A list would be great, then you can do a simple deduction from the module_check I gave you.

Also ask them if there might be any other requierments or reasons why it would be giving the error that it does.

As to the help, anytime. Just bummed I cant get it to work for you.
 

Mooseman

New Member
Messages
89
Reaction score
0
Points
0
Look at my edit above, our post just crossed ;)

I renamed the installer to .cgi, because that is what the installer file is looking for, not .pl ( I dunno if it is important, but it seems to work so far)

I'll let you know how it goes ;)
 
Status
Not open for further replies.
Top