diff --git a/TSRM/tsrm_win32.c b/TSRM/tsrm_win32.c
index 4c8fc9d1..8284ac2f 100644
--- a/TSRM/tsrm_win32.c
+++ b/TSRM/tsrm_win32.c
@@ -535,7 +535,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 10fc11f5..eb4d4175 100644
--- a/ext/ffi/ffi.c
+++ b/ext/ffi/ffi.c
@@ -5478,7 +5478,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 f597df36..ec617af7 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -2847,6 +2847,7 @@ static void zps_startup_failure(const char *reason, const char *api_reason, int
 static inline bool accel_sapi_is_cli(void)
 {
 	return strcmp(sapi_module.name, "cli") == 0
+	    || strcmp(sapi_module.name, "micro") == 0
 		|| strcmp(sapi_module.name, "phpdbg") == 0;
 }
 
@@ -3163,6 +3164,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, "micro") == 0 ||
 	     strcmp(sapi_module.name, "cli-server") == 0 ||
 		 strcmp(sapi_module.name, "cgi-fcgi") == 0 ||
 		 strcmp(sapi_module.name, "fpm-fcgi") == 0)) {
@@ -4958,6 +4960,7 @@ static zend_result accel_finish_startup_preload_subprocess(pid_t *pid)
 	 || !*ZCG(accel_directives).preload_user) {
 
 		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 023e35a2..6f00159a 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 31212999..d7705d59 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 21b6840a..05a7aa8e 100644
--- a/ext/sqlite3/sqlite3.c
+++ b/ext/sqlite3/sqlite3.c
@@ -413,6 +413,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, "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 ea33ba49..083184b8 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 690e23e0..80ab3d32 100644
--- a/ext/standard/proc_open.c
+++ b/ext/standard/proc_open.c
@@ -1333,7 +1333,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 8465b6c0..cf8f9ef0 100644
--- a/main/main.c
+++ b/main/main.c
@@ -580,7 +580,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:
@@ -1470,7 +1470,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 9b485610..a2b764cd 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");
 }/*}}}*/
 
