Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to execute a CGI on my server, but I have this issue:

run-detectors: unable to find an interpreter for /media/FTP/outils/cgi-bin/monitorCGI.cgi, >refererer: http://outils.mynd/backburner.
Premature end of scripts header: monitorCGI.cgi, referer: >http://outils.mynd/backburner.

My apache2.conf looks like so:

<location /media/FTP/racine/cgi-bin/>
Options +ExecCGI 
AddHandler cgi-script .cgi 

My Vhost looks like so:

>VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName SERV-FTP
    DocumentRoot /media/FTP

    Directory /media/FTP/racine/cgi-bin>
        Options +Indexes FollowSymLinks MultiViews +ExecCGI
        AddHandler cgi-script cgi
        Order allow,deny
        allow from all

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

Should I link wine to execute this CGI ?

share|improve this question
What kind of cgi script is it? A perl script? – etagenklo Aug 8 '13 at 9:27
Hi ! don't know what is it really & my reseller can't give me an answer about that. He said me i need wine. So i guess it's an exe ... ? – Hihui Aug 8 '13 at 9:36
If it is an actual script and not some unsupported binary executable then "unable to find an interpreter" probably means the interpretor path in the shebang is wrong - check the first line of the script and make sure the intepreter is being called with the correct path. Also execute the script manually and see if you get the same error. Finally the "file" command may be of use e.g. "file /media/FTP/outils/cgi-bin/monitorCGI.cgi" if you have shell access. – Fred Clausen Aug 8 '13 at 11:16
shebang ? I can't see the first line cause it's a compiled CGI (or i don't know how i can read the first line ...) If i execute "wine monitorCGI.cgi" i have an other error "ERROR login procedure could not be completed". It's normal cause i didn't use the .auth file. – Hihui Aug 8 '13 at 11:22
OK, it looks like a windows executable if running it in Wine makes it execute enough to give an actual error message. You could 1) Look for a better monitoring tool that can run natively in your hosting environment or 2) Write a wrapper script that calls wine with your binary, then call that wrapper script as a CGI. Also see this question for a similar situation. – Fred Clausen Aug 8 '13 at 11:29

The Apache webserver is unable to run the monitorCGI.cgi script because it is unable to find an interpreter to use.

This means that it does not recognise monitorCGI.cgi as a compiled binary, and so is treating it as a script, and therefore wants the first line to be #! /path/to/interpreter for some interpreter.

Since you claim the script is a compiled binary, but Apache does not recognise it as such, it is likely compiled for the wrong architecture.

Try the command file monitorCGI.cgi to see what type of file your OS claims it to be. Possibly it is compiled for 64bit when you're running a 32bit system, or it is a Windows executable when you're running a Linux server. In any case, you need to find a compatible binary for it to work. Try running the script directly form the command line, to verify that it can execute, before running via Apache.

share|improve this answer
file monitorCGI.cgi : PE32 executable (console) Intel 80386, for MS Windows. – Hihui Aug 9 '13 at 7:02
Under windows, a PE32 executable is a binary file, so MUST have a .exe extension, otherwise Apache will use the cgi-script handler, thinks it is a script and looks for an interpreter. Rename monitorCGI.cgi to be monitorCGI.exe and it should work (though you'll likely need to change whatever it was that linked to it) – Steve Shipway Oct 15 '13 at 3:41
I'm using Debian :s – Hihui Oct 16 '13 at 12:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.