Back to index

php5  5.3.10
Defines | Functions | Variables
php_embed.h File Reference
#include <main/php.h>
#include <main/SAPI.h>
#include <main/php_main.h>
#include <main/php_variables.h>
#include <main/php_ini.h>
#include <zend_ini.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define PTSRMLS_D
#define PTSRMLS_DC
#define PTSRMLS_C
#define PTSRMLS_CC
#define PHP_EMBED_START_BLOCK(x, y)
#define PHP_EMBED_END_BLOCK()
#define EMBED_SAPI_API   SAPI_API

Functions

EMBED_SAPI_API int php_embed_init (int argc, char **argv PTSRMLS_DC)
EMBED_SAPI_API void php_embed_shutdown (TSRMLS_D)

Variables

EMBED_SAPI_API sapi_module_struct php_embed_module

Define Documentation

#define EMBED_SAPI_API   SAPI_API

Definition at line 61 of file php_embed.h.

#define PHP_EMBED_END_BLOCK ( )
Value:
} zend_catch { \
    /* int exit_status = EG(exit_status); */ \
  } zend_end_try(); \
  php_embed_shutdown(TSRMLS_C); \
}

Definition at line 53 of file php_embed.h.

#define PHP_EMBED_START_BLOCK (   x,
 
)
Value:
{ \
    php_embed_init(x, y); \
    zend_first_try {

Definition at line 47 of file php_embed.h.

#define PTSRMLS_C

Definition at line 44 of file php_embed.h.

#define PTSRMLS_CC

Definition at line 45 of file php_embed.h.

#define PTSRMLS_D

Definition at line 42 of file php_embed.h.

#define PTSRMLS_DC

Definition at line 43 of file php_embed.h.


Function Documentation

EMBED_SAPI_API int php_embed_init ( int  argc,
char **argv  PTSRMLS_DC 
)

Definition at line 155 of file php_embed.c.

{
       zend_llist global_vars;
#ifdef ZTS
       void ***tsrm_ls = NULL;
#endif

#ifdef HAVE_SIGNAL_H
#if defined(SIGPIPE) && defined(SIG_IGN)
       signal(SIGPIPE, SIG_IGN); /* ignore SIGPIPE in standalone mode so
                                                         that sockets created via fsockopen()
                                                         don't kill PHP if the remote site
                                                         closes it.  in apache|apxs mode apache
                                                         does that for us!  thies@thieso.net
                                                         20000419 */
#endif
#endif

#ifdef ZTS
  tsrm_startup(1, 1, 0, NULL);
  tsrm_ls = ts_resource(0);
  *ptsrm_ls = tsrm_ls;
#endif

  sapi_startup(&php_embed_module);

#ifdef PHP_WIN32
  _fmode = _O_BINARY;                     /*sets default for file streams to binary */
  setmode(_fileno(stdin), O_BINARY);             /* make the stdio mode be binary */
  setmode(_fileno(stdout), O_BINARY);            /* make the stdio mode be binary */
  setmode(_fileno(stderr), O_BINARY);            /* make the stdio mode be binary */
#endif

  php_embed_module.ini_entries = malloc(sizeof(HARDCODED_INI));
  memcpy(php_embed_module.ini_entries, HARDCODED_INI, sizeof(HARDCODED_INI));

  php_embed_module.additional_functions = additional_functions;

  if (argv) {
       php_embed_module.executable_location = argv[0];
  }

  if (php_embed_module.startup(&php_embed_module)==FAILURE) {
         return FAILURE;
  }
 
  zend_llist_init(&global_vars, sizeof(char *), NULL, 0);  

  /* Set some Embedded PHP defaults */
  SG(options) |= SAPI_OPTION_NO_CHDIR;
  SG(request_info).argc=argc;
  SG(request_info).argv=argv;

  if (php_request_startup(TSRMLS_C)==FAILURE) {
         php_module_shutdown(TSRMLS_C);
         return FAILURE;
  }
  
  SG(headers_sent) = 1;
  SG(request_info).no_headers = 1;
  php_register_variable("PHP_SELF", "-", NULL TSRMLS_CC);

  return SUCCESS;
}

Here is the call graph for this function:

Definition at line 220 of file php_embed.c.

{
       php_request_shutdown((void *) 0);
       php_module_shutdown(TSRMLS_C);
       sapi_shutdown();
#ifdef ZTS
    tsrm_shutdown();
#endif
       if (php_embed_module.ini_entries) {
              free(php_embed_module.ini_entries);
              php_embed_module.ini_entries = NULL;
       }
}

Here is the call graph for this function:


Variable Documentation

EMBED_SAPI_API sapi_module_struct php_embed_module