Nếu chương trình CGI có thể không được chạy, hai dòng bổ sung có chứa thông tin về lỗi. Ngoài ra, nếu lỗi này là kết quả của kịch bản quay trở lại thông tin tiêu đề không chính xác, thông tin được đăng nhập như: tất cả các tiêu đề yêu cầu HTTP, tất cả các tiêu đề kết quả của chương trình CGI, và STDOUT | 370 Part III Running Web Applications Enabling CGI Debugging Support in Apache To help CGI developers Apache has logs for CGI output. For each CGI program error the log file contains a few lines of log entries. The first two lines contain the time of the request the request URI the HTTP status the CGI program name and so on. If the CGI program cannot be run two additional lines contain information about the error. Alternatively if the error is the result of the script returning incorrect header information the information is logged in as all HTTP request headers all headers outputted by CGI program and STDOUT and STDIN of the CGI program. If the script failed to output anything the STDOUT will not be included. To log CGI output in Apache use the directives described in the following sections in the mod_cgi module which is part of standard distribution. With these directives you can set up the logging of CGI programs that you are developing or attempting to install on your system. ScriptLog The ScriptLog directive sets the log filename for CGI program errors. If the log filename is relative that is it does not start with a leading it is taken to be relative to the server root directory set by ServerRoot directive. Syntax ScriptLog filename Context Resource config When you use this directive make sure that the log directory is writeable by the user specified by UserDir directive. Using this directive on a daily basis might not be a good idea as far as efficiency or performance goes. I recommend using it when needed and turning it off when the debugging is completed. ScriptLogLength The ScriptLogLength directive limits the size of the log file specified by the ScriptLog directive. The script log file can log a lot of information per CGI error and therefore can grow rapidly. By using this directive you can limit the log size so that when the file is at the maximum length no more information will be logged. Syntax ScriptLogLength size Default ScriptLogLength 10385760 .