File tree Expand file tree Collapse file tree 2 files changed +40
-7
lines changed
Expand file tree Collapse file tree 2 files changed +40
-7
lines changed Original file line number Diff line number Diff line change @@ -121,26 +121,36 @@ ZEND_ATTRIBUTE_CONST PHPAPI const char *php_build_provider(void)
121121
122122PHPAPI char * php_get_version (sapi_module_struct * sapi_module )
123123{
124+ zend_string * os = php_get_uname ('s' );
125+ zend_string * os_version = php_get_uname ('r' );
126+
124127 smart_string version_info = {0 };
125128 smart_string_append_printf (& version_info ,
126- "PHP %s (%s) (built: %s) (%s)\n" ,
129+ "PHP %s (%s) (built: %s) (%s) (%s %s%s) \n" ,
127130 PHP_VERSION , sapi_module -> name , php_build_date ,
128131#ifdef ZTS
129132 "ZTS"
130133#else
131134 "NTS"
132135#endif
133- #ifdef PHP_BUILD_COMPILER
134- " " PHP_BUILD_COMPILER
135- #endif
136- #ifdef PHP_BUILD_ARCH
137- " " PHP_BUILD_ARCH
138- #endif
139136#if ZEND_DEBUG
140137 " DEBUG"
141138#endif
142139#ifdef HAVE_GCOV
143140 " GCOV"
141+ #endif
142+ #ifdef PHP_BUILD_ARCH
143+ " " PHP_BUILD_ARCH
144+ #else
145+ " Unknown arch"
146+ #endif
147+ ,
148+ ZSTR_VAL (os ),
149+ ZSTR_VAL (os_version ),
150+ #ifdef PHP_BUILD_COMPILER
151+ " " PHP_BUILD_COMPILER
152+ #else
153+ " Unknown compiler"
144154#endif
145155 );
146156 smart_string_appends (& version_info , "Copyright (c) The PHP Group\n" );
@@ -150,6 +160,9 @@ PHPAPI char *php_get_version(sapi_module_struct *sapi_module)
150160 smart_string_appends (& version_info , get_zend_version ());
151161 smart_string_0 (& version_info );
152162
163+ zend_string_free (os );
164+ zend_string_free (os_version );
165+
153166 return version_info .c ;
154167}
155168
Original file line number Diff line number Diff line change @@ -89,6 +89,26 @@ PHPAPI bool php_tsrm_startup(void);
8989#define PHP_OS_STR PHP_OS
9090#endif
9191
92+ #ifndef PHP_BUILD_COMPILER
93+ # if defined(__clang__ )
94+ /* __VERSION__ contains the compiler name */
95+ # define PHP_BUILD_COMPILER __VERSION__
96+ # elif defined(__GNUC__ )
97+ /* __VERSION__ does not contain the compiler name */
98+ # define PHP_BUILD_COMPILER "GCC " __VERSION__
99+ # endif
100+ #endif
101+
102+ #ifndef PHP_BUILD_ARCH
103+ # if defined(__x86_64__ )
104+ # define PHP_BUILD_ARCH "x86_64"
105+ # elif defined(__i386__ )
106+ # define PHP_BUILD_ARCH "x86"
107+ # elif defined(__aarch64__ )
108+ # define PHP_BUILD_ARCH "aarch64"
109+ # endif
110+ #endif
111+
92112END_EXTERN_C ()
93113
94114#endif
You can’t perform that action at this time.
0 commit comments