xref: /PHP-8.3/main/php_main.h (revision 0311e60e)
1 /*
2    +----------------------------------------------------------------------+
3    | Copyright (c) The PHP Group                                          |
4    +----------------------------------------------------------------------+
5    | This source file is subject to version 3.01 of the PHP license,      |
6    | that is bundled with this package in the file LICENSE, and is        |
7    | available through the world-wide-web at the following url:           |
8    | https://www.php.net/license/3_01.txt                                 |
9    | If you did not receive a copy of the PHP license and are unable to   |
10    | obtain it through the world-wide-web, please send a note to          |
11    | license@php.net so we can mail you a copy immediately.               |
12    +----------------------------------------------------------------------+
13    | Authors: Andi Gutmans <andi@php.net>                                 |
14    |          Zeev Suraski <zeev@php.net>                                 |
15    +----------------------------------------------------------------------+
16  */
17 
18 #ifndef PHP_MAIN_H
19 #define PHP_MAIN_H
20 
21 #include "zend_globals.h"
22 #include "php_globals.h"
23 #include "SAPI.h"
24 
25 BEGIN_EXTERN_C()
26 
27 /* Returns the PHP version the engine was built with. This is useful for
28  * extensions which want to know the version of PHP at run-time, rather than
29  * the version they were built with at compile-time.
30  */
31 PHPAPI const char *php_version(void);
32 
33 /* Returns the PHP version id the engine was built with. This is useful for
34  * extensions which want to know the version of PHP at run-time, rather than
35  * the version they were built with at compile-time.
36  */
37 PHPAPI unsigned int php_version_id(void);
38 
39 PHPAPI zend_result php_request_startup(void);
40 PHPAPI void php_request_shutdown(void *dummy);
41 PHPAPI zend_result php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_module);
42 PHPAPI void php_module_shutdown(void);
43 PHPAPI int php_module_shutdown_wrapper(sapi_module_struct *sapi_globals);
44 
45 PHPAPI zend_result php_register_extensions(zend_module_entry * const * ptr, int count);
46 
47 PHPAPI bool php_execute_script(zend_file_handle *primary_file);
48 PHPAPI int php_execute_simple_script(zend_file_handle *primary_file, zval *ret);
49 PHPAPI zend_result php_lint_script(zend_file_handle *file);
50 
51 PHPAPI void php_handle_aborted_connection(void);
52 PHPAPI int php_handle_auth_data(const char *auth);
53 
54 PHPAPI void php_html_puts(const char *str, size_t siz);
55 PHPAPI zend_result php_stream_open_for_zend_ex(zend_file_handle *handle, int mode);
56 
57 /* environment module */
58 extern int php_init_environ(void);
59 extern int php_shutdown_environ(void);
60 
61 #ifdef ZTS
62 PHPAPI void php_reserve_tsrm_memory(void);
63 PHPAPI bool php_tsrm_startup_ex(int expected_threads);
64 PHPAPI bool php_tsrm_startup(void);
65 
66 #define PHP_ZTS 1
67 #else
68 #define PHP_ZTS 0
69 #endif
70 
71 #ifdef PHP_WIN32
72 #define PHP_OS_STR "WINNT"
73 #else
74 #define PHP_OS_STR PHP_OS
75 #endif
76 
77 END_EXTERN_C()
78 
79 #endif
80