diff --git a/TSRM/tsrm_win32.c b/TSRM/tsrm_win32.c
index dc8f9fefa3..057d76229e 100644
--- a/TSRM/tsrm_win32.c
+++ b/TSRM/tsrm_win32.c
@@ -530,7 +530,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 d797f5f93f..27cb05e3e4 100644
--- a/ext/ffi/ffi.c
+++ b/ext/ffi/ffi.c
@@ -5403,7 +5403,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") == 1;
 
 	zend_ffi_exception_ce = register_class_FFI_Exception(zend_ce_error);
 
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index 8d45b2ae41..35e9403a31 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -2822,7 +2822,7 @@ static inline zend_result accel_find_sapi(void)
 		}
 		if (ZCG(accel_directives).enable_cli && (
 		    strcmp(sapi_module.name, "cli") == 0
-		  || strcmp(sapi_module.name, "phpdbg") == 0)) {
+		  || strcmp(sapi_module.name, "phpdbg") == 0 || strcmp(sapi_module.name, "micro") == 0)) {
 			return SUCCESS;
 		}
 	}
@@ -3134,7 +3134,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)) {
@@ -3146,7 +3146,7 @@ static int accel_startup(zend_extension *extension)
 	if (accel_find_sapi() == FAILURE) {
 		accel_startup_ok = false;
 		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, FrankenPHP, LiteSpeed and uWSGI SAPIs", NULL, accelerator_remove_cb);
@@ -4685,7 +4685,7 @@ static zend_result accel_finish_startup_preload_subprocess(pid_t *pid)
 	if (!ZCG(accel_directives).preload_user
 	 || !*ZCG(accel_directives).preload_user) {
 
-		bool sapi_requires_preload_user = !(strcmp(sapi_module.name, "cli") == 0
+		bool sapi_requires_preload_user = !(strcmp(sapi_module.name, "cli") == 0 || strcmp(sapi_module.name, "micro") == 0
 		  || strcmp(sapi_module.name, "phpdbg") == 0);
 
 		if (!sapi_requires_preload_user) {
diff --git a/ext/pdo_sqlite/pdo_sqlite.c b/ext/pdo_sqlite/pdo_sqlite.c
index 49a477998b..18fe71cce4 100644
--- a/ext/pdo_sqlite/pdo_sqlite.c
+++ b/ext/pdo_sqlite/pdo_sqlite.c
@@ -94,6 +94,7 @@ PHP_METHOD(Pdo_Sqlite, loadExtension)
 #ifdef ZTS
 	if ((strncmp(sapi_module.name, "cgi", 3) != 0) &&
 		(strcmp(sapi_module.name, "cli") != 0) &&
+		(strcmp(sapi_module.name, "micro") != 0) &&
 		(strncmp(sapi_module.name, "embed", 5) != 0)
 	) {
 		zend_throw_exception_ex(php_pdo_get_exception(), 0, "Not supported in multithreaded Web servers");
diff --git a/ext/readline/readline_cli.c b/ext/readline/readline_cli.c
index 80ddd88f7d..7b37aaff0b 100644
--- a/ext/readline/readline_cli.c
+++ b/ext/readline/readline_cli.c
@@ -730,7 +730,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 ((strlen(sapi_module.name) >= 3 && 0 == strncmp("cli", sapi_module.name, 3)) || 0 == strcmp("micro", sapi_module.name)) { \
 			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 0f26593b85..5f253f0061 100644
--- a/ext/sqlite3/sqlite3.c
+++ b/ext/sqlite3/sqlite3.c
@@ -408,7 +408,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, 0, "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 a5581d9ccc..98455f7b52 100644
--- a/ext/standard/php_fopen_wrapper.c
+++ b/ext/standard/php_fopen_wrapper.c
@@ -242,7 +242,7 @@ static php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const c
 			}
 			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 @@ static php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const c
 		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 @@ static php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const c
 		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 @@ static php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const c
 		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 d935f9d216..bac478144d 100644
--- a/ext/standard/proc_open.c
+++ b/ext/standard/proc_open.c
@@ -1274,7 +1274,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 a3acaf94b7..7ac56f9919 100644
--- a/main/main.c
+++ b/main/main.c
@@ -486,7 +486,7 @@ static PHP_INI_DISP(display_errors_mode)
 	mode = php_get_display_errors_mode(temporary_value);
 
 	/* 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:
@@ -1371,7 +1371,7 @@ static ZEND_COLD void php_error_cb(int orig_type, zend_string *error_filename, c
 					}
 				} else {
 					/* Write CLI/CGI errors to stderr if display_errors = "stderr" */
-					if ((!strcmp(sapi_module.name, "cli") || !strcmp(sapi_module.name, "cgi") || !strcmp(sapi_module.name, "phpdbg")) &&
+					if ((!strcmp(sapi_module.name, "cli") || !strcmp(sapi_module.name, "cgi") || !strcmp(sapi_module.name, "phpdbg") || !strcmp(sapi_module.name, "micro")) &&
 						PG(display_errors) == PHP_DISPLAY_ERRORS_STDERR
 					) {
 						fprintf(stderr, "%s: ", error_type_str);
diff --git a/win32/console.c b/win32/console.c
index 9b48561088..a2b764cdb5 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 (strlen(sapi_module.name) >= sizeof("cli") - 1 && !strncmp(sapi_module.name, "cli", sizeof("cli") - 1)) || 0 == strcmp(sapi_module.name, "micro");
 }/*}}}*/
 
