Solved

perl script not working

Posted on 2011-09-26
14
733 Views
Last Modified: 2013-12-25
I had a perl script that was working correctly, then my hosting provider "upgraded" the server to php5 and now nothing is working.  They messed up everything even though it should have nothing to do with perl.  I have no idea how to diagnose the issue and the tech guy is terrible.  I just found a script on a site and tried running it and got the error:

lscgid: execve():/home/xxx/domains/xxx.com/public_html/cgi-bin/elapsednew.pl: Exec format error

The script uses an account number so it won't help to post it. The issue is defintely some sort of config issue.  Does anyone know how I can diagnose this by using some script then show the details to the tech?

I believe that he said it was a lightspeed server.
0
Comment
Question by:jackjohnson44
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
  • 4
14 Comments
 

Author Comment

by:jackjohnson44
ID: 36681182

#/**************** Settings begin **************/
my $username  = ''; # Enter your Interfax username here
my $password  = ''; # Enter your Interfax password here
my $lastTransactionID = '999999999';
my $maxItems = '1';
my $NS = 'http://www.interfax.cc';
#/**************** Settings end ****************/
 
 
my $client = SOAP::Lite
	->uri($NS)
	->on_action( sub { join '/', $NS, $_[1] } ) 
	->proxy('http://ws.interfax.net/dfs.asmx?WSDL');
 
my $result = $client
	->call(SOAP::Data->name('FaxStatus')->attr({xmlns => $NS}) =>
			SOAP::Data->name('Username')->value($username)->type(''),
		    SOAP::Data->name('Password')->value($password)->type(''),
		    SOAP::Data->name('LastTransactionID')->value($lastTransactionID)->type(''),
		    SOAP::Data->name('MaxItems')->value($maxItems)->type('')
	);
 
 
if ( $result->fault ) {
    print $result->faultstring . "\n";
} else {
	if( $result->valueof('//FaxStatusResponse/ResultCode') == 0 ) {
		my @fax_items = $result->valueof('//FaxStatusResult/*');
 
		print "Displaying information for " . @fax_items . " faxes." . "\n";
		for(my $i=0; $i < @fax_items; $i++)  
		{  
			print "Item " . ($i + 1) . "\n";  
			print "  TransactionID=". $fax_items[$i]{'TransactionID'} . "\n";
			print "  SubmitTime=". $fax_items[$i]{'SubmitTime'} . "\n";
			print "  PostponeTime=". $fax_items[$i]{'PostponeTime'} . "\n";
			print "  CompletionTime=". $fax_items[$i]{'CompletionTime'} . "\n";
			print "  DestinationFax=". $fax_items[$i]{'DestinationFax'} . "\n";
			print "  RemoteCSID=". $fax_items[$i]{'RemoteCSID'} . "\n" if exists $fax_items[$i]{'RemoteCSID'};
			print "  PagesSent=". $fax_items[$i]{'PagesSent'} . "\n";
			print "  Status=". $fax_items[$i]{'Status'} . "\n";
			print "  Duration=". $fax_items[$i]{'Duration'} . "\n";
			print "  Subject=". $fax_items[$i]{'Subject'} . "\n" if exists $fax_items[$i]{'Subject'};
			print "  PagesSubmitted=". $fax_items[$i]{'PagesSubmitted'} . "\n";
		}
	} else {
		print "Error, return code=" . $result->valueof('//FaxStatusResponse/ResultCode') . "\n";
	}
}

Open in new window

0
 
LVL 23

Expert Comment

by:nemws1
ID: 36693666
Most likely they no longer recognize ".pl" as a CGI script.  Either ask them to add in the following in their httpd.conf file:

  AddHandler cgi-script .pl

Or perhaps try changing the names of your Perl scripts to ".cgi" instead of ".pl"
0
 

Author Comment

by:jackjohnson44
ID: 36694276
that isn't it, I was able to do a quick hello world with perl
0
Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

 
LVL 23

Expert Comment

by:nemws1
ID: 36695571
Hmmm.. that might not be the problem (looks like it might have been in a 'cgi-bin' directory).  So.... either your script is no longer executable (needs a 'chmod +x elapsednew.pl' on it)

How do you reference this script via the web?

   http://blah.host.com/~username/cgi-bin/elapsednew.pl

Or is it something special like:

   http://blah.host.com/username-cgi/elapsednew.pl

If it's the latter, then they need to add in:

   ScriptAlias /username-cgi/ /home/xxx/domains/xxx.com/public_html/cgi-bin/

Back into their httpd.conf file.

Basically, if you didn't change your file and its still executable, then they screwed up their httpd.conf file (or one of the newer style module config files).
0
 
LVL 23

Expert Comment

by:nemws1
ID: 36695730
Hmm.. your script is missing its "shabang".  It should have as its first line something like:

  #!/usr/bin/perl

Did you have that in your 'hello world' program?
0
 

Author Comment

by:jackjohnson44
ID: 36696238
yes, I have that
0
 
LVL 23

Expert Comment

by:nemws1
ID: 36707488
Check the execution permissions on the file - you might have inadvertently removed executable permissions.

You get this same type of error if you try to access a file in a CGI area (or named as such) and the thing you're accessing is *not* a program (like a .doc file or an image).

How do you access your webshare?  Can you log in via SSH (or Telnet) or you access it via FTP?
0
 
LVL 9

Expert Comment

by:parparov
ID: 36707504
consider this discussion:
http://www.litespeedtech.com/support/forum/showthread.php?t=1365

It looks like either the shebang is crucial, or on the opposite .pl handling should be abandoned.
Obviously the hosting added fastcgi support that broke your script.

R.
0
 

Author Comment

by:jackjohnson44
ID: 36711687
I have execute permissions.  I don't have ssh or telent access.  My file was in the cgi-bin and I can get the same results calling it .pl or .cgi.  It doesn't seem to matter.

The link mentions the httpd.conf file.  I only have ftp access.  I am not sure what to do with this info.

0
 
LVL 9

Expert Comment

by:parparov
ID: 36711933
Please try adding the shebang line to your script and ftp-upload it again.
0
 

Author Comment

by:jackjohnson44
ID: 36903539
Thanks,  but I already have that at the top.
#!/usr/bin/perl
0
 
LVL 9

Expert Comment

by:parparov
ID: 36903695
Have you tried applying the discussion I pointed to?
0
 

Author Comment

by:jackjohnson44
ID: 36905129
Thanks for checking back.  No, I don't have access to the shell.
I was hoping that there was some sort of php_info type script that I could run that would tell me what the issue is. Or if there was a script I could run that would do a test which I could send to the admin.  Any advice the mentions shell commands, or anything server related, I can't use.  I can only upload files.
0
 
LVL 9

Accepted Solution

by:
parparov earned 500 total points
ID: 36905475
Then you must talk to the server admin.
The code you pasted into this discussion didn't have the shebang, so I thought it could be the issue.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question