Back to index

php5  5.3.10
sapi_apache.c
Go to the documentation of this file.
00001 /*
00002    +----------------------------------------------------------------------+
00003    | PHP Version 5                                                        |
00004    +----------------------------------------------------------------------+
00005    | Copyright (c) 1997-2012 The PHP Group                                |
00006    +----------------------------------------------------------------------+
00007    | This source file is subject to version 3.01 of the PHP license,      |
00008    | that is bundled with this package in the file LICENSE, and is        |
00009    | available through the world-wide-web at the following url:           |
00010    | http://www.php.net/license/3_01.txt                                  |
00011    | If you did not receive a copy of the PHP license and are unable to   |
00012    | obtain it through the world-wide-web, please send a note to          |
00013    | license@php.net so we can mail you a copy immediately.               |
00014    +----------------------------------------------------------------------+
00015    | Authors: Rasmus Lerdorf <rasmus@php.net>                             |
00016    | (with helpful hints from Dean Gaudet <dgaudet@arctic.org>            |
00017    | PHP 4.0 patches by:                                                  |
00018    | Zeev Suraski <zeev@zend.com>                                         |
00019    | Stig Bakken <ssb@php.net>                                            |
00020    +----------------------------------------------------------------------+
00021  */
00022 /* $Id: sapi_apache.c 321634 2012-01-01 13:15:04Z felipe $ */
00023 
00024 #include "php_apache_http.h"
00025 
00026 /* {{{ apache_php_module_main
00027  */
00028 int apache_php_module_main(request_rec *r, int display_source_mode TSRMLS_DC)
00029 {
00030        int retval = OK;     
00031        zend_file_handle file_handle;
00032 
00033        if (php_request_startup(TSRMLS_C) == FAILURE) {
00034               return FAILURE;
00035        }
00036        /* sending a file handle to another dll is not working
00037           so let zend open it. */
00038        
00039        if (display_source_mode) {
00040               zend_syntax_highlighter_ini syntax_highlighter_ini;
00041 
00042               php_get_highlight_struct(&syntax_highlighter_ini);
00043               if (highlight_file(SG(request_info).path_translated, &syntax_highlighter_ini TSRMLS_CC) != SUCCESS) {
00044                      retval = NOT_FOUND;
00045               }
00046        } else {
00047               file_handle.type = ZEND_HANDLE_FILENAME;
00048               file_handle.handle.fd = 0;
00049               file_handle.filename = SG(request_info).path_translated;
00050               file_handle.opened_path = NULL;
00051               file_handle.free_filename = 0;
00052 
00053               (void) php_execute_script(&file_handle TSRMLS_CC);
00054        }
00055 
00056        AP(in_request) = 0;
00057        
00058        zend_try {
00059               php_request_shutdown(NULL);
00060        } zend_end_try();
00061        
00062        return retval;
00063 }
00064 /* }}} */
00065 
00066 /*
00067  * Local variables:
00068  * tab-width: 4
00069  * c-basic-offset: 4
00070  * End:
00071  * vim600: sw=4 ts=4 fdm=marker
00072  * vim<600: sw=4 ts=4
00073  */