diff --git a/TSRM/tsrm_win32.c b/TSRM/tsrm_win32.c
index bc5a6b2e23..710515b6c1 100644
--- a/TSRM/tsrm_win32.c
+++ b/TSRM/tsrm_win32.c
@@ -531,7 +531,7 @@ TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd,
 	}
 
 	dwCreateFlags = NORMAL_PRIORITY_CLASS;
-	if (strcmp(sapi_module.name, "cli") != 0) {
+	if (strcmp(sapi_module.name, "cli") != 0 && strcmp(sapi_module.name, "micro") != 0) {
 		dwCreateFlags |= CREATE_NO_WINDOW;
 	}
 
diff --git a/ext/ffi/ffi.c b/ext/ffi/ffi.c
index fc8bb9a1b0..2fd083d912 100644
--- a/ext/ffi/ffi.c
+++ b/ext/ffi/ffi.c
@@ -4935,7 +4935,7 @@ ZEND_MINIT_FUNCTION(ffi)
 
 	REGISTER_INI_ENTRIES();
 
-	FFI_G(is_cli) = strcmp(sapi_module.name, "cli") == 0;
+	FFI_G(is_cli) = strcmp(sapi_module.name, "cli")  == 0 || strcmp(sapi_module.name, "micro") == 0;
 
 	INIT_NS_CLASS_ENTRY(ce, "FFI", "Exception", NULL);
 	zend_ffi_exception_ce = zend_register_internal_class_ex(&ce, zend_ce_error);
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index c195ad7d2c..eef18fd10a 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -2622,7 +2622,7 @@ static inline int accel_find_sapi(void)
 			}
 		}
 		if (ZCG(accel_directives).enable_cli && (
-		    strcmp(sapi_module.name, "cli") == 0
+		    strcmp(sapi_module.name, "cli") == 0 || strcmp(sapi_module.name, "micro") == 0
 		  || strcmp(sapi_module.name, "phpdbg") == 0)) {
 			return SUCCESS;
 		}
@@ -2916,7 +2916,7 @@ static int accel_startup(zend_extension *extension)
 
 #ifdef HAVE_HUGE_CODE_PAGES
 	if (ZCG(accel_directives).huge_code_pages &&
-	    (strcmp(sapi_module.name, "cli") == 0 ||
+	    (strcmp(sapi_module.name, "cli") == 0 || strcmp(sapi_module.name, "micro") == 0 ||
 	     strcmp(sapi_module.name, "cli-server") == 0 ||
 		 strcmp(sapi_module.name, "cgi-fcgi") == 0 ||
 		 strcmp(sapi_module.name, "fpm-fcgi") == 0)) {
@@ -2928,7 +2928,7 @@ static int accel_startup(zend_extension *extension)
 	if (accel_find_sapi() == FAILURE) {
 		accel_startup_ok = 0;
 		if (!ZCG(accel_directives).enable_cli &&
-		    strcmp(sapi_module.name, "cli") == 0) {
+		    (strcmp(sapi_module.name, "cli") == 0 || strcmp(sapi_module.name, "micro") == 0)) {
 			zps_startup_failure("Opcode Caching is disabled for CLI", NULL, accelerator_remove_cb);
 		} else {
 			zps_startup_failure("Opcode Caching is only supported in Apache, FPM, FastCGI and LiteSpeed SAPIs", NULL, accelerator_remove_cb);
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index d9b9d94c6f..744c715b38 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -291,7 +291,7 @@ static PHP_GINIT_FUNCTION(pcre) /* {{{ */
 
 	/* If we're on the CLI SAPI, there will only be one request, so we don't need the
 	 * cache to survive after RSHUTDOWN. */
-	pcre_globals->per_request_cache = strcmp(sapi_module.name, "cli") == 0;
+	pcre_globals->per_request_cache = strcmp(sapi_module.name, "cli") == 0 || strcmp(sapi_module.name, "micro") == 0;
 	if (!pcre_globals->per_request_cache) {
 		zend_hash_init(&pcre_globals->pcre_cache, 0, NULL, php_free_pcre_cache, 1);
 	}
diff --git a/ext/readline/readline_cli.c b/ext/readline/readline_cli.c
index 2930796ae7..20ad2706c7 100644
--- a/ext/readline/readline_cli.c
+++ b/ext/readline/readline_cli.c
@@ -721,7 +721,7 @@ typedef cli_shell_callbacks_t *(__cdecl *get_cli_shell_callbacks)(void);
 		get_cli_shell_callbacks get_callbacks; \
 		HMODULE hMod = GetModuleHandle("php.exe"); \
 		(cb) = NULL; \
-		if (strlen(sapi_module.name) >= 3 && 0 == strncmp("cli", sapi_module.name, 3)) { \
+		if (0 == strncmp("cli", sapi_module.name, 3) || 0 == strncmp("micro", sapi_module.name, 5)) { \
 			get_callbacks = (get_cli_shell_callbacks)GetProcAddress(hMod, "php_cli_get_shell_callbacks"); \
 			if (get_callbacks) { \
 				(cb) = get_callbacks(); \
diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c
index cd91e68fd3..f270eb5a15 100644
--- a/ext/sqlite3/sqlite3.c
+++ b/ext/sqlite3/sqlite3.c
@@ -400,7 +400,7 @@ PHP_METHOD(SQLite3, loadExtension)
 
 #ifdef ZTS
 	if ((strncmp(sapi_module.name, "cgi", 3) != 0) &&
-		(strcmp(sapi_module.name, "cli") != 0) &&
+		(strcmp(sapi_module.name, "cli") != 0) && (strcmp(sapi_module.name, "micro") != 0) &&
 		(strncmp(sapi_module.name, "embed", 5) != 0)
 	) {		php_sqlite3_error(db_obj, "Not supported in multithreaded Web servers");
 		RETURN_FALSE;
diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c
index c5743c3361..b2dd79f5c4 100644
--- a/ext/standard/php_fopen_wrapper.c
+++ b/ext/standard/php_fopen_wrapper.c
@@ -242,7 +242,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa
 			}
 			return NULL;
 		}
-		if (!strcmp(sapi_module.name, "cli")) {
+		if (!strcmp(sapi_module.name, "cli") || !strcmp(sapi_module.name, "micro")) {
 			static int cli_in = 0;
 			fd = STDIN_FILENO;
 			if (cli_in) {
@@ -258,7 +258,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa
 		pipe_requested = 1;
 #endif
 	} else if (!strcasecmp(path, "stdout")) {
-		if (!strcmp(sapi_module.name, "cli")) {
+		if (!strcmp(sapi_module.name, "cli") || !strcmp(sapi_module.name, "micro")) {
 			static int cli_out = 0;
 			fd = STDOUT_FILENO;
 			if (cli_out++) {
@@ -274,7 +274,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa
 		pipe_requested = 1;
 #endif
 	} else if (!strcasecmp(path, "stderr")) {
-		if (!strcmp(sapi_module.name, "cli")) {
+		if (!strcmp(sapi_module.name, "cli") || !strcmp(sapi_module.name, "micro")) {
 			static int cli_err = 0;
 			fd = STDERR_FILENO;
 			if (cli_err++) {
@@ -295,7 +295,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa
 		zend_long  fildes_ori;
 		int		   dtablesize;
 
-		if (strcmp(sapi_module.name, "cli")) {
+		if (strcmp(sapi_module.name, "cli") && strcmp(sapi_module.name, "micro")) {
 			if (options & REPORT_ERRORS) {
 				php_error_docref(NULL, E_WARNING, "Direct access to file descriptors is only available from command-line PHP");
 			}
diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c
index 03b55c3eac..5bb0472f76 100644
--- a/ext/standard/proc_open.c
+++ b/ext/standard/proc_open.c
@@ -1136,7 +1136,7 @@ PHP_FUNCTION(proc_open)
 	}
 
 	dwCreateFlags = NORMAL_PRIORITY_CLASS;
-	if(strcmp(sapi_module.name, "cli") != 0) {
+	if(strcmp(sapi_module.name, "cli") != 0 && strcmp(sapi_module.name, "micro") != 0) {
 		dwCreateFlags |= CREATE_NO_WINDOW;
 	}
 	if (create_process_group) {
diff --git a/main/main.c b/main/main.c
index 7bd5400760..f0a71d7915 100644
--- a/main/main.c
+++ b/main/main.c
@@ -480,7 +480,7 @@ static PHP_INI_DISP(display_errors_mode)
 	mode = php_get_display_errors_mode(tmp_value, tmp_value_length);
 
 	/* Display 'On' for other SAPIs instead of STDOUT or STDERR */
-	cgi_or_cli = (!strcmp(sapi_module.name, "cli") || !strcmp(sapi_module.name, "cgi") || !strcmp(sapi_module.name, "phpdbg"));
+	cgi_or_cli = (!strcmp(sapi_module.name, "cli") || !strcmp(sapi_module.name, "cgi") || !strcmp(sapi_module.name, "phpdbg") || !strcmp(sapi_module.name, "micro"));
 
 	switch (mode) {
 		case PHP_DISPLAY_ERRORS_STDERR:
diff --git a/win32/console.c b/win32/console.c
index 7833dd97d3..1fa8e4cea9 100644
--- a/win32/console.c
+++ b/win32/console.c
@@ -111,6 +111,6 @@ PHP_WINUTIL_API BOOL php_win32_console_is_own(void)
 
 PHP_WINUTIL_API BOOL php_win32_console_is_cli_sapi(void)
 {/*{{{*/
-	return strlen(sapi_module.name) >= sizeof("cli") - 1 && !strncmp(sapi_module.name, "cli", sizeof("cli") - 1);
+	return !strncmp(sapi_module.name, "cli", sizeof("cli") - 1) || !strncmp(sapi_module.name, "micro", sizeof("micro") - 1);
 }/*}}}*/
 
