Deutsch English
Alphabetical index
Array functions
CGI functions
  • cgibuffer()
  • cgiclearbuffer()
  • cgiclosebuffer()
  • cgiexec()
  • cgigetparam()
  • cgigetsession()
  • cgitestparam()
  • cgitestsession()
  • cgiwrite()
  • cgiwritehtml()
  • cgiwriteln()
  • cgiwritetemplate()
  • endcgi()
  • endsema()
  • getquerystring()
  • http_post()
  • initcgi()
  • waitsema()
    Data types
    Date functions
    Fulltext functions
    Language elements
    Numerical functions
    Other functions
    Ramtext functions
    Socket functions
    Statistical functions
    Stream functions
    String functions
    System functions
    Table functions
    Text functions
    Home    Overview    Search    Impressum    Contact    Members
    Topic complex CGI functions
    Function cgiexec()
    Short Executes an external program
    Syntax CGIEXEC(command : STRING [; timeout : INTEGER) : INTEGER
    Parameter command : Call of an external program incl. options and parameters

    timeout : maximum time to execute in seconds (only under Win32)
    Return 0 : program executed
    else : can not execute program
    See also:

    This function executes an external program. The parameter s_timeout is evaluated temporary only under Win9x / WinNT. The call program is executed completely before it returns the control to the CGI program. The called programm gets the input and output streams of the CGI program. That is why the output buffering should be turned off before the execution (as the external program can not write in the buffer of the tdbengine).

    Particularities Win9x, WinNT:

    The program is started directly. With s_timeout the maximum available time (in seconds) can be specified. Is the program terminated abortifly, the function value is -1. Is s_timeout set to -1, the programm is excuted completely, but the output is eliminated. This strategy is in any case preferable to output redirection. The rights of the executed program are deduced from the rights of the internet client.


    correct: (pkzip25.exe is located in /home/tdbengine/)

    CGICloseBuffer .. empty buffer
    CGIExec('pkzip25.exe -add *') .. shows the whole list
     .. and creates in the CGI directory
    correct: (cmd.exe is located in /home/tdbengine/)
    CGIExec('cmd.exe /c set') .. shows the whole environment
    wrong: (cmd.exe and pkzip25 are located in /home/tdbengine/)
    CGIExe('cmd.exe /c pkzip25.exe -add * > nul') .. creates without output
    correct: (pkzip25.exe is located in /home/tdbengine/)
    CGIExec('pkzip25.exe -add *',-1) .. creates without output

    Restriction: CGIExec can execute (at least trouble-free) only real 32 bit applications.


    The commandline of CGIEexc is committed to the Shell of the internet client with its rights. Information: Here the output redirection is the recommended way, to suppress the output of the called program.


    CGICloseBuffer .. clear buffer
    ') .. output according to screen
    CGIExec('set') .. shows the whole environment
    ')..CGIExec('tar -cz -fbackup.tar.gz *') .. creates the archive backup.tar.gz with output....CGIExec('tar -cz -fbackup.tar.gz * > /dev/null') .. creates the archive backup.tar.gz without output..
    Information: You should use CGIExec always with special caution. Scotch with suitable semaphores simultaneous calls (above all at archiving programs). Consider that every CGI process has only limited disposable time (adjustable in the http server).

    User comments:
    Write a comment:
    Text (Switch mode)

    Choose between
    the normal and the
    advanced editor.
    The advanced editor
    runs in IE 5+ and
    Mozilla 1.4+ only
    SPAM-Protection Please enter tdbengine in this field.

    tdbengine chat

       Copyright © 2003-2004 tdb Software Service GmbH
       Alle rechte vorbehalten. / All rights reserved
       Last changed: 21.10.2004
    {Fehler für :execmacro{execmacro="sessionspy"}