Back to index

php5  5.3.10
Classes | Defines | Typedefs | Functions | Variables
mod_php5.c File Reference
#include "php_apache_http.h"

Go to the source code of this file.

Classes

struct  _sapi_stack
struct  _php_per_dir_config
struct  _php_per_server_config
struct  _php_per_dir_entry

Defines

#define CONST_PREFIX
#define USE_PATH   1
#define IGNORE_URL   2

Typedefs

typedef struct _sapi_stack sapi_stack
typedef struct _php_per_dir_config php_per_dir_config
typedef struct
_php_per_server_config 
php_per_server_config
typedef struct _php_per_dir_entry php_per_dir_entry

Functions

int apache_php_module_main (request_rec *r, int display_source_mode TSRMLS_DC)
static void php_save_umask (void)
static void php_restore_umask (void)
static int sapi_apache_read_post (char *buffer, uint count_bytes TSRMLS_DC)
static char * sapi_apache_read_cookies (TSRMLS_D)
static int sapi_apache_header_handler (sapi_header_struct *sapi_header, sapi_header_op_enum op, sapi_headers_struct *sapi_headers TSRMLS_DC)
static int sapi_apache_send_headers (sapi_headers_struct *sapi_headers TSRMLS_DC)
static int send_php (request_rec *r, int display_source_mode, char *filename)
static int send_parsed_php (request_rec *r)
static int send_parsed_php_source (request_rec *r)
static int php_xbithack_handler (request_rec *r)
static void php_init_handler (server_rec *s, pool *p)
static CONST_PREFIX char * php_apache_value_handler_ex (cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2, int mode)
static CONST_PREFIX char * php_apache_value_handler (cmd_parms *cmd, php_per_dir_config *conf, char *arg1, char *arg2)
static CONST_PREFIX char * php_apache_admin_value_handler (cmd_parms *cmd, php_per_dir_config *conf, char *arg1, char *arg2)
static CONST_PREFIX char * php_apache_flag_handler (cmd_parms *cmd, php_per_dir_config *conf, char *arg1, char *arg2)
static CONST_PREFIX char * php_apache_flag_handler_ex (cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2, int mode)
static CONST_PREFIX char * php_apache_admin_flag_handler (cmd_parms *cmd, php_per_dir_config *conf, char *arg1, char *arg2)
int sapi_stack_init_ex (sapi_stack *stack, int persistent)
int sapi_stack_push (sapi_stack *stack, void *element)
void * sapi_stack_pop (sapi_stack *stack)
int sapi_stack_destroy (sapi_stack *stack)
int sapi_stack_apply_with_argument_all (sapi_stack *stack, int type, int(*apply_function)(void *element, void *arg), void *arg)
int sapi_stack_apply_with_argument_stop_if_equals (sapi_stack *stack, int type, int(*apply_function)(void *element, void *arg), void *arg, int stopval)
int sapi_stack_apply_with_argument_stop_if_http_error (sapi_stack *stack, int type, int(*apply_function)(void *element, void *arg), void *arg)
void php_handler_stack_destroy (sapi_stack *stack)
static int sapi_apache_ub_write (const char *str, uint str_length TSRMLS_DC)
static void sapi_apache_flush (void *server_context)
static void sapi_apache_register_server_variables (zval *track_vars_array TSRMLS_DC)
static int php_apache_startup (sapi_module_struct *sapi_module)
static void php_apache_log_message (char *message)
static void php_apache_request_shutdown (void *dummy)
static int php_apache_sapi_activate (TSRMLS_D)
static struct stat * php_apache_get_stat (TSRMLS_D)
static char * php_apache_getenv (char *name, size_t name_len TSRMLS_DC)
static void init_request_info (TSRMLS_D)
static int php_apache_alter_ini_entries (php_per_dir_entry *per_dir_entry TSRMLS_DC)
static char * php_apache_get_default_mimetype (request_rec *r TSRMLS_DC)
static void destroy_per_dir_entry (php_per_dir_entry *per_dir_entry)
static void copy_per_dir_entry (php_per_dir_entry *per_dir_entry)
static zend_bool should_overwrite_per_dir_entry (HashTable *target_ht, php_per_dir_entry *orig_per_dir_entry, zend_hash_key *hash_key, void *pData)
static void php_destroy_per_server_info (php_per_server_config *conf)
static void php_destroy_per_dir_info (php_per_dir_config *conf)
static void * php_create_server (pool *p, char *dummy)
static void * php_create_dir (pool *p, char *dummy)
static void * php_merge_dir (pool *p, void *basev, void *addv)
static CONST_PREFIX char * php_set_server_handler (server_rec *s, char *arg1, long handler_stage, long handler_type)
static CONST_PREFIX char * php_set_dir_handler (php_per_dir_config *conf, char *arg1, long handler_stage, long handler_type)
static CONST_PREFIX char * php_set_uri_handler (cmd_parms *cmd, void *dummy, char *arg1)
static CONST_PREFIX char * php_set_uri_handler_code (cmd_parms *cmd, void *dummy, char *arg1)
static CONST_PREFIX char * php_set_header_handler (cmd_parms *cmd, php_per_dir_config *conf, char *arg1)
static CONST_PREFIX char * php_set_header_handler_code (cmd_parms *cmd, php_per_dir_config *conf, char *arg1)
static CONST_PREFIX char * php_set_auth_handler (cmd_parms *cmd, php_per_dir_config *conf, char *arg1)
static CONST_PREFIX char * php_set_auth_handler_code (cmd_parms *cmd, php_per_dir_config *conf, char *arg1)
static CONST_PREFIX char * php_set_access_handler (cmd_parms *cmd, php_per_dir_config *conf, char *arg1)
static CONST_PREFIX char * php_set_access_handler_code (cmd_parms *cmd, php_per_dir_config *conf, char *arg1)
static CONST_PREFIX char * php_set_type_handler (cmd_parms *cmd, php_per_dir_config *conf, char *arg1)
static CONST_PREFIX char * php_set_type_handler_code (cmd_parms *cmd, php_per_dir_config *conf, char *arg1)
static CONST_PREFIX char * php_set_fixup_handler (cmd_parms *cmd, php_per_dir_config *conf, char *arg1)
static CONST_PREFIX char * php_set_fixup_handler_code (cmd_parms *cmd, php_per_dir_config *conf, char *arg1)
static CONST_PREFIX char * php_set_logger_handler (cmd_parms *cmd, php_per_dir_config *conf, char *arg1)
static CONST_PREFIX char * php_set_logger_handler_code (cmd_parms *cmd, php_per_dir_config *conf, char *arg1)
static CONST_PREFIX char * php_set_post_read_handler (cmd_parms *cmd, php_per_dir_config *conf, char *arg1)
static CONST_PREFIX char * php_set_post_read_handler_code (cmd_parms *cmd, php_per_dir_config *conf, char *arg1)
static CONST_PREFIX char * php_set_require (cmd_parms *cmd, void *dummy, char *arg1)
static CONST_PREFIX char * php_set_response_handler (cmd_parms *cmd, php_per_dir_config *conf, char *arg1)
static CONST_PREFIX char * php_set_response_handler_code (cmd_parms *cmd, php_per_dir_config *conf, char *arg1)
static CONST_PREFIX char * php_apache_phpini_set (cmd_parms *cmd, HashTable *conf, char *arg)
static void apache_php_module_shutdown_wrapper (void)
static int php_run_hook (php_handler *handler, request_rec *r)
static int php_uri_translation (request_rec *r)
static int php_header_hook (request_rec *r)
static int php_auth_hook (request_rec *r)
static int php_access_hook (request_rec *r)
static int php_type_hook (request_rec *r)
static int php_fixup_hook (request_rec *r)
static int php_logger_hook (request_rec *r)
static int php_post_read_hook (request_rec *r)
static int php_response_handler (request_rec *r)

Variables

module MODULE_VAR_EXPORT php5_module
int saved_umask
static unsigned char apache_php_initialized
static sapi_module_struct apache_sapi_module
handler_rec php_handlers []
command_rec php_commands []

Class Documentation

struct _sapi_stack

Definition at line 57 of file mod_php5.c.

Class Members
void ** elements
int max
int persistent
int top
struct _php_per_dir_config

Definition at line 62 of file mod_php5.c.

Collaboration diagram for _php_per_dir_config:
Class Members
sapi_stack access_handlers
sapi_stack auth_handlers
sapi_stack fixup_handlers
sapi_stack headers_handlers
HashTable * ini_settings
sapi_stack logger_handlers
sapi_stack post_read_handlers
sapi_stack response_handlers
sapi_stack type_handlers
struct _php_per_server_config

Definition at line 74 of file mod_php5.c.

Collaboration diagram for _php_per_server_config:
Class Members
sapi_stack requires
sapi_stack uri_handlers
struct _php_per_dir_entry

Definition at line 73 of file mod_php5.c.

Class Members
char htaccess
char * key
uint key_length
int type
char * value
uint value_length

Define Documentation

#define CONST_PREFIX

Definition at line 53 of file mod_php5.c.

#define IGNORE_URL   2

Definition at line 89 of file mod_php5.c.

#define USE_PATH   1

Definition at line 88 of file mod_php5.c.


Typedef Documentation

typedef struct _sapi_stack sapi_stack

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;
}

Here is the call graph for this function:

static void apache_php_module_shutdown_wrapper ( void  ) [static]

Definition at line 1209 of file mod_php5.c.

{
       apache_php_initialized = 0;
       apache_sapi_module.shutdown(&apache_sapi_module);

#if MODULE_MAGIC_NUMBER >= 19970728
       /* This function is only called on server exit if the apache API
        * child_exit handler exists, so shutdown globally 
        */
       sapi_shutdown();
#endif

#ifdef ZTS
       tsrm_shutdown();
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void copy_per_dir_entry ( php_per_dir_entry per_dir_entry) [static]

Definition at line 780 of file mod_php5.c.

{
       php_per_dir_entry tmp = *per_dir_entry;

       per_dir_entry->key = (char *) malloc(tmp.key_length+1);
       memcpy(per_dir_entry->key, tmp.key, tmp.key_length);
       per_dir_entry->key[per_dir_entry->key_length] = 0;

       per_dir_entry->value = (char *) malloc(tmp.value_length+1);
       memcpy(per_dir_entry->value, tmp.value, tmp.value_length);
       per_dir_entry->value[per_dir_entry->value_length] = 0;
}

Here is the caller graph for this function:

static void destroy_per_dir_entry ( php_per_dir_entry per_dir_entry) [static]

Definition at line 771 of file mod_php5.c.

{
       free(per_dir_entry->key);
       free(per_dir_entry->value);
}

Here is the caller graph for this function:

static void init_request_info ( TSRMLS_D  ) [static]

Definition at line 577 of file mod_php5.c.

{
       request_rec *r = ((request_rec *) SG(server_context));
       char *content_length = (char *) table_get(r->subprocess_env, "CONTENT_LENGTH");
       const char *authorization=NULL;
       char *tmp, *tmp_user;

       SG(request_info).query_string = r->args;
       SG(request_info).path_translated = r->filename;
       SG(request_info).request_uri = r->uri;
       SG(request_info).request_method = (char *)r->method;
       SG(request_info).proto_num = r->proto_num;
       SG(request_info).content_type = (char *) table_get(r->subprocess_env, "CONTENT_TYPE");
       SG(request_info).content_length = (content_length ? atol(content_length) : 0);
       SG(sapi_headers).http_response_code = r->status;

       if (r->headers_in) {
              authorization = table_get(r->headers_in, "Authorization");
       }

       SG(request_info).auth_user = NULL;
       SG(request_info).auth_password = NULL;

       if (authorization && !auth_type(r)) {
        if (!strcasecmp(getword(r->pool, &authorization, ' '), "Basic")) {
            tmp = uudecode(r->pool, authorization);
            tmp_user = getword_nulls_nc(r->pool, &tmp, ':');
            if (tmp_user) {
                r->connection->user = pstrdup(r->connection->pool, tmp_user);
                r->connection->ap_auth_type = "Basic";
                SG(request_info).auth_user = estrdup(tmp_user);
            }
            if (tmp) {
                SG(request_info).auth_password = estrdup(tmp);
            }
              } else if  (!strcasecmp(getword(r->pool, &authorization, ' '), "Digest")) {
            r->connection->ap_auth_type = "Digest";
            SG(request_info).auth_digest = estrdup(authorization);
              }
       }
}

Here is the caller graph for this function:

static int php_access_hook ( request_rec *  r) [static]

Definition at line 1334 of file mod_php5.c.

{
       php_per_dir_config *conf;
       int status = DECLINED;
       TSRMLS_FETCH();
       AP(current_hook) = AP_ACCESS_CONTROL;
       conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php5_module);
       status =  sapi_stack_apply_with_argument_stop_if_http_error(&conf->access_handlers,
                     ZEND_STACK_APPLY_BOTTOMUP,
                     (int (*)(void *element, void *)) php_run_hook, r);
       return status;

}

Here is the call graph for this function:

static CONST_PREFIX char * php_apache_admin_flag_handler ( cmd_parms *  cmd,
php_per_dir_config conf,
char *  arg1,
char *  arg2 
) [static]

Definition at line 1163 of file mod_php5.c.

{
       return php_apache_flag_handler_ex(cmd, conf->ini_settings, arg1, arg2, PHP_INI_SYSTEM);
}

Here is the call graph for this function:

static CONST_PREFIX char * php_apache_admin_value_handler ( cmd_parms *  cmd,
php_per_dir_config conf,
char *  arg1,
char *  arg2 
) [static]

Definition at line 1130 of file mod_php5.c.

{
       return php_apache_value_handler_ex(cmd, conf->ini_settings, arg1, arg2, PHP_INI_SYSTEM);
}

Here is the call graph for this function:

static int php_apache_alter_ini_entries ( php_per_dir_entry *per_dir_entry  TSRMLS_DC) [static]

Definition at line 622 of file mod_php5.c.

{
       zend_alter_ini_entry(per_dir_entry->key, per_dir_entry->key_length+1, per_dir_entry->value, per_dir_entry->value_length, per_dir_entry->type, PHP_INI_STAGE_ACTIVATE);
       return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static CONST_PREFIX char * php_apache_flag_handler ( cmd_parms *  cmd,
php_per_dir_config conf,
char *  arg1,
char *  arg2 
) [static]

Definition at line 1155 of file mod_php5.c.

{
       return php_apache_flag_handler_ex(cmd, conf->ini_settings, arg1, arg2, PHP_INI_PERDIR);
}

Here is the call graph for this function:

static CONST_PREFIX char * php_apache_flag_handler_ex ( cmd_parms *  cmd,
HashTable conf,
char *  arg1,
char *  arg2,
int  mode 
) [static]

Definition at line 1138 of file mod_php5.c.

{
       char bool_val[2];

       if (!strcasecmp(arg2, "On")) {
              bool_val[0] = '1';
       } else {
              bool_val[0] = '0';
       }
       bool_val[1] = 0;
       
       return php_apache_value_handler_ex(cmd, conf, arg1, bool_val, mode);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static char* php_apache_get_default_mimetype ( request_rec *r  TSRMLS_DC) [static]

Definition at line 631 of file mod_php5.c.

{
       
       char *mimetype;
       if (SG(default_mimetype) || SG(default_charset)) {
              /* Assume output will be of the default MIME type.  Individual
                 scripts may change this later. */
              char *tmpmimetype;
              tmpmimetype = sapi_get_default_content_type(TSRMLS_C);
              mimetype = pstrdup(r->pool, tmpmimetype);
              efree(tmpmimetype);
       } else {
              mimetype = SAPI_DEFAULT_MIMETYPE "; charset=" SAPI_DEFAULT_CHARSET;
       }
       return mimetype;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static struct stat* php_apache_get_stat ( TSRMLS_D  ) [static, read]

Definition at line 503 of file mod_php5.c.

{
       return &((request_rec *) SG(server_context))->finfo;
}
static char* php_apache_getenv ( char *  name,
size_t name_len  TSRMLS_DC 
) [static]

Definition at line 511 of file mod_php5.c.

{
       return (char *) table_get(((request_rec *) SG(server_context))->subprocess_env, name);
}
static void php_apache_log_message ( char *  message) [static]

Definition at line 436 of file mod_php5.c.

{
       TSRMLS_FETCH();

       if (SG(server_context)) {
#if MODULE_MAGIC_NUMBER >= 19970831
              aplog_error(NULL, 0, APLOG_ERR | APLOG_NOERRNO, ((request_rec *) SG(server_context))->server, "%s", message);
#else
              log_error(message, ((request_rec *) SG(server_context))->server);
#endif
       } else {
              fprintf(stderr, "%s", message);
              fprintf(stderr, "\n");
       }
}
static CONST_PREFIX char* php_apache_phpini_set ( cmd_parms *  cmd,
HashTable conf,
char *  arg 
) [static]

Definition at line 1171 of file mod_php5.c.

{
       if (apache_sapi_module.php_ini_path_override) {
              return "Only first PHPINIDir directive honored per configuration tree - subsequent ones ignored";
       }
       apache_sapi_module.php_ini_path_override = ap_server_root_relative(cmd->pool, arg);
       return NULL;
}
static void php_apache_request_shutdown ( void *  dummy) [static]

Definition at line 455 of file mod_php5.c.

{
       TSRMLS_FETCH();
       AP(current_hook) = AP_CLEANUP;
       php_output_set_status(0 TSRMLS_CC);
       SG(server_context) = NULL; /* The server context (request) is invalid by the time run_cleanups() is called */
       if(SG(sapi_started)) {
              php_request_shutdown(dummy);
              SG(sapi_started) = 0;
       }
       AP(in_request) = 0;
       if(AP(setup_env)) {
              AP(setup_env) = 0;
       }
       AP(current_hook) = AP_WAITING_FOR_REQUEST;
       AP(headers_sent) = 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int php_apache_sapi_activate ( TSRMLS_D  ) [static]

Definition at line 476 of file mod_php5.c.

{
       request_rec *r = (request_rec *) SG(server_context); 

       /*
        * For the Apache module version, this bit of code registers a cleanup
        * function that gets triggered when our request pool is destroyed.
        * We need this because at any point in our code we can be interrupted
        * and that may happen before we have had time to free our memory.
        * The php_request_shutdown function needs to free all outstanding allocated
        * memory.  
        */
       block_alarms();
       register_cleanup(r->pool, NULL, php_apache_request_shutdown, php_request_shutdown_for_exec);
       AP(in_request)=1;
       unblock_alarms();

       /* Override the default headers_only value - sometimes "GET" requests should actually only
        * send headers.
        */
       SG(request_info).headers_only = r->header_only;
       return SUCCESS;
}

Here is the call graph for this function:

static int php_apache_startup ( sapi_module_struct *  sapi_module) [static]

Definition at line 424 of file mod_php5.c.

{
       if (php_module_startup(sapi_module, &apache_module_entry, 1) == FAILURE) {
              return FAILURE;
       } else {
              return SUCCESS;
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static CONST_PREFIX char * php_apache_value_handler ( cmd_parms *  cmd,
php_per_dir_config conf,
char *  arg1,
char *  arg2 
) [static]

Definition at line 1122 of file mod_php5.c.

{
       return php_apache_value_handler_ex(cmd, conf->ini_settings, arg1, arg2, PHP_INI_PERDIR);
}

Here is the call graph for this function:

static CONST_PREFIX char * php_apache_value_handler_ex ( cmd_parms *  cmd,
HashTable conf,
char *  arg1,
char *  arg2,
int  mode 
) [static]

Definition at line 900 of file mod_php5.c.

{
       php_per_dir_entry per_dir_entry;

       if (!apache_php_initialized) {
              apache_php_initialized = 1;
#ifdef ZTS
              tsrm_startup(1, 1, 0, NULL);
#endif
              sapi_startup(&apache_sapi_module);
              php_apache_startup(&apache_sapi_module);
       }
       per_dir_entry.type = mode;

       if (strcasecmp(arg2, "none") == 0) {
              arg2 = "";
       }

       per_dir_entry.key_length = strlen(arg1);
       per_dir_entry.value_length = strlen(arg2);

       per_dir_entry.key = (char *) malloc(per_dir_entry.key_length+1);
       memcpy(per_dir_entry.key, arg1, per_dir_entry.key_length);
       per_dir_entry.key[per_dir_entry.key_length] = 0;

       per_dir_entry.value = (char *) malloc(per_dir_entry.value_length+1);
       memcpy(per_dir_entry.value, arg2, per_dir_entry.value_length);
       per_dir_entry.value[per_dir_entry.value_length] = 0;

       zend_hash_update(conf, per_dir_entry.key, per_dir_entry.key_length, &per_dir_entry, sizeof(php_per_dir_entry), NULL);
       return NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int php_auth_hook ( request_rec *  r) [static]

Definition at line 1323 of file mod_php5.c.

{
       php_per_dir_config *conf;
       TSRMLS_FETCH();
       AP(current_hook) = AP_AUTHENTICATION;
       conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php5_module);
       return sapi_stack_apply_with_argument_stop_if_equals(&conf->auth_handlers, 
                     ZEND_STACK_APPLY_BOTTOMUP, 
                     (int (*)(void *element, void *)) php_run_hook, r, OK);
}

Here is the call graph for this function:

static void* php_create_dir ( pool *  p,
char *  dummy 
) [static]

Definition at line 857 of file mod_php5.c.

{
       php_per_dir_config *conf;
       conf = (php_per_dir_config *) malloc(sizeof(php_per_dir_config));
       conf->ini_settings = (HashTable *) malloc(sizeof(HashTable));
       zend_hash_init_ex(conf->ini_settings, 5, NULL, (void (*)(void *)) destroy_per_dir_entry, 1, 0);
       sapi_stack_init_ex(&conf->response_handlers, 1);
       sapi_stack_init_ex(&conf->headers_handlers, 1);
       sapi_stack_init_ex(&conf->auth_handlers, 1);
       sapi_stack_init_ex(&conf->access_handlers, 1);
       sapi_stack_init_ex(&conf->type_handlers, 1);
       sapi_stack_init_ex(&conf->fixup_handlers, 1);
       sapi_stack_init_ex(&conf->logger_handlers, 1);
       sapi_stack_init_ex(&conf->post_read_handlers, 1);
       register_cleanup(p, (void *) conf, (void (*)(void *)) php_destroy_per_dir_info, (void (*)(void *)) php_destroy_per_dir_info);
       
       return conf;
}

Here is the call graph for this function:

static void* php_create_server ( pool *  p,
char *  dummy 
) [static]

Definition at line 841 of file mod_php5.c.

{
       php_per_server_config *conf;
       conf = (php_per_server_config *) malloc(sizeof(php_per_server_config));
       register_cleanup(p, (void *) conf, (void (*)(void *)) php_destroy_per_server_info, (void (*)(void *)) php_destroy_per_server_info);
       
       sapi_stack_init_ex(&conf->requires, 1);
       sapi_stack_init_ex(&conf->uri_handlers, 1);
       return conf;
}

Here is the call graph for this function:

static void php_destroy_per_dir_info ( php_per_dir_config conf) [static]
static void php_destroy_per_server_info ( php_per_server_config conf) [static]

Definition at line 815 of file mod_php5.c.

Here is the call graph for this function:

Here is the caller graph for this function:

static int php_fixup_hook ( request_rec *  r) [static]

Definition at line 1360 of file mod_php5.c.

{
       php_per_dir_config *conf;
       TSRMLS_FETCH();
       AP(current_hook) = AP_FIXUP;
       conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php5_module);
       return sapi_stack_apply_with_argument_stop_if_http_error(&conf->fixup_handlers,
                     ZEND_STACK_APPLY_BOTTOMUP,
                     (int (*)(void *element, void *)) php_run_hook,
                     r);
}

Here is the call graph for this function:

Definition at line 219 of file mod_php5.c.

{
       php_handler *ph;
       while((ph = (php_handler *)sapi_stack_pop(stack)) != NULL) {
              free(ph->name);
              free(ph);
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int php_header_hook ( request_rec *  r) [static]

Definition at line 1312 of file mod_php5.c.

{
       php_per_dir_config *conf;
       TSRMLS_FETCH();
       AP(current_hook) = AP_HEADER_PARSE;
       conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php5_module);
       return sapi_stack_apply_with_argument_stop_if_http_error(&conf->headers_handlers,
                     ZEND_STACK_APPLY_BOTTOMUP,
                     (int (*)(void *element, void *)) php_run_hook, r);
}

Here is the call graph for this function:

static void php_init_handler ( server_rec *  s,
pool *  p 
) [static]

Definition at line 1244 of file mod_php5.c.

{
       register_cleanup(p, NULL, (void (*)(void *))apache_php_module_shutdown_wrapper, (void (*)(void *))php_module_shutdown_for_exec);
       if (!apache_php_initialized) {
              apache_php_initialized = 1;
#ifdef ZTS
              tsrm_startup(1, 1, 0, NULL);
#endif
              sapi_startup(&apache_sapi_module);
              php_apache_startup(&apache_sapi_module);
       }
#if MODULE_MAGIC_NUMBER >= 19980527
       {
              TSRMLS_FETCH();
              if (PG(expose_php)) {
                     ap_add_version_component("PHP/" PHP_VERSION);
              }
       }
#endif
}

Here is the call graph for this function:

static int php_logger_hook ( request_rec *  r) [static]

Definition at line 1372 of file mod_php5.c.

{
       php_per_dir_config *conf;
       TSRMLS_FETCH();
       AP(current_hook) = AP_LOGGING;
       conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php5_module);
       return sapi_stack_apply_with_argument_stop_if_http_error(&conf->logger_handlers,
                     ZEND_STACK_APPLY_BOTTOMUP,
                     (int (*)(void *element, void *)) php_run_hook,
                     r);
}

Here is the call graph for this function:

static void* php_merge_dir ( pool *  p,
void *  basev,
void *  addv 
) [static]
static int php_post_read_hook ( request_rec *  r) [static]

Definition at line 1384 of file mod_php5.c.

{
       php_per_dir_config *conf;
       php_per_server_config *svr;
       TSRMLS_FETCH();
       AP(current_hook) = AP_POST_READ;
       svr = get_module_config(r->server->module_config, &php5_module);
       if(ap_is_initial_req(r)) {
              sapi_stack_apply_with_argument_all(&svr->requires, ZEND_STACK_APPLY_BOTTOMUP, (int (*)(void *element, void *)) php_run_hook, r);
       }
       conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php5_module);
       return sapi_stack_apply_with_argument_stop_if_http_error(&conf->post_read_handlers,
                     ZEND_STACK_APPLY_BOTTOMUP,
                     (int (*)(void *element, void *)) php_run_hook, r);
}

Here is the call graph for this function:

static int php_response_handler ( request_rec *  r) [static]

Definition at line 1400 of file mod_php5.c.

{
       php_per_dir_config *conf;
       TSRMLS_FETCH();
       AP(current_hook) = AP_RESPONSE;
       conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php5_module);
       return sapi_stack_apply_with_argument_all(&conf->response_handlers, ZEND_STACK_APPLY_BOTTOMUP, (int (*)(void *element, void *)) php_run_hook, r);
}

Here is the call graph for this function:

static void php_restore_umask ( void  ) [static]

Definition at line 569 of file mod_php5.c.

{
       umask(saved_umask);
}

Here is the caller graph for this function:

static int php_run_hook ( php_handler handler,
request_rec *  r 
) [static]

Definition at line 1266 of file mod_php5.c.

{
       zval *ret = NULL;
       php_per_dir_config *conf;

       TSRMLS_FETCH();

       if(!AP(apache_config_loaded)) {
              conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php5_module);
              if (conf)
                        zend_hash_apply((HashTable *)conf->ini_settings, (apply_func_t) php_apache_alter_ini_entries TSRMLS_CC);
              AP(apache_config_loaded) = 1;
       }
       if (!handler->name) {
              return DECLINED;
       }
       php_save_umask();
       if (!AP(setup_env)) {
              AP(setup_env) = 1;
              add_common_vars(r);
              add_cgi_vars(r);
       }
       SG(server_context) = r;
       init_request_info(TSRMLS_C);
       apache_php_module_hook(r, handler, &ret TSRMLS_CC);
       php_restore_umask();
       kill_timeout(r);
       if (ret) {
              convert_to_long(ret);
              return Z_LVAL_P(ret);
       }
       return HTTP_INTERNAL_SERVER_ERROR;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void php_save_umask ( void  ) [static]

Definition at line 231 of file mod_php5.c.

{
       saved_umask = umask(077);
       umask(saved_umask);
}

Here is the caller graph for this function:

static CONST_PREFIX char* php_set_access_handler ( cmd_parms *  cmd,
php_per_dir_config conf,
char *  arg1 
) [static]

Definition at line 1036 of file mod_php5.c.

Here is the call graph for this function:

static CONST_PREFIX char* php_set_access_handler_code ( cmd_parms *  cmd,
php_per_dir_config conf,
char *  arg1 
) [static]

Definition at line 1040 of file mod_php5.c.

Here is the call graph for this function:

static CONST_PREFIX char* php_set_auth_handler ( cmd_parms *  cmd,
php_per_dir_config conf,
char *  arg1 
) [static]

Definition at line 1023 of file mod_php5.c.

Here is the call graph for this function:

static CONST_PREFIX char* php_set_auth_handler_code ( cmd_parms *  cmd,
php_per_dir_config conf,
char *  arg1 
) [static]

Definition at line 1027 of file mod_php5.c.

Here is the call graph for this function:

static CONST_PREFIX char* php_set_dir_handler ( php_per_dir_config conf,
char *  arg1,
long  handler_stage,
long  handler_type 
) [static]

Definition at line 954 of file mod_php5.c.

{
       php_handler *handler;
       handler = (php_handler *) malloc(sizeof(php_handler));
       handler->type = handler_type;
       handler->stage = handler_stage;
       handler->name = strdup(arg1);
       switch(handler_stage) {
              case AP_POST_READ:
                     sapi_stack_push(&conf->post_read_handlers, handler);
                     break;
              case AP_HEADER_PARSE:
                     sapi_stack_push(&conf->headers_handlers, handler);
                     break;
              case AP_ACCESS_CONTROL:
                     sapi_stack_push(&conf->access_handlers, handler);
                     break;
              case AP_AUTHENTICATION:
                     sapi_stack_push(&conf->auth_handlers, handler);
                     break;
              case AP_AUTHORIZATION:
                     break;
              case AP_TYPE_CHECKING:
                     sapi_stack_push(&conf->type_handlers, handler);
                     break;
              case AP_FIXUP:
                     sapi_stack_push(&conf->fixup_handlers, handler);
                     break;
              case AP_RESPONSE:
                     sapi_stack_push(&conf->response_handlers, handler);
                     break;
              case AP_LOGGING:
                     sapi_stack_push(&conf->logger_handlers, handler);
                     break;
              default:
                     break;
       }
       return NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static CONST_PREFIX char* php_set_fixup_handler ( cmd_parms *  cmd,
php_per_dir_config conf,
char *  arg1 
) [static]

Definition at line 1062 of file mod_php5.c.

Here is the call graph for this function:

static CONST_PREFIX char* php_set_fixup_handler_code ( cmd_parms *  cmd,
php_per_dir_config conf,
char *  arg1 
) [static]

Definition at line 1066 of file mod_php5.c.

Here is the call graph for this function:

static CONST_PREFIX char* php_set_header_handler ( cmd_parms *  cmd,
php_per_dir_config conf,
char *  arg1 
) [static]

Definition at line 1011 of file mod_php5.c.

Here is the call graph for this function:

static CONST_PREFIX char* php_set_header_handler_code ( cmd_parms *  cmd,
php_per_dir_config conf,
char *  arg1 
) [static]

Definition at line 1015 of file mod_php5.c.

Here is the call graph for this function:

static CONST_PREFIX char* php_set_logger_handler ( cmd_parms *  cmd,
php_per_dir_config conf,
char *  arg1 
) [static]

Definition at line 1074 of file mod_php5.c.

Here is the call graph for this function:

static CONST_PREFIX char* php_set_logger_handler_code ( cmd_parms *  cmd,
php_per_dir_config conf,
char *  arg1 
) [static]

Definition at line 1078 of file mod_php5.c.

Here is the call graph for this function:

static CONST_PREFIX char* php_set_post_read_handler ( cmd_parms *  cmd,
php_per_dir_config conf,
char *  arg1 
) [static]

Definition at line 1087 of file mod_php5.c.

Here is the call graph for this function:

static CONST_PREFIX char* php_set_post_read_handler_code ( cmd_parms *  cmd,
php_per_dir_config conf,
char *  arg1 
) [static]

Definition at line 1091 of file mod_php5.c.

Here is the call graph for this function:

static CONST_PREFIX char* php_set_require ( cmd_parms *  cmd,
void *  dummy,
char *  arg1 
) [static]

Definition at line 1102 of file mod_php5.c.

{
       return php_set_server_handler(cmd->server, arg1, 0, AP_HANDLER_TYPE_FILE);
}

Here is the call graph for this function:

static CONST_PREFIX char* php_set_response_handler ( cmd_parms *  cmd,
php_per_dir_config conf,
char *  arg1 
) [static]

Definition at line 1110 of file mod_php5.c.

Here is the call graph for this function:

static CONST_PREFIX char* php_set_response_handler_code ( cmd_parms *  cmd,
php_per_dir_config conf,
char *  arg1 
) [static]

Definition at line 1114 of file mod_php5.c.

Here is the call graph for this function:

static CONST_PREFIX char* php_set_server_handler ( server_rec *  s,
char *  arg1,
long  handler_stage,
long  handler_type 
) [static]

Definition at line 934 of file mod_php5.c.

{
       php_per_server_config *conf;
       php_handler *handler;
       handler = (php_handler *) malloc(sizeof(php_handler));
       handler->type = handler_type;
       handler->stage = handler_stage;
       handler->name = strdup(arg1);
       conf = get_module_config(s->module_config, &php5_module);
       switch(handler_stage) {
              case AP_URI_TRANS:
                     sapi_stack_push(&conf->uri_handlers, handler);
                     break;
              default:
                     sapi_stack_push(&conf->requires, handler);
                     break;
       }
       return NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static CONST_PREFIX char* php_set_type_handler ( cmd_parms *  cmd,
php_per_dir_config conf,
char *  arg1 
) [static]

Definition at line 1049 of file mod_php5.c.

Here is the call graph for this function:

static CONST_PREFIX char* php_set_type_handler_code ( cmd_parms *  cmd,
php_per_dir_config conf,
char *  arg1 
) [static]

Definition at line 1053 of file mod_php5.c.

Here is the call graph for this function:

static CONST_PREFIX char* php_set_uri_handler ( cmd_parms *  cmd,
void *  dummy,
char *  arg1 
) [static]

Definition at line 996 of file mod_php5.c.

{
       return php_set_server_handler(cmd->server, arg1, AP_URI_TRANS, AP_HANDLER_TYPE_FILE);
}

Here is the call graph for this function:

static CONST_PREFIX char* php_set_uri_handler_code ( cmd_parms *  cmd,
void *  dummy,
char *  arg1 
) [static]

Definition at line 1003 of file mod_php5.c.

Here is the call graph for this function:

static int php_type_hook ( request_rec *  r) [static]

Definition at line 1348 of file mod_php5.c.

{
       php_per_dir_config *conf;
       TSRMLS_FETCH();
       AP(current_hook) = AP_TYPE_CHECKING;
       conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php5_module);
       return sapi_stack_apply_with_argument_stop_if_equals(&conf->type_handlers,
                     ZEND_STACK_APPLY_BOTTOMUP,
                     (int (*)(void *element, void *)) php_run_hook,
                     r, OK);
}

Here is the call graph for this function:

static int php_uri_translation ( request_rec *  r) [static]

Definition at line 1301 of file mod_php5.c.

{      
       php_per_server_config *conf;
       TSRMLS_FETCH();
       AP(current_hook) = AP_URI_TRANS;
       conf = (php_per_server_config *) get_module_config(r->server->module_config, &php5_module);
       return sapi_stack_apply_with_argument_stop_if_equals(&conf->uri_handlers, 
                     ZEND_STACK_APPLY_BOTTOMUP, 
                     (int (*)(void *element, void *)) php_run_hook, r, OK);
}

Here is the call graph for this function:

static int php_xbithack_handler ( request_rec *  r) [static]

Definition at line 1183 of file mod_php5.c.

{
       php_per_dir_config *conf;
       TSRMLS_FETCH();

       if (!(r->finfo.st_mode & S_IXUSR)) {
              r->allowed |= (1 << METHODS) - 1;
              return DECLINED;
       }
       conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php5_module);
       if (conf) {
              zend_hash_apply((HashTable *) conf->ini_settings, (apply_func_t) php_apache_alter_ini_entries TSRMLS_CC);
       }
       if(!AP(xbithack)) {
              r->allowed |= (1 << METHODS) - 1;
              zend_try {
                     zend_ini_deactivate(TSRMLS_C);
              } zend_end_try();
              return DECLINED;
       }
       return send_parsed_php(r);
}

Here is the call graph for this function:

static void sapi_apache_flush ( void *  server_context) [static]

Definition at line 256 of file mod_php5.c.

{
       if (server_context) {
#if MODULE_MAGIC_NUMBER > 19970110
              rflush((request_rec *) server_context);
#else
              bflush((request_rec *) server_context->connection->client);
#endif
       }
}
static int sapi_apache_header_handler ( sapi_header_struct sapi_header,
sapi_header_op_enum  op,
sapi_headers_struct *sapi_headers  TSRMLS_DC 
) [static]

Definition at line 311 of file mod_php5.c.

{
       char *header_name, *header_content, *p;
       request_rec *r = (request_rec *) SG(server_context);
       if(!r) {
              return 0;
       }

       switch(op) {
              case SAPI_HEADER_DELETE_ALL:
                     clear_table(r->headers_out);
                     return 0;

              case SAPI_HEADER_DELETE:
                     table_unset(r->headers_out, sapi_header->header);
                     return 0;

              case SAPI_HEADER_ADD:
              case SAPI_HEADER_REPLACE:
                     header_name = sapi_header->header;

                     header_content = p = strchr(header_name, ':');
                     if (!p) {
                            return 0;
                     }

                     *p = 0;
                     do {
                            header_content++;
                     } while (*header_content==' ');

                     if (!strcasecmp(header_name, "Content-Type")) {
                            r->content_type = pstrdup(r->pool, header_content);
                     } else if (!strcasecmp(header_name, "Set-Cookie")) {
                            table_add(r->headers_out, header_name, header_content);
                     } else if (op == SAPI_HEADER_REPLACE) {
                            table_set(r->headers_out, header_name, header_content);
                     } else {
                            table_add(r->headers_out, header_name, header_content);
                     }

                     *p = ':';  /* a well behaved header handler shouldn't change its original arguments */

                     return SAPI_HEADER_ADD;

              default:
                     return 0;
       }
}
static char * sapi_apache_read_cookies ( TSRMLS_D  ) [static]

Definition at line 303 of file mod_php5.c.

{
       return (char *) table_get(((request_rec *) SG(server_context))->subprocess_env, "HTTP_COOKIE");
}
static int sapi_apache_read_post ( char *  buffer,
uint count_bytes  TSRMLS_DC 
) [static]

Definition at line 270 of file mod_php5.c.

{
       uint total_read_bytes=0, read_bytes;
       request_rec *r = (request_rec *) SG(server_context);
       void (*handler)(int);

       /*
        * This handles the situation where the browser sends a Expect: 100-continue header
        * and needs to recieve confirmation from the server on whether or not it can send
        * the rest of the request. RFC 2616
        *
        */
       if (!SG(read_post_bytes) && !ap_should_client_block(r)) {
              return total_read_bytes;
       }
 
       handler = signal(SIGPIPE, SIG_IGN);
       while (total_read_bytes<count_bytes) {
              hard_timeout("Read POST information", r); /* start timeout timer */
              read_bytes = get_client_block(r, buffer+total_read_bytes, count_bytes-total_read_bytes);
              reset_timeout(r);
              if (read_bytes<=0) {
                     break;
              }
              total_read_bytes += read_bytes;
       }
       signal(SIGPIPE, handler);   
       return total_read_bytes;
}
static void sapi_apache_register_server_variables ( zval *track_vars_array  TSRMLS_DC) [static]

Definition at line 384 of file mod_php5.c.

{
       register int i;
       array_header *arr = table_elts(((request_rec *) SG(server_context))->subprocess_env);
       table_entry *elts = (table_entry *) arr->elts;
       zval **path_translated;
       HashTable *symbol_table;

       for (i = 0; i < arr->nelts; i++) {
              char *val;

              if (elts[i].val) {
                     val = elts[i].val;
              } else {
                     val = "";
              }
              php_register_variable(elts[i].key, val, track_vars_array  TSRMLS_CC);
       }

       /* If PATH_TRANSLATED doesn't exist, copy it from SCRIPT_FILENAME */
       if (track_vars_array) {
              symbol_table = track_vars_array->value.ht;
       } else if (PG(register_globals)) {
              /* should never happen nowadays */
              symbol_table = EG(active_symbol_table);
       } else {
              symbol_table = NULL;
       }
       if (symbol_table
              && !zend_hash_exists(symbol_table, "PATH_TRANSLATED", sizeof("PATH_TRANSLATED"))
              && zend_hash_find(symbol_table, "SCRIPT_FILENAME", sizeof("SCRIPT_FILENAME"), (void **) &path_translated)==SUCCESS) {
              php_register_variable("PATH_TRANSLATED", Z_STRVAL_PP(path_translated), track_vars_array TSRMLS_CC);
       }

       php_register_variable("PHP_SELF", ((request_rec *) SG(server_context))->uri, track_vars_array TSRMLS_CC);
}

Here is the call graph for this function:

static int sapi_apache_send_headers ( sapi_headers_struct *sapi_headers  TSRMLS_DC) [static]

Definition at line 364 of file mod_php5.c.

{
       if(SG(server_context) == NULL) { /* server_context is not here anymore */
              return SAPI_HEADER_SEND_FAILED;
       }

       ((request_rec *) SG(server_context))->status = SG(sapi_headers).http_response_code;
       /* check that we haven't sent headers already, we use our own
        * headers_sent since we may send headers at anytime 
        */
       if(!AP(headers_sent)) {
              send_http_header((request_rec *) SG(server_context));
              AP(headers_sent) = 1;
       }
       return SAPI_HEADER_SENT_SUCCESSFULLY;
}
static int sapi_apache_ub_write ( const char *  str,
uint str_length  TSRMLS_DC 
) [static]

Definition at line 240 of file mod_php5.c.

{
       int ret=0;
              
       if (SG(server_context)) {
              ret = rwrite(str, str_length, (request_rec *) SG(server_context));
       }
       if (ret != str_length) {
              php_handle_aborted_connection();
       }
       return ret;
}

Here is the call graph for this function:

int sapi_stack_apply_with_argument_all ( sapi_stack stack,
int  type,
int(*)(void *element, void *arg)  apply_function,
void *  arg 
)

Definition at line 153 of file mod_php5.c.

{
              int i, retval;   

              switch (type) {                           
                            case ZEND_STACK_APPLY_TOPDOWN:
                                          for (i=stack->top-1; i>=0; i--) {
                                                        retval = apply_function(stack->elements[i], arg); 
                                          }
                                          break;
                            case ZEND_STACK_APPLY_BOTTOMUP:
                                          for (i=0; i<stack->top; i++) {            
                                                        retval = apply_function(stack->elements[i], arg);
                                          }        
                                          break;
              }
              return retval;
}

Here is the caller graph for this function:

int sapi_stack_apply_with_argument_stop_if_equals ( sapi_stack stack,
int  type,
int(*)(void *element, void *arg)  apply_function,
void *  arg,
int  stopval 
)

Definition at line 173 of file mod_php5.c.

{
       int i;
       int ret = DECLINED;
       switch (type) {
              case ZEND_STACK_APPLY_TOPDOWN:
                     for (i=stack->top-1; i>=0; i--) {
                            if ((ret = apply_function(stack->elements[i], arg)) == stopval) {
                                   break;
                            }
                     }
                     break;
              case ZEND_STACK_APPLY_BOTTOMUP:
                     for (i=0; i<stack->top; i++) {
                            if ((ret = apply_function(stack->elements[i], arg)) == stopval) {
                                   break;
                            }
                     }
                     break;
       }
       return ret;
}

Here is the caller graph for this function:

int sapi_stack_apply_with_argument_stop_if_http_error ( sapi_stack stack,
int  type,
int(*)(void *element, void *arg)  apply_function,
void *  arg 
)

Definition at line 196 of file mod_php5.c.

{
       int i;
       int ret = DECLINED;
       switch (type) {
              case ZEND_STACK_APPLY_TOPDOWN:
                     for (i=stack->top-1; i>=0; i--) {
                            if ((ret = apply_function(stack->elements[i], arg)) > 0) {
                                   break;
                            }
                     }
                     break;
              case ZEND_STACK_APPLY_BOTTOMUP:
                     for (i=0; i<stack->top; i++) {
                            if ((ret = apply_function(stack->elements[i], arg)) > 0) {
                                   break;
                            }
                     }
                     break;
       }
       return ret;
}

Here is the caller graph for this function:

Definition at line 148 of file mod_php5.c.

{
              return SUCCESS;
}
int sapi_stack_init_ex ( sapi_stack stack,
int  persistent 
)

Definition at line 115 of file mod_php5.c.

{
              stack->top = 0;
              stack->persistent = persistent;
              stack->elements = (void **) pemalloc(sizeof(void **) * STACK_BLOCK_SIZE,  persistent);
              if (!stack->elements) {
                            return FAILURE;
              } else {
                            stack->max = STACK_BLOCK_SIZE;
                            return SUCCESS;
              }
}

Here is the caller graph for this function:

void* sapi_stack_pop ( sapi_stack stack)

Definition at line 139 of file mod_php5.c.

                                        {
       if(stack->top == 0) {
              return NULL;
       }
       else {
              return stack->elements[--stack->top];
       }
}

Here is the caller graph for this function:

int sapi_stack_push ( sapi_stack stack,
void *  element 
)

Definition at line 127 of file mod_php5.c.

{
              if (stack->top >= stack->max) {            /* we need to allocate more memory */
                            stack->elements = (void **) perealloc(stack->elements,
                                                           (sizeof(void **) * (stack->max += STACK_BLOCK_SIZE)), stack->persistent);
                            if (!stack->elements) {
                                          return FAILURE;
                            }
              }
              stack->elements[stack->top] = (void *) element;
              return stack->top++;
}

Here is the caller graph for this function:

static int send_parsed_php ( request_rec *  r) [static]

Definition at line 748 of file mod_php5.c.

{
       int result = send_php(r, 0, NULL);
       TSRMLS_FETCH();
 
       ap_table_setn(r->notes, "mod_php_memory_usage",
              ap_psprintf(r->pool, "%u", zend_memory_peak_usage(1 TSRMLS_CC)));

       return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int send_parsed_php_source ( request_rec *  r) [static]

Definition at line 762 of file mod_php5.c.

{
       return send_php(r, 1, NULL);
}

Here is the call graph for this function:

static int send_php ( request_rec *  r,
int  display_source_mode,
char *  filename 
) [static]

Definition at line 651 of file mod_php5.c.

{
       int retval;
       php_per_dir_config *per_dir_conf;
       TSRMLS_FETCH();
       if (AP(in_request)) {
              zend_file_handle fh;

              fh.filename = r->filename;
              fh.opened_path = NULL;
              fh.free_filename = 0;
              fh.type = ZEND_HANDLE_FILENAME;

              zend_execute_scripts(ZEND_INCLUDE TSRMLS_CC, NULL, 1, &fh);
              return OK;
       }

       zend_first_try {

              /* Make sure file exists */
              if (filename == NULL && r->finfo.st_mode == 0) {
                     return DECLINED;
              }

              per_dir_conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php5_module);
              if (per_dir_conf) {
                     zend_hash_apply((HashTable *) per_dir_conf->ini_settings, (apply_func_t) php_apache_alter_ini_entries TSRMLS_CC);
              }

              /* If PHP parser engine has been turned off with an "engine off"
               * directive, then decline to handle this request
               */
              if (!AP(engine)) {
                     r->content_type = php_apache_get_default_mimetype(r TSRMLS_CC);
                     r->allowed |= (1 << METHODS) - 1;
                     zend_try {
                            zend_ini_deactivate(TSRMLS_C);
                     } zend_end_try();
                     return DECLINED;
              }
              if (filename == NULL) {
                     filename = r->filename;
              }

              /* Apache 1.2 has a more complex mechanism for reading POST data */
#if MODULE_MAGIC_NUMBER > 19961007
              if ((retval = setup_client_block(r, REQUEST_CHUNKED_ERROR))) {
                     zend_try {
                            zend_ini_deactivate(TSRMLS_C);
                     } zend_end_try();
                     return retval;
              }
#endif

              if (AP(last_modified)) {
#if MODULE_MAGIC_NUMBER < 19970912
                     if ((retval = set_last_modified(r, r->finfo.st_mtime))) {
                            zend_try {
                                   zend_ini_deactivate(TSRMLS_C);
                            } zend_end_try();
                            return retval;
                     }
#else
                     update_mtime (r, r->finfo.st_mtime);
                     set_last_modified(r);
                     set_etag(r);
#endif
              }
              /* Assume output will be of the default MIME type.  Individual
                 scripts may change this later in the request. */
              r->content_type = php_apache_get_default_mimetype(r TSRMLS_CC);

              /* Init timeout */
              hard_timeout("send", r);

              SG(server_context) = r;
              
              php_save_umask();
              if(!AP(setup_env)) {
                     AP(setup_env) = 1;
                     add_common_vars(r);
                     add_cgi_vars(r);
              }
              init_request_info(TSRMLS_C);
              apache_php_module_main(r, display_source_mode TSRMLS_CC);
              
              /* Done, restore umask, turn off timeout, close file and return */
              php_restore_umask();
              kill_timeout(r);
       } zend_end_try();

       return OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static zend_bool should_overwrite_per_dir_entry ( HashTable target_ht,
php_per_dir_entry orig_per_dir_entry,
zend_hash_key hash_key,
void *  pData 
) [static]

Definition at line 797 of file mod_php5.c.

{
       php_per_dir_entry *new_per_dir_entry;

       if (zend_hash_find(target_ht, hash_key->arKey, hash_key->nKeyLength, (void **) &new_per_dir_entry)==FAILURE) {
              return 1; /* does not exist in dest, copy from source */
       }

       if (new_per_dir_entry->type==PHP_INI_SYSTEM
              && orig_per_dir_entry->type!=PHP_INI_SYSTEM) {
              return 1;
       } else {
              return 0;
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

unsigned char apache_php_initialized [static]

Definition at line 95 of file mod_php5.c.

sapi_module_struct apache_sapi_module [static]

Definition at line 519 of file mod_php5.c.

command_rec php_commands[]

Definition at line 1423 of file mod_php5.c.

handler_rec php_handlers[]
Initial value:
{
       {"application/x-httpd-php", send_parsed_php},
       {"application/x-httpd-php-source", send_parsed_php_source},
       {"text/html", php_xbithack_handler},
              {"php-script", php_response_handler},
       {NULL}
}

Definition at line 1411 of file mod_php5.c.

Definition at line 93 of file mod_php5.c.