LiteSpeed Support Forums

LiteSpeed Support Forums (http://www.litespeedtech.com/support/forum/index.php)
-   CGI/Perl/Python (http://www.litespeedtech.com/support/forum/forumdisplay.php?f=22)
-   -   [RESOLVED] execve() Exec format error (http://www.litespeedtech.com/support/forum/showthread.php?t=3671)

Solutioned 01-12-2010 07:43 AM

[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.

mistwang 01-12-2010 12:40 PM

Binary build on Debian system may not be compatible with CentOS/Redhat.
You need to compile the binary on the same server.

Solutioned 01-13-2010 08:05 PM

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. :(

NiteWave 01-13-2010 08:19 PM

>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?

mistwang 01-13-2010 08:26 PM

Quote:

Originally Posted by Solutioned (Post 18023)
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.

Solutioned 01-26-2010 09:20 PM

Thanks to everyone, the hosting provider gave me the Shell Access and I already compile the program. :D


All times are GMT -7. The time now is 01:05 PM.