Back to index

php5  5.3.10
Functions
sapi_apache.c File Reference
#include "php_apache_http.h"

Go to the source code of this file.

Functions

int apache_php_module_main (request_rec *r, int display_source_mode TSRMLS_DC)

Function Documentation

int apache_php_module_main ( request_rec *  r,
int display_source_mode  TSRMLS_DC 
)

Definition at line 28 of file sapi_apache.c.

{
       int retval = OK;     
       zend_file_handle file_handle;

       if (php_request_startup(TSRMLS_C) == FAILURE) {
              return FAILURE;
       }
       /* sending a file handle to another dll is not working
          so let zend open it. */
       
       if (display_source_mode) {
              zend_syntax_highlighter_ini syntax_highlighter_ini;

              php_get_highlight_struct(&syntax_highlighter_ini);
              if (highlight_file(SG(request_info).path_translated, &syntax_highlighter_ini TSRMLS_CC) != SUCCESS) {
                     retval = NOT_FOUND;
              }
       } else {
              file_handle.type = ZEND_HANDLE_FILENAME;
              file_handle.handle.fd = 0;
              file_handle.filename = SG(request_info).path_translated;
              file_handle.opened_path = NULL;
              file_handle.free_filename = 0;

              (void) php_execute_script(&file_handle TSRMLS_CC);
       }

       AP(in_request) = 0;
       
       zend_try {
              php_request_shutdown(NULL);
       } zend_end_try();
       
       return retval;
}