Index: /trunk/zoo-project/zoo-kernel/makefile.vc
===================================================================
--- /trunk/zoo-project/zoo-kernel/makefile.vc	(revision 711)
+++ /trunk/zoo-project/zoo-kernel/makefile.vc	(revision 712)
@@ -86,13 +86,15 @@
 	$(CPP) /EHsc /c $(CFLAGS) zoo_loader.c
 
+service_internal_php.obj: service_internal_php.c service_internal_php.h service.h
+	$(CPP) /c $(CFLAGS) $(PHP_CFLAGS) service_internal_php.c
 
 $(LIBZOO_SERVICE): service_internal.obj service.obj sqlapi.obj
 	link /dll /out:$(LIBZOO_SERVICE) ./service.obj ./service_internal.obj ./sqlapi.obj $(LDFLAGS) /FORCE:MULTIPLE
 
-$(PROGRAMNAME): version.h $(LIBZOO_SERVICE) zoo_loader.obj zoo_service_loader.obj service_internal.obj $(PY_FILE) $(JAVA_FILE) $(MS_FILE) $(JS_FILE) $(RUBY_FILE) ulinet.obj lex.cr.obj lex.sr.obj service_conf.tab.obj main_conf_read.tab.obj request_parser.obj response_print.obj server_internal.obj caching.obj
-	link zoo_loader.obj request_parser.obj response_print.obj server_internal.obj caching.obj $(PY_FILE) $(JAVA_FILE) $(MS_FILE) $(JS_FILE) $(RUBY_FILE) ulinet.obj main_conf_read.tab.obj lex.cr.obj service_conf.tab.obj lex.sr.obj  zoo_service_loader.obj ./libzoo_service.lib /out:$(PROGRAMNAME) $(LDFLAGS) $(LDFLAGSCGI) 
+$(PROGRAMNAME): version.h $(LIBZOO_SERVICE) zoo_loader.obj zoo_service_loader.obj service_internal.obj $(PY_FILE) $(JAVA_FILE) $(MS_FILE) $(JS_FILE) $(RUBY_FILE) $(PHP_FILE) ulinet.obj lex.cr.obj lex.sr.obj service_conf.tab.obj main_conf_read.tab.obj request_parser.obj response_print.obj server_internal.obj caching.obj
+	link zoo_loader.obj request_parser.obj response_print.obj server_internal.obj caching.obj $(PY_FILE) $(JAVA_FILE) $(MS_FILE) $(JS_FILE) $(RUBY_FILE) $(PHP_FILE) ulinet.obj main_conf_read.tab.obj lex.cr.obj service_conf.tab.obj lex.sr.obj  zoo_service_loader.obj ./libzoo_service.lib /out:$(PROGRAMNAME) $(LDFLAGS) $(LDFLAGSCGI) 
 
 zcfg2yaml: version.h zcfg2yaml.obj zoo_service_loader.obj service_internal.obj $(PY_FILE) $(JAVA_FILE) $(MS_FILE) $(JS_FILE) $(RUBY_FILE) ulinet.obj lex.cr.obj lex.sr.obj service_conf.tab.obj main_conf_read.tab.obj
-	link zcfg2yaml.obj server_internal.obj $(PY_FILE) $(JAVA_FILE) $(MS_FILE) $(JS_FILE) $(RUBY_FILE) ulinet.obj response_print.obj main_conf_read.tab.obj lex.cr.obj service_conf.tab.obj lex.sr.obj ./libzoo_service.lib /out:zcfg2yaml.exe $(LDFLAGS) $(LDFLAGSCGI)
+	link zcfg2yaml.obj server_internal.obj $(PY_FILE) $(JAVA_FILE) $(MS_FILE) $(JS_FILE) $(RUBY_FILE) $(PHP_FILE) ulinet.obj response_print.obj main_conf_read.tab.obj lex.cr.obj service_conf.tab.obj lex.sr.obj ./libzoo_service.lib /out:zcfg2yaml.exe $(LDFLAGS) $(LDFLAGSCGI)
 
 clean:
Index: /trunk/zoo-project/zoo-kernel/nmake.opt
===================================================================
--- /trunk/zoo-project/zoo-kernel/nmake.opt	(revision 711)
+++ /trunk/zoo-project/zoo-kernel/nmake.opt	(revision 712)
@@ -4,4 +4,10 @@
 CC=cl $(CFLAGS)
 CPP=cl /TP $(CFLAGS)
+
+#PY_DIR=C:/"Program Files (x86)"/Python3.3
+#PY_LIB=$(PY_DIR)/libs/python33.lib
+
+#PHP_DIR=C:\php-sdk\phpdev\vc12\x86\php-5.5.10-src
+#PHP_LIB=$(PHP_DIR)\Release_TS\php5embed.lib
 
 !IF DEFINED(MS_DIR)
@@ -32,4 +38,13 @@
 PY_LDFLAGS=$(PY_LIBRARY) 
 PY_FILE=service_internal_python.obj
+!ENDIF
+
+!IFDEF PHP_DIR
+PHP_LIB=$(PHP_DIR)\Release_TS\php5embed.lib
+PHP_CURL_LIB=$(PHP_DIR)\Release_TS\php_curl.lib
+PHP_SRC=$(PHP_DIR)
+PHP_LDFLAGS=$(PHP_LIB) $(PHP_CURL_LIB)
+PHP_FILE=service_internal_php.obj
+PHP_CFLAGS=-I$(PHP_SRC) -I$(PHP_SRC)\Zend -I$(PHP_SRC)\TSRM /DPHP_WIN32 /DZEND_WIN32 /DWIN32 /D_USE_32BIT_TIME_T /DZTS /DUSE_PHP
 !ENDIF
 
@@ -69,6 +84,6 @@
 !ENDIF
 
-CFLAGS= $(DB_FLAGS) $(MS_DEFS) $(INCLUDES) $(CFLAGS1) /nologo /MD /W3 /EHsc /Ox /D_CRT_SECURE_NO_WARNINGS /DWIN32 /DPROGRAMNAME=\"$(PROGRAMNAME)\" $(CJFLAGS) -I$(ZOOK_DIR) $(RUBY_CFLAGS) -I./ $(JAVA_CFLAGS) $(MS_CFLAGS) -I$(TROOT)\..\..\thirds\dirent-win32 -I$(INTL_DIR) -I$(CURL_DIR)\include -I$(XML2_DIR)\include -I$(GDAL_DIR)\port $(JS_CFLAGS) -I$(GDAL_DIR)\ogr -I$(GDAL_DIR)\gcore -I$(GD_DIR) -I$(ICONV_DIR) -I$(TROOT)\..\..\thirds\include -I$(TROOT)\..\..\thirds\cgic206 -I$(PYTHON_CPATH)\include -I$(SSL_DIR)/inc32 -I$(FCGI_DIR)\include $(PY_CFLAGS) -DLINUX_FREE_ISSUE #-DDEBUG #-DDEBUG_SERVICE_CONF
+CFLAGS= $(DB_FLAGS) $(MS_DEFS) $(INCLUDES) $(CFLAGS1) /nologo /MD /W3 /EHsc /Ox /D_CRT_SECURE_NO_WARNINGS /DWIN32 /DPROGRAMNAME=\"$(PROGRAMNAME)\" $(CJFLAGS) -I$(ZOOK_DIR) $(RUBY_CFLAGS) -I./ $(JAVA_CFLAGS) $(MS_CFLAGS) -I$(TROOT)\..\..\thirds\dirent-win32 -I$(INTL_DIR) -I$(CURL_DIR)\include -I$(XML2_DIR)\include -I$(GDAL_DIR)\port $(JS_CFLAGS) -I$(GDAL_DIR)\ogr -I$(GDAL_DIR)\gcore -I$(GD_DIR) -I$(ICONV_DIR) -I$(TROOT)\..\..\thirds\include -I$(TROOT)\..\..\thirds\cgic206 -I$(PYTHON_CPATH)\include -I$(SSL_DIR)/inc32 -I$(FCGI_DIR)\include $(PY_CFLAGS) $(PHP_CFLAGS) -DLINUX_FREE_ISSUE #-DDEBUG #-DDEBUG_SERVICE_CONF
 
 LDFLAGSCGI=$(TROOT)/../../thirds/cgic206/libcgic.lib 
-LDFLAGS=$(FCGI_DIR)/libfcgi/Release/libfcgi.lib $(CURL_LIBRARY) $(PY_LDFLAGS) $(XML2_LIBRARY) $(SSL_DIR)/out32dll/libeay32.lib $(JAVA_LDFLAGS) $(SSL_DIR)/out32dll/ssleay32.lib $(MS_LDFLAGS) $(INTL_DIR)/intl.lib $(XML2_DIR)/win32/bin.msvc/libxml2.lib $(GDAL_DIR)/gdal_i.lib $(CURL_DIR)/lib/libcurl.lib $(JS_LDFLAGS) $(RUBY_LDFLAGS) /machine:i386
+LDFLAGS=$(FCGI_DIR)/libfcgi/Release/libfcgi.lib $(CURL_LIBRARY) $(PY_LDFLAGS) $(XML2_LIBRARY) $(SSL_DIR)/out32dll/libeay32.lib $(JAVA_LDFLAGS) $(SSL_DIR)/out32dll/ssleay32.lib $(MS_LDFLAGS) $(INTL_DIR)/intl.lib $(XML2_DIR)/win32/bin.msvc/libxml2.lib $(GDAL_DIR)/gdal_i.lib $(CURL_DIR)/lib/libcurl.lib $(JS_LDFLAGS) $(RUBY_LDFLAGS) $(PHP_LDFLAGS) /machine:i386
Index: /trunk/zoo-project/zoo-kernel/service.c
===================================================================
--- /trunk/zoo-project/zoo-kernel/service.c	(revision 711)
+++ /trunk/zoo-project/zoo-kernel/service.c	(revision 712)
@@ -24,4 +24,23 @@
 
 #include "service.h"
+
+#ifdef _MSC_VER
+#include <stdarg.h>
+/**
+ * snprintf for Visual Studio compiler.
+ *
+ * See https://dxr.mozilla.org/mozilla-central/source/media/mtransport/third_party/nrappkit/src/util/util.c
+ */
+int snprintf(char *buffer, size_t n, const char *format, ...)
+{
+  va_list argp;
+  int ret;
+  va_start(argp, format);
+  ret = _vscprintf(format, argp);
+  vsnprintf_s(buffer, n, _TRUNCATE, format, argp);
+  va_end(argp);
+  return ret;
+}
+#endif
 
 /**
Index: /trunk/zoo-project/zoo-kernel/service.h
===================================================================
--- /trunk/zoo-project/zoo-kernel/service.h	(revision 711)
+++ /trunk/zoo-project/zoo-kernel/service.h	(revision 712)
@@ -38,6 +38,6 @@
 #define strncasecmp _strnicmp
 #define strcasecmp _stricmp
-#else
-#define snprintf sprintf_s
+//#else
+//#define snprintf sprintf_s
 #endif
 #define zStrdup _strdup
@@ -64,4 +64,5 @@
   return 0; // The gettimeofday() function shall return 0 on success
 }
+
 #else
 /**
@@ -106,7 +107,7 @@
 #include <stdlib.h>
 #include <ctype.h>
-#ifndef WIN32
+
 #include <stdio.h>
-#endif
+
 #include <string.h>
 #ifndef WIN32
@@ -323,5 +324,9 @@
   ZOO_DLL_EXPORT void mapsToCharXXX(maps*,char***);
   ZOO_DLL_EXPORT void charxxxToMaps(char***,maps**);
-
+#ifdef _MSC_VER
+  // snprintf for Visual Studio compiler;
+  // it is also used by services (e.g., GetStatus), therefore exported to shared library
+  ZOO_DLL_EXPORT int snprintf(char *buffer, size_t n, const char *format, ...);
+#endif  
 #ifdef __cplusplus
 }
Index: /trunk/zoo-project/zoo-kernel/service_internal.c
===================================================================
--- /trunk/zoo-project/zoo-kernel/service_internal.c	(revision 711)
+++ /trunk/zoo-project/zoo-kernel/service_internal.c	(revision 712)
@@ -686,5 +686,6 @@
 char *readVSIFile(maps* conf,const char* dataSource){
     VSILFILE * fichier=VSIFOpenL(dataSource,"rb");
-    VSIStatBuf file_status;
+    //VSIStatBuf file_status;
+	VSIStatBufL file_status;
     VSIStatL(dataSource, &file_status);
     if(fichier==NULL){
Index: /trunk/zoo-project/zoo-kernel/service_internal_php.c
===================================================================
--- /trunk/zoo-project/zoo-kernel/service_internal_php.c	(revision 711)
+++ /trunk/zoo-project/zoo-kernel/service_internal_php.c	(revision 712)
@@ -30,9 +30,10 @@
   #define ZEND_DEBUG 0
 #endif  
- 
-#include "service_internal_php.h"
 
 #include <sapi/embed/php_embed.h>
 #include <zend_stream.h>
+
+#include "service_internal_php.h"
+#include "response_print.h"
 
 zval *php_Array_from_maps(maps* t);
@@ -187,5 +188,5 @@
   getcwd(ntmp,1024);
     
-  map* libp = getMapFromMaps(m, "main", "libPath"); // KLa  
+  map* libp = getMapFromMaps(m, "main", "libPath");  
   int res=SERVICE_FAILED;
 
Index: /trunk/zoo-project/zoo-kernel/zoo_service_loader.c
===================================================================
--- /trunk/zoo-project/zoo-kernel/zoo_service_loader.c	(revision 711)
+++ /trunk/zoo-project/zoo-kernel/zoo_service_loader.c	(revision 712)
@@ -394,5 +394,5 @@
 
   map* libp = getMapFromMaps(m, "main", "libPath");
-  
+
   if (strlen (r_inputs->value) == 1
       && strncasecmp (r_inputs->value, "C", 1) == 0)
@@ -604,8 +604,7 @@
   else
 #endif
-
 #ifdef USE_PYTHON
   if (strncasecmp (r_inputs->value, "PYTHON", 6) == 0)
-    {
+    {	  
       *eres =
         zoo_python_support (&m, request_inputs, s1,
Index: /trunk/zoo-project/zoo-services/utils/status/makefile.vc
===================================================================
--- /trunk/zoo-project/zoo-services/utils/status/makefile.vc	(revision 711)
+++ /trunk/zoo-project/zoo-services/utils/status/makefile.vc	(revision 712)
Index: /trunk/zoo-project/zoo-services/utils/status/service.c
===================================================================
--- /trunk/zoo-project/zoo-services/utils/status/service.c	(revision 711)
+++ /trunk/zoo-project/zoo-services/utils/status/service.c	(revision 712)
@@ -51,5 +51,5 @@
    * return the final ExecuteResponse stored on the Server file system.
    */
-  ZOO_DLL_EXPORT int GetStatus(maps*& conf,maps*& inputs,maps*& outputs){
+  ZOO_DLL_EXPORT int GetStatus(maps*& conf,maps*& inputs,maps*& outputs){	  
     const char *params[4 + 1];
     int xmlLoadExtDtdDefaultValue;
