LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > External Applications > CGI/Perl/Python > [RESOLVED] execve() Exec format error

Reply
 
Thread Tools Display Modes
  #1  
Old 01-12-2010, 07:43 AM
Solutioned Solutioned is offline
New Member
 
Join Date: Jan 2010
Posts: 3
Unhappy [RESOLVED] execve() Exec format error

Hello, I'm surprised by the speed of execution of programs in C compared to PHP, so I decided to work with CGI programs.

I did a "Hello, World" and compiled it on Linux, but after uploading to the server, gives me this error.

Quote:
lscgid: execve():/hsphere/local/home/test/cgi-bin/a.cgi: Exec format error
Here is the source code.
Code:
#include <stdio.h>
int main() {
	printf("Content-Type: text/plain;charset=us-ascii\n\n");
	printf("Hello world\n\n");
	return 0;
}
This was compiled under an i5 processor x86-64 Debian distrubution.

Last edited by NiteWave; 01-27-2010 at 12:19 AM..
Reply With Quote
  #2  
Old 01-12-2010, 12:40 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,583
Binary build on Debian system may not be compatible with CentOS/Redhat.
You need to compile the binary on the same server.
Reply With Quote
  #3  
Old 01-13-2010, 08:05 PM
Solutioned Solutioned is offline
New Member
 
Join Date: Jan 2010
Posts: 3
Is there any way to create binaries that work for all distributions?

Because I have a shared web hosting and have no direct access to compile.
Reply With Quote
  #4  
Old 01-13-2010, 08:19 PM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,216
>Is there any way to create binaries that work for all distributions?

No, clearly

>Because I have a shared web hosting and have no direct access to compile

can you try
Code:
gcc -o a.cgi a.c
to create your own a.cgi. maybe most shared web hosting provide gcc nowadays?
Reply With Quote
  #5  
Old 01-26-2010, 09:20 PM
Solutioned Solutioned is offline
New Member
 
Join Date: Jan 2010
Posts: 3
Thanks to everyone, the hosting provider gave me the Shell Access and I already compile the program.
Reply With Quote
  #6  
Old 01-13-2010, 08:26 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,583
Quote:
Originally Posted by Solutioned View Post
Because I have a shared web hosting and have no direct access to compile.
You have to compile the binary from a machine with matching OS like the one your hosting company uses.
Reply With Quote
Reply

Tags
cgi, error, execve

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 10:00 AM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.