summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
Diffstat (limited to 'win32')
-rwxr-xr-xwin32/EngineSelect.bat5
-rw-r--r--win32/EngineSelect.dsp85
-rw-r--r--win32/build/DSP.README37
-rw-r--r--win32/build/Makefile214
-rw-r--r--win32/build/Makefile.phpize38
-rw-r--r--win32/build/block.template.dsw15
-rw-r--r--win32/build/buildconf.js274
-rw-r--r--win32/build/config.w32446
-rw-r--r--win32/build/config.w32.h.in176
-rw-r--r--win32/build/config.w32.phpize.in358
-rw-r--r--win32/build/configure.bat2
-rw-r--r--win32/build/configure.tail11
-rw-r--r--win32/build/confutils.js2048
-rw-r--r--win32/build/cvsclean.js120
-rw-r--r--win32/build/deplister.c60
-rw-r--r--win32/build/libs_version.txt16
-rw-r--r--win32/build/mkdist.php548
-rw-r--r--win32/build/php.icobin0 -> 1718 bytes
-rw-r--r--win32/build/phpize.bat6
-rw-r--r--win32/build/phpize.js.in260
-rw-r--r--win32/build/projectgen.js625
-rwxr-xr-xwin32/build/registersyslog.php44
-rw-r--r--win32/build/svnclean.js120
-rw-r--r--win32/build/template.dsp81
-rw-r--r--win32/build/template.dsw63
-rw-r--r--win32/build/template.rc87
-rwxr-xr-xwin32/build/wsyslog.mc28
-rw-r--r--win32/builddef.bat7
-rw-r--r--win32/flock.c84
-rw-r--r--win32/flock.h11
-rw-r--r--win32/fnmatch.c198
-rw-r--r--win32/fnmatch.h54
-rw-r--r--win32/glob.c924
-rw-r--r--win32/glob.h102
-rw-r--r--win32/globals.c73
-rw-r--r--win32/grp.h26
-rw-r--r--win32/inet.c88
-rw-r--r--win32/inet.h10
-rw-r--r--win32/install.txt1939
-rw-r--r--win32/param.h16
-rw-r--r--win32/php5.dsp134
-rw-r--r--win32/php5.dsw107
-rw-r--r--win32/php5dll.dsp1651
-rw-r--r--win32/php5dllts.dsp2727
-rw-r--r--win32/php5dllts.rc126
-rw-r--r--win32/php5dllts.rc261
-rw-r--r--win32/php5ts.dsp191
-rw-r--r--win32/php5ts.dsw227
-rw-r--r--win32/php5ts.rc126
-rw-r--r--win32/php5ts.rc261
-rw-r--r--win32/php5ts_cli.dsp175
-rw-r--r--win32/php5ts_cli.rc126
-rw-r--r--win32/php5ts_cli.rc261
-rw-r--r--win32/php_modules.dsw473
-rw-r--r--win32/php_registry.h8
-rw-r--r--win32/php_stdbool.h11
-rw-r--r--win32/php_stdint.h251
-rw-r--r--win32/php_strtoi64.h7
-rw-r--r--win32/php_win32_globals.h55
-rw-r--r--win32/pws-php5cgi.reg6
-rw-r--r--win32/pws-php5isapi.reg5
-rw-r--r--win32/readdir.c168
-rw-r--r--win32/readdir.h49
-rw-r--r--win32/registry.c297
-rw-r--r--win32/resource.h15
-rw-r--r--win32/select.c176
-rw-r--r--win32/select.h22
-rw-r--r--win32/sendmail.c989
-rw-r--r--win32/sendmail.h51
-rw-r--r--win32/signal.h16
-rw-r--r--win32/sockets.c71
-rw-r--r--win32/sockets.h26
-rw-r--r--win32/strtoi64.c122
-rw-r--r--win32/syslog.h78
-rw-r--r--win32/syslog.reg5
-rw-r--r--win32/testsuite.dsp150
-rw-r--r--win32/time.c245
-rw-r--r--win32/time.h53
-rw-r--r--win32/unistd.h4
-rw-r--r--win32/winutil.c127
-rw-r--r--win32/winutil.h31
-rw-r--r--win32/wsyslog.c136
82 files changed, 18719 insertions, 0 deletions
diff --git a/win32/EngineSelect.bat b/win32/EngineSelect.bat
new file mode 100755
index 0000000..0785bd1
--- /dev/null
+++ b/win32/EngineSelect.bat
@@ -0,0 +1,5 @@
+@if exist ..\ZendEngine2\OBJECTS2_HOWTO (
+move ..\Zend ..\ZendEngine1
+move ..\ZendEngine2 ..\Zend
+echo "PLEASE RESTART VISUAL C++ TO RELOAD THE ZEND PROJECT."
+exit 1 )
diff --git a/win32/EngineSelect.dsp b/win32/EngineSelect.dsp
new file mode 100644
index 0000000..4aee213
--- /dev/null
+++ b/win32/EngineSelect.dsp
@@ -0,0 +1,85 @@
+# Microsoft Developer Studio Project File - Name="EngineSelect" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) External Target" 0x0106
+
+CFG=EngineSelect - Win32 Release
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "EngineSelect.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "EngineSelect.mak" CFG="EngineSelect - Win32 Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "EngineSelect - Win32 Release" (based on "Win32 (x86) External Target")
+!MESSAGE "EngineSelect - Win32 Debug" (based on "Win32 (x86) External Target")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+
+!IF "$(CFG)" == "EngineSelect - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Cmd_Line "NMAKE /f EngineSelect.mak"
+# PROP BASE Rebuild_Opt "/a"
+# PROP BASE Target_File "EngineSelect.exe"
+# PROP BASE Bsc_Name "EngineSelect.bsc"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Cmd_Line "EngineSelect.bat"
+# PROP Rebuild_Opt "/a"
+# PROP Target_File "EngineSelect.exe"
+# PROP Bsc_Name ""
+# PROP Target_Dir ""
+
+!ELSEIF "$(CFG)" == "EngineSelect - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Cmd_Line "NMAKE /f EngineSelect.mak"
+# PROP BASE Rebuild_Opt "/a"
+# PROP BASE Target_File "EngineSelect.exe"
+# PROP BASE Bsc_Name "EngineSelect.bsc"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Cmd_Line "EngineSelect.bat"
+# PROP Rebuild_Opt "/a"
+# PROP Target_File "EngineSelect.exe"
+# PROP Bsc_Name ""
+# PROP Target_Dir ""
+
+!ENDIF
+
+# Begin Target
+
+# Name "EngineSelect - Win32 Release"
+# Name "EngineSelect - Win32 Debug"
+
+!IF "$(CFG)" == "EngineSelect - Win32 Release"
+
+!ELSEIF "$(CFG)" == "EngineSelect - Win32 Debug"
+
+!ENDIF
+
+# End Target
+# End Project
diff --git a/win32/build/DSP.README b/win32/build/DSP.README
new file mode 100644
index 0000000..c673657
--- /dev/null
+++ b/win32/build/DSP.README
@@ -0,0 +1,37 @@
+MSVC++ project file generation
+==============================
+
+These files are only intended for use in debugging and profiling,
+but can be used to create working binaries. However, they are very
+unlikely to match the official PHP distributed binaries.
+
+With this in mind, the script will only generate basic .dsp files
+for the modules that are currently configured.
+
+The switch for project file generation is a buildconf switch and
+not a configure switch:
+
+> buildconf --add-project-files
+> configure ...
+
+The resulting workspace files should appear at /win32/phpdll[ts].dsw
+and (if any shared modules are configured) at /win32/php_modules.dsw,
+after configure is run.
+
+If the .dsw files haven't generated in a sane way, the most likely reason
+will be that the template files have become corrupted. They need DOS
+line endings (CR/LF) in order to function. The affected files are:
+
+/win32/build/block.template.dsw
+/win32/build/template.dsp
+/win32/build/template.dsw
+
+Simply save them with DOS line endings, and bug it to me if basic
+project file generation still fails (as in, you ran the command and
+configure again after saving, and you have a working copy of MSVS
+installed, but clicking on the workspace(s) doesn't give you anything).
+
+- Steph
+sfox@php.net
+
+July 2008
diff --git a/win32/build/Makefile b/win32/build/Makefile
new file mode 100644
index 0000000..e2d6254
--- /dev/null
+++ b/win32/build/Makefile
@@ -0,0 +1,214 @@
+# +----------------------------------------------------------------------+
+# | PHP Version 5 |
+# +----------------------------------------------------------------------+
+# | Copyright (c) 1997-2008 The PHP Group |
+# +----------------------------------------------------------------------+
+# | This source file is subject to version 3.01 of the PHP license, |
+# | that is bundled with this package in the file LICENSE, and is |
+# | available through the world-wide-web at the following url: |
+# | http://www.php.net/license/3_01.txt |
+# | If you did not receive a copy of the PHP license and are unable to |
+# | obtain it through the world-wide-web, please send a note to |
+# | license@php.net so we can mail you a copy immediately. |
+# +----------------------------------------------------------------------+
+# | Author: Wez Furlong <wez@thebrainroom.com> |
+# +----------------------------------------------------------------------+
+#
+# $Id$
+# This is the makefile template for the win32 build
+
+CC="$(PHP_CL)"
+LD="$(LINK)"
+MC="$(MC)"
+MT="$(MT)"
+RE2C="$(RE2C)"
+PGOMGR="$(PGOMGR)"
+PHP_BUILD=$(PHP_BUILD)
+
+MCFILE=$(BUILD_DIR)\wsyslog.rc
+BUILD_DIR_DEV_NAME=php-$(PHP_VERSION_STRING)-devel-$(PHP_COMPILER_SHORT)-$(PHP_ARCHITECTURE)
+BUILD_DIR_DEV=$(BUILD_DIR)\$(BUILD_DIR_DEV_NAME)
+
+all: generated_files $(EXT_TARGETS) $(PECL_TARGETS) $(SAPI_TARGETS)
+
+build_dirs: $(BUILD_DIR) $(BUILD_DIRS_SUB) $(BUILD_DIR_DEV)
+
+!if $(RE2C) == ""
+generated_files: build_dirs Zend\zend_ini_parser.c \
+ Zend\zend_language_parser.c \
+ $(PHPDEF) $(MCFILE)
+!else
+generated_files: build_dirs Zend\zend_ini_parser.c \
+ Zend\zend_language_parser.c Zend\zend_ini_scanner.c \
+ Zend\zend_language_scanner.c \
+ $(PHPDEF) $(MCFILE)
+!endif
+
+$(BUILD_DIR)\$(PHPDLL).def: $(PHP_DLL_DEF_SOURCES)
+ type $(PHP_DLL_DEF_SOURCES) > $(BUILD_DIR)\$(PHPDLL).def
+
+Zend\zend_ini_parser.c Zend\zend_ini_parser.h: Zend\zend_ini_parser.y
+ $(BISON) --output=Zend/zend_ini_parser.c -v -d -p ini_ Zend/zend_ini_parser.y
+
+Zend\zend_language_parser.c Zend\zend_language_parser.h: Zend\zend_language_parser.y
+ $(BISON) --output=Zend/zend_language_parser.c -v -d -p zend Zend/zend_language_parser.y
+
+!if $(RE2C) != ""
+Zend\zend_ini_scanner.c: Zend\zend_ini_scanner.l
+ $(RE2C) $(RE2C_FLAGS) --case-inverted -cbdFt Zend/zend_ini_scanner_defs.h -oZend/zend_ini_scanner.c Zend/zend_ini_scanner.l
+
+Zend\zend_language_scanner.c: Zend\zend_language_scanner.l
+ $(RE2C) $(RE2C_FLAGS) --case-inverted -cbdFt Zend/zend_language_scanner_defs.h -oZend/zend_language_scanner.c Zend/zend_language_scanner.l
+!endif
+
+!if $(PGOMGR) != ""
+PHP5_PGD_OPTION=/PGD:$(PGOPGD_DIR)\php5.pgd
+!else
+PHP5_PGD_OPTION=
+!endif
+
+PHPDLL_RES=$(BUILD_DIR)\$(PHPDLL).res
+
+$(MCFILE): win32\build\wsyslog.mc
+ $(MC) -h win32\ -r $(BUILD_DIR)\ -x $(BUILD_DIR)\ win32\build\wsyslog.mc
+
+# $(RC) /fo $(MCFILE) $(BUILD_DIR)\wsyslog.rc
+
+!if $(MT) == ""
+_VC_MANIFEST_EMBED_EXE=
+_VC_MANIFEST_EMBED_DLL=
+!else
+_VC_MANIFEST_EMBED_EXE= if exist $@.manifest $(MT) -nologo -manifest $@.manifest -outputresource:$@;1
+_VC_MANIFEST_EMBED_DLL= if exist $@.manifest $(MT) -nologo -manifest $@.manifest -outputresource:$@;2
+!endif
+
+$(PHPDLL_RES): win32\build\template.rc
+ $(RC) /fo $(PHPDLL_RES) /d FILE_DESCRIPTION="\"PHP Script Interpreter\"" \
+ /d FILE_NAME="\"$(PHPDLL)\"" /d PRODUCT_NAME="\"PHP Script Interpreter\"" \
+ /I$(BUILD_DIR) /d MC_INCLUDE="\"$(MCFILE)\"" \
+ win32\build\template.rc
+
+$(BUILD_DIR)\$(PHPDLL): generated_files $(PHPDEF) $(PHP_GLOBAL_OBJS) $(STATIC_EXT_OBJS) $(PHPDLL_RES) $(MCFILE)
+ @$(CC) $(PHP_GLOBAL_OBJS) $(STATIC_EXT_OBJS) $(STATIC_EXT_LIBS) $(LIBS) $(PHPDLL_RES) /link /out:$(BUILD_DIR)\$(PHPDLL) $(PHP5_PGD_OPTION) $(PHP_LDFLAGS) $(LDFLAGS) $(STATIC_EXT_LDFLAGS)
+ -@$(_VC_MANIFEST_EMBED_DLL)
+
+$(BUILD_DIR)\$(PHPLIB): $(BUILD_DIR)\$(PHPDLL)
+
+$(BUILD_DIR) $(BUILD_DIRS_SUB) $(BUILD_DIR_DEV):
+ @echo Recreating build dirs
+ @if not exist $(BUILD_DIR) mkdir $(BUILD_DIR)
+ @cd $(BUILD_DIR)
+ @for %D in ($(BUILD_DIRS_SUB)) do @if not exist %D @mkdir %D > NUL
+ @if not exist $(BUILD_DIR_DEV) @mkdir $(BUILD_DIR_DEV) > NUL
+ @cd "$(PHP_SRC_DIR)"
+
+
+clean-sapi:
+ @echo Cleaning SAPI
+ @for %D in (_x $(EXT_TARGETS)) do @if exist $(BUILD_DIR)\%D @del /F /Q $(BUILD_DIR)\%D > NUL
+ @for %D in (_x $(PECL_TARGETS)) do @if exist $(BUILD_DIR)\%D @del /F /Q $(BUILD_DIR)\%D > NUL
+ @for %D in (_x $(SAPI_TARGETS)) do @if exist $(BUILD_DIR)\%D @del /F /Q $(BUILD_DIR)\%D > NUL
+ -@del /F /Q $(BUILD_DIR)\$(PHPDLL)
+
+clean: clean-sapi
+ @echo Cleaning distribution build dirs
+ @cd $(BUILD_DIR)
+ @for %D in (_x $(BUILD_DIRS_SUB)) do @if exist %D @del /F /Q %D\*.* > NUL
+ @cd "$(PHP_SRC_DIR)"
+ -@del /F /Q $(BUILD_DIR)\*.res $(BUILD_DIR)\*.lib $(BUILD_DIR)\*.ilk $(BUILD_DIR)\*.pdb $(BUILD_DIR)\*.exp $(PHPDEF) $(BUILD_DIR)\php-$(PHP_VERSION_STRING)-Win32.zip $(BUILD_DIR)\pecl-$(PHP_VERSION_STRING)-Win32.zip > NUL
+ -rd /s /q $(BUILD_DIR)\php-$(PHP_VERSION_STRING)
+
+clean-pecl:
+ @echo Cleaning PECL targets only
+ -rd /s /q $(BUILD_DIR)\pecl
+
+clean-all:
+ @echo Cleaning standard build dirs
+ @cd $(BUILD_DIR)
+ @for %D in (_x $(BUILD_DIRS_SUB)) do @if exist %D @rd /s /q %D
+ @cd "$(PHP_SRC_DIR)"
+ -@del /f /q $(BUILD_DIR)\*.res $(BUILD_DIR)\*.lib $(BUILD_DIR)\*.ilk $(BUILD_DIR)\*.pdb $(BUILD_DIR)\*.exp $(PHPDEF) $(BUILD_DIR)\*.rc $(BUILD_DIR)\*.manifest $(BUILD_DIR)\*.dbg $(BUILD_DIR)\*.bin $(BUILD_DIR)\php*.dll $(BUILD_DIR)\php*.exe > NUL
+
+clean-pgo: clean-all
+ -rd /s /q $(BUILD_DIR)\php-$(PHP_VERSION_STRING)
+ -rd /s /q $(BUILD_DIR)\pecl-$(PHP_VERSION_STRING)
+ -rd /s /q $(BUILD_DIR)\php-test-pack-$(PHP_VERSION_STRING)
+ -del /f /q $(BUILD_DIR)\php-$(PHP_VERSION_STRING)$(PHP_ZTS_ARCHIVE_POSTFIX)-Win32-$(PHP_COMPILER_SHORT)-$(PHP_ARCHITECTURE).zip
+ -del /f /q $(BUILD_DIR)\php-debug-pack-$(PHP_VERSION_STRING)$(PHP_ZTS_ARCHIVE_POSTFIX)-Win32-$(PHP_COMPILER_SHORT)-$(PHP_ARCHITECTURE).zip
+ -del /f /q $(BUILD_DIR)\pecl-$(PHP_VERSION_STRING)$(PHP_ZTS_ARCHIVE_POSTFIX)-Win32-$(PHP_COMPILER_SHORT)-$(PHP_ARCHITECTURE).zip
+ -del /f /q $(BUILD_DIR)\php-test-pack-$(PHP_VERSION_STRING).zip
+
+test:
+ "$(BUILD_DIR)\php.exe" -d open_basedir= -d output_buffering=0 run-tests.php $(TESTS) -p "$(BUILD_DIR)\php.exe"
+
+build-snap: generated_files
+ SET PATH=$(PATH);$(PHP_BUILD)\bin
+ @$(MAKE) "$(BUILD_DIR)\$(PHPDLL)"
+ -for %T in ($(SAPI_TARGETS)) do $(MAKE) /I /nologo "%T"
+ -for %T in ($(EXT_TARGETS)) do $(MAKE) /I /nologo "%T"
+ -for %T in ($(PECL_TARGETS)) do $(MAKE) /I /nologo "%T"
+
+build-dist: $(BUILD_DIR)\deplister.exe
+ -rd /s /q $(BUILD_DIR)\php-$(PHP_VERSION_STRING)
+ -rd /s /q $(BUILD_DIR)\pecl-$(PHP_VERSION_STRING)
+ -del /f /q $(BUILD_DIR)\php-$(PHP_VERSION_STRING)$(PHP_ZTS_ARCHIVE_POSTFIX)-Win32-$(PHP_COMPILER_SHORT)-$(PHP_ARCHITECTURE).zip
+ -del /f /q $(BUILD_DIR)\php-debug-pack-$(PHP_VERSION_STRING)$(PHP_ZTS_ARCHIVE_POSTFIX)-Win32-$(PHP_COMPILER_SHORT)-$(PHP_ARCHITECTURE).zip
+ -del /f /q $(BUILD_DIR)\pecl-$(PHP_VERSION_STRING)$(PHP_ZTS_ARCHIVE_POSTFIX)-Win32-$(PHP_COMPILER_SHORT)-$(PHP_ARCHITECTURE).zip
+ $(BUILD_DIR)\php.exe -d date.timezone=UTC -n -dphar.readonly=0 win32/build/mkdist.php "$(BUILD_DIR)" "$(PHP_BUILD)" "$(PHPDLL)" "$(SAPI_TARGETS)" "$(EXT_TARGETS) $(PHP_EXTRA_DIST_FILES)" "$(PECL_TARGETS) $(PECL_EXTRA_DIST_FILES)" "$(SNAPSHOT_TEMPLATE)"
+ cd $(BUILD_DIR)\php-$(PHP_VERSION_STRING)
+ -$(ZIP) -9 -q -r ..\php-$(PHP_VERSION_STRING)$(PHP_ZTS_ARCHIVE_POSTFIX)-Win32-$(PHP_COMPILER_SHORT)-$(PHP_ARCHITECTURE).zip .
+ cd ..\..
+ cd $(BUILD_DIR)\pecl-$(PHP_VERSION_STRING)
+ -$(ZIP) -9 -q -r ..\pecl-$(PHP_VERSION_STRING)$(PHP_ZTS_ARCHIVE_POSTFIX)-Win32-$(PHP_COMPILER_SHORT)-$(PHP_ARCHITECTURE).zip .
+ cd ..\..
+ cd $(BUILD_DIR)\php-test-pack-$(PHP_VERSION_STRING)
+ -$(ZIP) -9 -q -r ..\php-test-pack-$(PHP_VERSION_STRING).zip .
+ cd ..\..
+ cd $(BUILD_DIR)
+ -$(ZIP) -9 -q php-debug-pack-$(PHP_VERSION_STRING)$(PHP_ZTS_ARCHIVE_POSTFIX)-Win32-$(PHP_COMPILER_SHORT)-$(PHP_ARCHITECTURE).zip *.pdb
+ cd
+ cd
+ -$(ZIP) -9 -q -r php-devel-pack-$(PHP_VERSION_STRING)$(PHP_ZTS_ARCHIVE_POSTFIX)-Win32-$(PHP_COMPILER_SHORT)-$(PHP_ARCHITECTURE).zip $(BUILD_DIR_DEV_NAME)
+ cd ..\..
+
+dist: all build-dist
+snap: build-snap build-devel build-dist
+
+$(BUILD_DIR)\deplister.exe: win32\build\deplister.c
+ $(PHP_CL) /Fo$(BUILD_DIR)\ /Fd$(BUILD_DIR)\ /Fp$(BUILD_DIR)\ /FR$(BUILD_DIR) /Fe$(BUILD_DIR)\deplister.exe win32\build\deplister.c imagehlp.lib
+
+msi-installer: dist
+ $(BUILD_DIR)\php.exe ..\php-installer\build-installer.php "$(BUILD_DIR)" "$(PHPDLL)" "$(SAPI_TARGETS)" "$(EXT_TARGETS)" "$(PECL_TARGETS)"
+
+# need to redirect, since INSTALL is a file in the root...
+install: really-install install-sdk
+
+build-lib:
+ @if not exist $(BUILD_DIR_DEV)\lib mkdir $(BUILD_DIR_DEV)\lib >nul
+ @copy $(BUILD_DIR)\$(PHPLIB) $(BUILD_DIR_DEV)\lib /y >nul
+
+build-devel: build-headers build-lib
+ @if not exist $(BUILD_DIR_DEV)\script mkdir $(BUILD_DIR_DEV)\script >nul
+ @if not exist $(BUILD_DIR_DEV)\build mkdir $(BUILD_DIR_DEV)\build >nul
+ @copy win32\build\confutils.js $(BUILD_DIR_DEV)\script\ /y >nul
+ @copy win32\build\configure.tail $(BUILD_DIR_DEV)\script\ /y >nul
+ @copy win32\build\config.w32.phpize.in $(BUILD_DIR_DEV)\script\ /y >nul
+ @copy win32\build\Makefile.phpize $(BUILD_DIR_DEV)\script\ /y >nul
+ @copy win32\build\phpize.bat $(BUILD_DIR_DEV)\ /y >nul
+ @copy win32\build\template.rc $(BUILD_DIR_DEV)\build\ /y >nul
+ @copy $(BUILD_DIR)\devel\config.phpize.js $(BUILD_DIR_DEV)\script\ /y >nul
+ @copy $(BUILD_DIR)\devel\phpize.js $(BUILD_DIR_DEV)\script\ /y >nul
+ @copy $(BUILD_DIR)\devel\ext_deps.js $(BUILD_DIR_DEV)\script\ /y >nul
+
+install-sdk: build-devel
+ @xcopy /Q /Y /E /I $(BUILD_DIR_DEV)\* $(PHP_PREFIX)\SDK
+
+really-install:
+ @if not exist $(PHP_PREFIX) mkdir $(PHP_PREFIX)
+ @echo Installing files under $(PHP_PREFIX)
+ @copy $(BUILD_DIR)\*.exe $(PHP_PREFIX) /y >nul
+ @copy $(BUILD_DIR)\*.dll $(PHP_PREFIX) /y >nul
+ @echo Registering event source with syslog (requires admin rights)
+ @echo It's okay for this step to fail:
+ -$(PHP_PREFIX)\php.exe -n -dextension_dir=$(PHP_PREFIX) win32/build/registersyslog.php $(PHP_PREFIX)\$(PHPDLL)
+
diff --git a/win32/build/Makefile.phpize b/win32/build/Makefile.phpize
new file mode 100644
index 0000000..17cfc90
--- /dev/null
+++ b/win32/build/Makefile.phpize
@@ -0,0 +1,38 @@
+CC="$(PHP_CL)"
+LD="$(LINK)"
+MC="$(MC)"
+MT="$(MT)"
+
+PHPSDK_DIR=$(PHP_DIR)
+PHPLIB=$(PHPSDK_DIR)\lib\$(PHPLIB)
+LDFLAGS=/libpath:"$(PHPSDK_DIR)\lib\;$(PHPSDK_DIR)"
+
+CFLAGS=/nologo /FD $(BASE_INCLUDES) /D _WINDOWS /D ZEND_WIN32=1 /D PHP_WIN32=1 /D WIN32 /D_USE_32BIT_TIME_T=1 /D ZEND_WIN32_FORCE_INLINE /GF /D ZEND_DEBUG=0 /D ZTS=1 /D FD_SETSIZE=256
+CFLAGS_PHP=/D _USRDLL /D PHP5DLLTS_EXPORTS /D PHP_EXPORTS /D TSRM_EXPORTS /D SAPI_EXPORTS /D WINVER=0x500 /D COMPILE_DL_AJAXMIN
+
+all: $(EXT_TARGETS) $(PECL_TARGETS)
+
+build_dirs: $(BUILD_DIR) $(BUILD_DIRS_SUB)
+
+clean-pecl:
+ @echo Cleaning PECL targets only
+ -rd /s /q $(BUILD_DIR)\pecl
+
+clean-all:
+ @echo Cleaning standard build dirs
+ @for %D in (_x $(BUILD_DIRS_SUB)) do @if exist %D @rd /s /q %D
+ -@del /f /q $(BUILD_DIR)\*.res $(BUILD_DIR)\*.manifest $(BUILD_DIR)\*.lib $(BUILD_DIR)\*.ilk $(BUILD_DIR)\*.pdb $(BUILD_DIR)\*.exp $(PHPDEF) $(BUILD_DIR)\*.rc $(BUILD_DIR)\*.dbg $(BUILD_DIR)\*.bin $(BUILD_DIR)\php*.dll $(BUILD_DIR)\php*.exe > NUL
+
+clean: clean-pecl
+ @echo Cleaning distribution build dirs
+ @for %D in (_x $(BUILD_DIRS_SUB)) do @if exist %D @del /F /Q %D\*.* > NUL
+ -@del /F /Q $(BUILD_DIR)\*.res $(BUILD_DIR)\*.lib $(BUILD_DIR)\*.ilk $(BUILD_DIR)\*.pdb $(BUILD_DIR)\*.exp $(PHPDEF) $(BUILD_DIR)\php-$(PHP_VERSION_STRING)-Win32.zip $(BUILD_DIR)\pecl-$(PHP_VERSION_STRING)-Win32.zip > NUL
+
+!if $(MT) == ""
+_VC_MANIFEST_EMBED_EXE=
+_VC_MANIFEST_EMBED_DLL=
+!else
+_VC_MANIFEST_EMBED_EXE= if exist $@.manifest $(MT) -nologo -manifest $@.manifest -outputresource:$@;1
+_VC_MANIFEST_EMBED_DLL= if exist $@.manifest $(MT) -nologo -manifest $@.manifest -outputresource:$@;2
+!endif
+
diff --git a/win32/build/block.template.dsw b/win32/build/block.template.dsw
new file mode 100644
index 0000000..2f2682d
--- /dev/null
+++ b/win32/build/block.template.dsw
@@ -0,0 +1,15 @@
+
+Project: "EXTNAME"=..\ADDRESS - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name php5ts
+ End Project Dependency
+}}}
+
+###############################################################################
diff --git a/win32/build/buildconf.js b/win32/build/buildconf.js
new file mode 100644
index 0000000..b4194ad
--- /dev/null
+++ b/win32/build/buildconf.js
@@ -0,0 +1,274 @@
+/*
+ +----------------------------------------------------------------------+
+ | PHP Version 5 |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1997-2008 The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Author: Wez Furlong <wez@thebrainroom.com> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id: buildconf.js,v 1.13.2.2.2.1.2.5 2009-01-02 12:18:21 kalle Exp $ */
+// This generates a configure script for win32 build
+
+WScript.StdOut.WriteLine("Rebuilding configure.js");
+var FSO = WScript.CreateObject("Scripting.FileSystemObject");
+var C = FSO.CreateTextFile("configure.js", true);
+var B = FSO.CreateTextFile("configure.bat", true);
+var DSP = false;
+
+var modules = "";
+var MODULES = WScript.CreateObject("Scripting.Dictionary");
+var module_dirs = new Array();
+
+function file_get_contents(filename)
+{
+ var F = FSO.OpenTextFile(filename, 1);
+ var t = F.ReadAll();
+ F.Close();
+ return t;
+}
+
+function Module_Item(module_name, config_path, dir_line, deps, content)
+{
+ this.module_name = module_name;
+ this.config_path = config_path;
+ this.dir_line = dir_line;
+ this.deps = deps;
+ this.content = content;
+}
+
+function find_config_w32(dirname)
+{
+ if (!FSO.FolderExists(dirname)) {
+ return;
+ }
+
+ var f = FSO.GetFolder(dirname);
+ var fc = new Enumerator(f.SubFolders);
+ var c, i, ok, n;
+ var item = null;
+ var re_dep_line = new RegExp("ADD_EXTENSION_DEP\\([^,]*\\s*,\\s*['\"]([^'\"]+)['\"].*\\)", "gm");
+
+ for (; !fc.atEnd(); fc.moveNext())
+ {
+ ok = true;
+ /* check if we already picked up a module with the same dirname;
+ * if we have, don't include it here */
+ n = FSO.GetFileName(fc.item());
+
+ if (n == '.svn' || n == 'tests')
+ continue;
+
+ // WScript.StdOut.WriteLine("checking " + dirname + "/" + n);
+ if (MODULES.Exists(n)) {
+ WScript.StdOut.WriteLine("Skipping " + dirname + "/" + n + " -- already have a module with that name");
+ continue;
+ }
+
+ c = FSO.BuildPath(fc.item(), "config.w32");
+ if (FSO.FileExists(c)) {
+// WScript.StdOut.WriteLine(c);
+
+ var dir_line = "configure_module_dirname = condense_path(FSO.GetParentFolderName('"
+ + c.replace(new RegExp('(["\\\\])', "g"), '\\$1') + "'));\r\n";
+ var contents = file_get_contents(c);
+ var deps = new Array();
+
+ // parse out any deps from the file
+ var calls = contents.match(re_dep_line);
+ if (calls != null) {
+ for (i = 0; i < calls.length; i++) {
+ // now we need the extension name out of this thing
+ if (calls[i].match(re_dep_line)) {
+// WScript.StdOut.WriteLine("n depends on " + RegExp.$1);
+ deps[deps.length] = RegExp.$1;
+
+ }
+ }
+ }
+
+ item = new Module_Item(n, c, dir_line, deps, contents);
+ MODULES.Add(n, item);
+ }
+ }
+}
+
+// Emit core modules array. This is used by a snapshot
+// build to override a default "yes" value so that external
+// modules don't break the build by becoming statically compiled
+function emit_core_module_list()
+{
+ var module_names = (new VBArray(MODULES.Keys())).toArray();
+ var i, mod_name, j;
+ var item;
+ var output = "";
+
+ C.WriteLine("core_module_list = new Array(");
+
+ // first, look for modules with empty deps; emit those first
+ for (i in module_names) {
+ mod_name = module_names[i];
+ C.WriteLine("\"" + mod_name.replace(/_/g, "-") + "\",");
+ }
+
+ C.WriteLine("false // dummy");
+
+ C.WriteLine(");");
+}
+
+
+function emit_module(item)
+{
+ return item.dir_line + item.content;
+}
+
+function emit_dep_modules(module_names)
+{
+ var i, mod_name, j;
+ var output = "";
+ var item = null;
+
+ for (i in module_names) {
+ mod_name = module_names[i];
+
+ if (MODULES.Exists(mod_name)) {
+ item = MODULES.Item(mod_name);
+ MODULES.Remove(mod_name);
+ if (item.deps.length) {
+ output += emit_dep_modules(item.deps);
+ }
+ output += emit_module(item);
+ }
+ }
+
+ return output;
+}
+
+function gen_modules()
+{
+ var module_names = (new VBArray(MODULES.Keys())).toArray();
+ var i, mod_name, j;
+ var item;
+ var output = "";
+
+ // first, look for modules with empty deps; emit those first
+ for (i in module_names) {
+ mod_name = module_names[i];
+ item = MODULES.Item(mod_name);
+ if (item.deps.length == 0) {
+ MODULES.Remove(mod_name);
+ output += emit_module(item);
+ }
+ }
+
+ // now we are left with modules that have dependencies on other modules
+ module_names = (new VBArray(MODULES.Keys())).toArray();
+ output += emit_dep_modules(module_names);
+
+ return output;
+}
+
+// Process buildconf arguments
+function buildconf_process_args()
+{
+ args = WScript.Arguments;
+
+ for (i = 0; i < args.length; i++) {
+ arg = args(i);
+ // If it is --foo=bar, split on the equals sign
+ arg = arg.split("=", 2);
+ argname = arg[0];
+ if (arg.length > 1) {
+ argval = arg[1];
+ } else {
+ argval = null;
+ }
+
+ if (argname == '--add-modules-dir' && argval != null) {
+ WScript.StdOut.WriteLine("Adding " + argval + " to the module search path");
+ module_dirs[module_dirs.length] = argval;
+ }
+
+ if (argname == '--add-project-files') {
+ WScript.StdOut.WriteLine("Adding dsp templates into the mix");
+ DSP = true;
+ }
+ }
+}
+
+buildconf_process_args();
+
+// Write the head of the configure script
+C.WriteLine("/* This file automatically generated from win32/build/confutils.js */");
+C.WriteLine("MODE_PHPIZE=false;");
+C.Write(file_get_contents("win32/build/confutils.js"));
+
+// If project files were requested, pull in the code to generate them
+if (DSP == true) {
+ C.WriteLine('PHP_DSP="yes"');
+ C.WriteBlankLines(1);
+ C.Write(file_get_contents("win32/build/projectgen.js"));
+} else {
+ C.WriteLine('PHP_DSP="no"');
+ C.WriteBlankLines(1);
+}
+
+// Pull in code from sapi and extensions
+modules = file_get_contents("win32/build/config.w32");
+
+// Pick up confs from TSRM and Zend if present
+find_config_w32(".");
+find_config_w32("sapi");
+find_config_w32("ext");
+emit_core_module_list();
+
+// If we have not specified any module dirs let's add some defaults
+if (module_dirs.length == 0) {
+ find_config_w32("pecl");
+ find_config_w32("..\\pecl");
+ find_config_w32("pecl\\rpc");
+ find_config_w32("..\\pecl\\rpc");
+} else {
+ for (i = 0; i < module_dirs.length; i++) {
+ find_config_w32(module_dirs[i]);
+ }
+}
+
+// Now generate contents of module based on MODULES, chasing dependencies
+// to ensure that dependent modules are emitted first
+modules += gen_modules();
+
+// Look for ARG_ENABLE or ARG_WITH calls
+re = new RegExp("(ARG_(ENABLE|WITH)\([^;]+\);)", "gm");
+calls = modules.match(re);
+for (i = 0; i < calls.length; i++) {
+ item = calls[i];
+ C.WriteLine("try {");
+ C.WriteLine(item);
+ C.WriteLine("} catch (e) {");
+ C.WriteLine('\tSTDOUT.WriteLine("problem: " + e);');
+ C.WriteLine("}");
+}
+
+C.WriteBlankLines(1);
+C.WriteLine("conf_process_args();");
+C.WriteBlankLines(1);
+
+// Comment out the calls from their original positions
+modules = modules.replace(re, "/* $1 */");
+C.Write(modules);
+
+C.WriteBlankLines(1);
+C.Write(file_get_contents("win32/build/configure.tail"));
+
+B.WriteLine("@echo off");
+B.WriteLine("cscript /nologo configure.js %*");
diff --git a/win32/build/config.w32 b/win32/build/config.w32
new file mode 100644
index 0000000..1a4b834
--- /dev/null
+++ b/win32/build/config.w32
@@ -0,0 +1,446 @@
+// vim:ft=javascript
+// $Id$
+// "Master" config file; think of it as a configure.in
+// equivalent.
+
+ARG_WITH('cygwin', 'Path to cygwin utilities on your system', '\\cygwin');
+PHP_CL = PATH_PROG('cl', null, 'PHP_CL');
+if (!PHP_CL) {
+ ERROR("MS C++ compiler is required");
+}
+
+/* For the record here: */
+// 1200 is VC6
+// 1300 is vs.net 2002
+// 1310 is vs.net 2003
+// 1400 is vs.net 2005
+// 1500 is vs.net 2008
+// 1600 is vs.net 2010
+// Which version of the compiler do we have?
+VCVERS = probe_binary(PHP_CL).substr(0, 5).replace('.', '');
+STDOUT.WriteLine(" Detected compiler " + VC_VERSIONS[VCVERS]);
+
+if (VCVERS < 1500) {
+ ERROR("Unsupported MS C++ Compiler, VC9 (2008) minimum is required");
+}
+
+AC_DEFINE('COMPILER', VC_VERSIONS[VCVERS], "Detected compiler version");
+DEFINE("PHP_COMPILER_SHORT", VC_VERSIONS_SHORT[VCVERS]);
+AC_DEFINE('PHP_COMPILER_ID', VC_VERSIONS_SHORT[VCVERS], "Compiler compatibility ID");
+
+// do we use x64 or 80x86 version of compiler?
+X64 = probe_binary(PHP_CL, 64, null, 'PHP_CL');
+if (X64) {
+ STDOUT.WriteLine(" Detected 64-bit compiler");
+} else {
+ STDOUT.WriteLine(" Detected 32-bit compiler");
+}
+AC_DEFINE('ARCHITECTURE', X64 ? 'x64' : 'x86', "Detected compiler architecture");
+DEFINE("PHP_ARCHITECTURE", X64 ? 'x64' : 'x86');
+
+// cygwin now ships with link.exe. Avoid searching the cygwin path
+// for this, as we want the MS linker, not the fileutil
+PATH_PROG('link', WshShell.Environment("Process").Item("PATH"));
+PATH_PROG('nmake');
+
+// we don't want to define LIB, as that will override the default library path
+// that is set in that env var
+PATH_PROG('lib', null, 'MAKE_LIB');
+if (!PATH_PROG('bison')) {
+ ERROR('bison is required')
+}
+
+// There's a minimum requirement for re2c..
+MINRE2C = "0.13.4";
+
+RE2C = PATH_PROG('re2c');
+if (RE2C) {
+ var intvers, intmin;
+ var pattern = /\./g;
+
+ RE2CVERS = probe_binary(RE2C, "version");
+ STDOUT.WriteLine(' Detected re2c version ' + RE2CVERS);
+
+ intvers = RE2CVERS.replace(pattern, '') - 0;
+ intmin = MINRE2C.replace(pattern, '') - 0;
+
+ if (intvers < intmin) {
+ STDOUT.WriteLine('WARNING: The minimum RE2C version requirement is ' + MINRE2C);
+ STDOUT.WriteLine('Parsers will not be generated. Upgrade your copy at http://sf.net/projects/re2c');
+ DEFINE('RE2C', '');
+ } else {
+ DEFINE('RE2C_FLAGS', '');
+ }
+} else {
+ STDOUT.WriteLine('Parsers will not be regenerated');
+}
+PATH_PROG('zip');
+PATH_PROG('lemon');
+
+// avoid picking up midnight commander from cygwin
+PATH_PROG('mc', WshShell.Environment("Process").Item("PATH"));
+
+// Try locating manifest tool
+if (VCVERS > 1200) {
+ PATH_PROG('mt', WshShell.Environment("Process").Item("PATH"));
+}
+
+// stick objects somewhere outside of the source tree
+ARG_ENABLE('object-out-dir', 'Alternate location for binary objects during build', '');
+if (PHP_OBJECT_OUT_DIR.length) {
+ PHP_OBJECT_OUT_DIR = FSO.GetAbsolutePathName(PHP_OBJECT_OUT_DIR);
+ if (!FSO.FolderExists(PHP_OBJECT_OUT_DIR)) {
+ ERROR('you chosen output directory ' + PHP_OBJECT_OUT_DIR + ' does not exist');
+ }
+ PHP_OBJECT_OUT_DIR += '\\';
+} else if (X64) {
+ if (!FSO.FolderExists("x64")) {
+ FSO.CreateFolder("x64");
+ }
+ PHP_OBJECT_OUT_DIR = 'x64\\';
+}
+
+ARG_ENABLE('debug', 'Compile with debugging symbols', "no");
+ARG_ENABLE('debug-pack', 'Release binaries with external debug symbols (--enable-debug must not be specified)', 'no');
+if (PHP_DEBUG == "yes" && PHP_DEBUG_PACK == "yes") {
+ ERROR("Use of both --enable-debug and --enable-debug-pack not allowed.");
+}
+
+ARG_ENABLE('pgi', 'Generate PGO instrumented binaries', 'no');
+ARG_WITH('pgo', 'Compile optimized binaries using training data from folder', 'no');
+if (PHP_PGI == "yes" || PHP_PGO != "no") {
+ PGOMGR = PATH_PROG('pgomgr', WshShell.Environment("Process").Item("PATH"));
+ if (!PGOMGR) {
+ ERROR("--enable-pgi and --with-pgo options can only be used if PGO capable compiler is present.");
+ }
+ if (PHP_PGI == "yes" && PHP_PGO != "no") {
+ ERROR("Use of both --enable-pgi and --with-pgo not allowed.");
+ }
+}
+
+ARG_ENABLE('zts', 'Thread safety', 'yes');
+// Configures the hard-coded installation dir
+ARG_WITH('prefix', 'where PHP will be installed', '');
+if (PHP_PREFIX == '') {
+ PHP_PREFIX = "C:\\php";
+ if (PHP_DEBUG == "yes")
+ PHP_PREFIX += "\\debug";
+}
+DEFINE('PHP_PREFIX', PHP_PREFIX);
+
+DEFINE("BASE_INCLUDES", "/I . /I main /I Zend /I TSRM /I ext ");
+
+// CFLAGS for building the PHP dll
+DEFINE("CFLAGS_PHP", "/D _USRDLL /D PHP5DLLTS_EXPORTS /D PHP_EXPORTS \
+/D LIBZEND_EXPORTS /D TSRM_EXPORTS /D SAPI_EXPORTS /D WINVER=0x500");
+
+DEFINE('CFLAGS_PHP_OBJ', '$(CFLAGS_PHP) $(STATIC_EXT_CFLAGS)');
+
+// General CFLAGS for building objects
+DEFINE("CFLAGS", "/nologo /FD $(BASE_INCLUDES) /D _WINDOWS \
+/D ZEND_WIN32=1 /D PHP_WIN32=1 /D WIN32 /D _MBCS /W3 ");
+
+if (VCVERS < 1400) {
+ // Enable automatic precompiled headers
+ ADD_FLAG('CFLAGS', ' /YX ');
+
+ if (PHP_DEBUG == "yes") {
+ // Set some debug/release specific options
+ ADD_FLAG('CFLAGS', ' /GZ ');
+ }
+}
+
+if (VCVERS >= 1400) {
+ // fun stuff: MS deprecated ANSI stdio and similar functions
+ // disable annoying warnings. In addition, time_t defaults
+ // to 64-bit. Ask for 32-bit.
+ if (X64) {
+ ADD_FLAG('CFLAGS', ' /wd4996 /Wp64 ');
+ } else {
+ ADD_FLAG('CFLAGS', ' /wd4996 /D_USE_32BIT_TIME_T=1 ');
+ }
+
+ if (PHP_DEBUG == "yes") {
+ // Set some debug/release specific options
+ ADD_FLAG('CFLAGS', ' /RTC1 ');
+ }
+}
+
+ARG_WITH('mp', 'Tell VC9+ use up to [n,auto,disable] processes for compilation', 'auto');
+if (VCVERS >= 1500 && PHP_MP != 'disable') {
+ // no from disable-all
+ if(PHP_MP == 'auto' || PHP_MP == 'no') {
+ ADD_FLAG('CFLAGS', ' /MP ');
+ } else {
+ if(parseInt(PHP_MP) != 0) {
+ ADD_FLAG('CFLAGS', ' /MP'+ PHP_MP +' ');
+ } else {
+ STDOUT.WriteLine('WARNING: Invalid argument for MP: ' + PHP_MP);
+ }
+ }
+}
+
+// General link flags
+DEFINE("LDFLAGS", "/nologo /version:" +
+ PHP_VERSION + "." + PHP_MINOR_VERSION + "." + PHP_RELEASE_VERSION);
+
+// General DLL link flags
+DEFINE("DLL_LDFLAGS", "/dll ");
+
+// PHP DLL link flags
+DEFINE("PHP_LDFLAGS", "$(DLL_LDFLAGS)");
+
+// General libs
+// urlmon.lib ole32.lib oleaut32.lib uuid.lib gdi32.lib winspool.lib comdlg32.lib
+DEFINE("LIBS", "kernel32.lib ole32.lib user32.lib advapi32.lib shell32.lib ws2_32.lib Dnsapi.lib");
+
+// Set some debug/release specific options
+if (PHP_DEBUG == "yes") {
+ ADD_FLAG("CFLAGS", "/LDd /MDd /W3 /Gm /Od /D _DEBUG /D ZEND_DEBUG=1 " +
+ (X64?"/Zi":"/ZI"));
+ ADD_FLAG("LDFLAGS", "/debug");
+ // Avoid problems when linking to release libraries that use the release
+ // version of the libc
+ ADD_FLAG("PHP_LDFLAGS", "/nodefaultlib:msvcrt");
+} else {
+ // Generate external debug files when --enable-debug-pack is specified
+ if (PHP_DEBUG_PACK == "yes") {
+ ADD_FLAG("CFLAGS", "/Zi");
+ ADD_FLAG("LDFLAGS", "/incremental:no /debug /opt:ref,icf");
+ }
+ // Equivalent to Release_TSInline build -> best optimization
+ ADD_FLAG("CFLAGS", "/LD /MD /W3 /Ox /D NDebug /D NDEBUG /D ZEND_WIN32_FORCE_INLINE /GF /D ZEND_DEBUG=0");
+
+ // if you have VS.Net /GS hardens the binary against buffer overruns
+ // ADD_FLAG("CFLAGS", "/GS");
+}
+
+if (PHP_ZTS == "yes") {
+ ADD_FLAG("CFLAGS", "/D ZTS=1");
+ ADD_FLAG("ZTS", "1");
+} else {
+ ADD_FLAG("ZTS", "0");
+}
+
+DEFINE("PHP_ZTS_ARCHIVE_POSTFIX", PHP_ZTS == "yes" ? '' : "-nts");
+
+
+// we want msvcrt in the PHP DLL
+ADD_FLAG("PHP_LDFLAGS", "/nodefaultlib:libcmt");
+
+// set up the build dir and DLL name
+if (PHP_DEBUG == "yes" && PHP_ZTS == "yes") {
+ DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Debug_TS");
+ DEFINE("PHPDLL", "php" + PHP_VERSION + "ts_debug.dll");
+ DEFINE("PHPLIB", "php" + PHP_VERSION + "ts_debug.lib");
+} else if (PHP_DEBUG == "yes" && PHP_ZTS == "no") {
+ DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Debug");
+ DEFINE("PHPDLL", "php" + PHP_VERSION + "_debug.dll");
+ DEFINE("PHPLIB", "php" + PHP_VERSION + "_debug.lib");
+} else if (PHP_DEBUG == "no" && PHP_ZTS == "yes") {
+ DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Release_TS");
+ DEFINE("PHPDLL", "php" + PHP_VERSION + "ts.dll");
+ DEFINE("PHPLIB", "php" + PHP_VERSION + "ts.lib");
+} else if (PHP_DEBUG == "no" && PHP_ZTS == "no") {
+ DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Release");
+ DEFINE("PHPDLL", "php" + PHP_VERSION + ".dll");
+ DEFINE("PHPLIB", "php" + PHP_VERSION + ".lib");
+}
+
+// CFLAGS, LDFLAGS and BUILD_DIR are defined
+// Add compiler and link flags if PGO options are selected
+if (PHP_DEBUG != "yes" && PHP_PGI == "yes") {
+ ADD_FLAG('CFLAGS', "/GL /O2");
+ ADD_FLAG('LDFLAGS', "/LTCG:PGINSTRUMENT");
+ DEFINE("PGOPGD_DIR", "$(BUILD_DIR)");
+}
+else if (PHP_DEBUG != "yes" && PHP_PGO != "no") {
+ ADD_FLAG('CFLAGS', "/GL /O2");
+ ADD_FLAG('LDFLAGS', "/LTCG:PGUPDATE");
+ DEFINE("PGOPGD_DIR", ((PHP_PGO.length == 0 || PHP_PGO == "yes") ? "$(BUILD_DIR)" : PHP_PGO));
+}
+
+// Find the php_build dir - it contains headers and libraries
+// that we need
+ARG_WITH('php-build', 'Path to where you extracted the development libraries (http://wiki.php.net/internals/windows/libs). Assumes that it is a sibling of this source dir (..\\deps) if not specified', 'no');
+
+if (PHP_PHP_BUILD == 'no') {
+ if (FSO.FolderExists("..\\deps")) {
+ PHP_PHP_BUILD = "..\\deps";
+ } else {
+ if (FSO.FolderExists("..\\php_build")) {
+ PHP_PHP_BUILD = "..\\php_build";
+ } else {
+ if (X64) {
+ if (FSO.FolderExists("..\\win64build")) {
+ PHP_PHP_BUILD = "..\\win64build";
+ } else if (FSO.FolderExists("..\\php-win64-dev\\php_build")) {
+ PHP_PHP_BUILD = "..\\php-win64-dev\\php_build";
+ }
+ } else {
+ if (FSO.FolderExists("..\\win32build")) {
+ PHP_PHP_BUILD = "..\\win32build";
+ } else if (FSO.FolderExists("..\\php-win32-dev\\php_build")) {
+ PHP_PHP_BUILD = "..\\php-win32-dev\\php_build";
+ }
+ }
+ }
+ }
+ PHP_PHP_BUILD = FSO.GetAbsolutePathName(PHP_PHP_BUILD);
+}
+DEFINE("PHP_BUILD", PHP_PHP_BUILD);
+
+ARG_WITH('extra-includes', 'Extra include path to use when building everything', '');
+ARG_WITH('extra-libs', 'Extra library path to use when linking everything', '');
+
+var php_usual_include_suspects = PHP_PHP_BUILD+"\\include";
+var php_usual_lib_suspects = PHP_PHP_BUILD+"\\lib";
+
+ADD_FLAG("CFLAGS", '/I "' + php_usual_include_suspects + '" ');
+ADD_FLAG("LDFLAGS", '/libpath:"' + php_usual_lib_suspects + '" ');
+
+// Poke around for some headers
+function probe_basic_headers()
+{
+ var p;
+
+ if (PHP_PHP_BUILD != "no") {
+ php_usual_include_suspects += ";" + PHP_PHP_BUILD + "\\include";
+ php_usual_lib_suspects += ";" + PHP_PHP_BUILD + "\\lib";
+ }
+}
+
+function add_extra_dirs()
+{
+ var path, i, f;
+
+ if (PHP_EXTRA_INCLUDES.length) {
+ path = PHP_EXTRA_INCLUDES.split(';');
+ for (i = 0; i < path.length; i++) {
+ f = FSO.GetAbsolutePathName(path[i]);
+ if (FSO.FolderExists(f)) {
+ ADD_FLAG("CFLAGS", '/I "' + f + '" ');
+ }
+ }
+ }
+ if (PHP_EXTRA_LIBS.length) {
+ path = PHP_EXTRA_LIBS.split(';');
+ for (i = 0; i < path.length; i++) {
+ f = FSO.GetAbsolutePathName(path[i]);
+ if (FSO.FolderExists(f)) {
+ if (VCVERS <= 1200 && f.indexOf(" ") >= 0) {
+ ADD_FLAG("LDFLAGS", '/libpath:"\\"' + f + '\\"" ');
+ } else {
+ ADD_FLAG("LDFLAGS", '/libpath:"' + f + '" ');
+ }
+ }
+ }
+ }
+
+}
+
+probe_basic_headers();
+add_extra_dirs();
+
+//DEFINE("PHP_BUILD", PHP_PHP_BUILD);
+
+STDOUT.WriteBlankLines(1);
+STDOUT.WriteLine("Build dir: " + get_define('BUILD_DIR'));
+STDOUT.WriteLine("PHP Core: " + get_define('PHPDLL') + " and " + get_define('PHPLIB'));
+
+ADD_SOURCES("Zend", "zend_language_parser.c zend_language_scanner.c \
+ zend_ini_parser.c zend_ini_scanner.c zend_alloc.c zend_compile.c \
+ zend_constants.c zend_dynamic_array.c zend_exceptions.c \
+ zend_execute_API.c zend_highlight.c \
+ zend_llist.c zend_opcode.c zend_operators.c zend_ptr_stack.c \
+ zend_stack.c zend_variables.c zend.c zend_API.c zend_extensions.c \
+ zend_hash.c zend_list.c zend_indent.c zend_builtin_functions.c \
+ zend_sprintf.c zend_ini.c zend_qsort.c zend_multibyte.c zend_ts_hash.c \
+ zend_stream.c zend_iterators.c zend_interfaces.c zend_objects.c \
+ zend_object_handlers.c zend_objects_API.c \
+ zend_default_classes.c zend_execute.c zend_strtod.c zend_gc.c zend_closures.c \
+ zend_float.c zend_string.c");
+
+if (VCVERS == 1200) {
+ AC_DEFINE('ZEND_DVAL_TO_LVAL_CAST_OK', 1);
+}
+
+ADD_SOURCES("main", "main.c snprintf.c spprintf.c getopt.c fopen_wrappers.c \
+ php_scandir.c php_ini.c SAPI.c rfc1867.c php_content_types.c strlcpy.c \
+ strlcat.c mergesort.c reentrancy.c php_variables.c php_ticks.c network.c \
+ php_open_temporary_file.c php_logos.c output.c internal_functions.c php_sprintf.c");
+ADD_SOURCES("win32", "inet.c fnmatch.c sockets.c");
+
+// Newer versions have it
+if (VCVERS <= 1300) {
+ ADD_SOURCES("win32", "strtoi64.c");
+}
+if (VCVERS >= 1400) {
+ AC_DEFINE('HAVE_STRNLEN', 1);
+}
+
+ADD_SOURCES("main/streams", "streams.c cast.c memory.c filter.c plain_wrapper.c \
+ userspace.c transports.c xp_socket.c mmap.c glob_wrapper.c");
+
+ADD_SOURCES("win32", "glob.c readdir.c \
+ registry.c select.c sendmail.c time.c winutil.c wsyslog.c globals.c");
+
+PHP_INSTALL_HEADERS("", "Zend/ TSRM/ main/ main/streams/ win32/");
+
+STDOUT.WriteBlankLines(1);
+
+
+/* Can we build with IPv6 support? */
+ARG_ENABLE("ipv6", "Disable IPv6 support (default is turn it on if available)", "yes");
+
+var main_network_has_ipv6 = 0;
+if (PHP_IPV6 == "yes") {
+ main_network_has_ipv6 = CHECK_HEADER_ADD_INCLUDE("wspiapi.h", "CFLAGS") ? 1 : 0;
+}
+if (main_network_has_ipv6) {
+ STDOUT.WriteLine("Enabling IPv6 support");
+}
+AC_DEFINE('HAVE_GETADDRINFO', main_network_has_ipv6);
+AC_DEFINE('HAVE_GAI_STRERROR', main_network_has_ipv6);
+AC_DEFINE('HAVE_IPV6', main_network_has_ipv6);
+
+/* this allows up to 256 sockets to be select()ed in a single
+ * call to select(), instead of the usual 64 */
+ARG_ENABLE('fd-setsize', "Set maximum number of sockets for select(2)", "256");
+ADD_FLAG("CFLAGS", "/D FD_SETSIZE=" + parseInt(PHP_FD_SETSIZE));
+
+AC_DEFINE('HAVE_USLEEP', 1);
+AC_DEFINE('HAVE_STRCOLL', 1);
+
+/* For snapshot builders, where can we find the additional
+ * files that make up the snapshot template? */
+ARG_WITH("snapshot-template", "Path to snapshot builder template dir", "no");
+
+if (PHP_SNAPSHOT_TEMPLATE == "no") {
+ /* default is as a sibling of the php_build dir */
+ if (FSO.FolderExists(PHP_PHP_BUILD + "\\template")) {
+ PHP_SNAPSHOT_TEMPLATE = FSO.GetAbsolutePathName(PHP_PHP_BUILD + "\\template");
+ } else if (FSO.FolderExists(PHP_PHP_BUILD + "\\..\\template")) {
+ PHP_SNAPSHOT_TEMPLATE = FSO.GetAbsolutePathName(PHP_PHP_BUILD + "\\..\\template");
+ }
+}
+
+DEFINE('SNAPSHOT_TEMPLATE', PHP_SNAPSHOT_TEMPLATE);
+
+if (PHP_DSP != "no") {
+ if (FSO.FolderExists("tmp")) {
+ FSO.DeleteFolder("tmp");
+ }
+ FSO.CreateFolder("tmp");
+}
+
+ARG_ENABLE("security-flags", "Disable the compiler security flags", "yes");
+if (PHP_SECURITY_FLAGS == "yes") {
+ ADD_FLAG("LDFLAGS", "/NXCOMPAT /DYNAMICBASE ");
+}
+
+ARG_ENABLE("static-analyze", "Enable the VC compiler static analyze", "no");
+if (PHP_STATIC_ANALYZE == "yes") {
+ ADD_FLAG("CFLAGS", " /analyze ");
+ ADD_FLAG("CFLAGS", " /wd6308 ");
+}
diff --git a/win32/build/config.w32.h.in b/win32/build/config.w32.h.in
new file mode 100644
index 0000000..c6cf076
--- /dev/null
+++ b/win32/build/config.w32.h.in
@@ -0,0 +1,176 @@
+/*
+ Build Configuration Template for Win32.
+ $Id$
+*/
+
+/* Define the minimum supported version */
+#undef _WIN32_WINNT
+#undef NTDDI_VERSION
+#define _WIN32_WINNT 0x0501
+#define NTDDI_VERSION 0x05010200
+
+/* Default PHP / PEAR directories */
+#define PHP_CONFIG_FILE_PATH (getenv("SystemRoot"))?getenv("SystemRoot"):""
+#define CONFIGURATION_FILE_PATH "php.ini"
+#define PEAR_INSTALLDIR "@PREFIX@\\pear"
+#define PHP_BINDIR "@PREFIX@"
+#define PHP_DATADIR "@PREFIX@"
+#define PHP_EXTENSION_DIR "@PREFIX@"
+#define PHP_INCLUDE_PATH ".;@PREFIX@\\pear"
+#define PHP_LIBDIR "@PREFIX@"
+#define PHP_LOCALSTATEDIR "@PREFIX@"
+#define PHP_PREFIX "@PREFIX@"
+#define PHP_SYSCONFDIR "@PREFIX@"
+
+/* Enable / Disable crypt() function (default: enabled) */
+#define HAVE_CRYPT 1
+#define PHP_STD_DES_CRYPT 1
+#define PHP_EXT_DES_CRYPT 1
+#define PHP_MD5_CRYPT 1
+#define PHP_BLOWFISH_CRYPT 1
+#define PHP_SHA512_CRYPT 1
+#define PHP_SHA256_CRYPT 1
+
+/* PHP Runtime Configuration */
+#define PHP_URL_FOPEN 1
+#define USE_CONFIG_FILE 1
+#define DEFAULT_SHORT_OPEN_TAG "1"
+
+/* Platform-Specific Configuration. Should not be changed. */
+#define PHP_SIGCHILD 0
+#define HAVE_LIBBIND 1
+#define HAVE_GETSERVBYNAME 1
+#define HAVE_GETSERVBYPORT 1
+#define HAVE_GETPROTOBYNAME 1
+#define HAVE_GETPROTOBYNUMBER 1
+#define HAVE_GETHOSTNAME 1
+#define STDIN_FILENO 0
+#define STDOUT_FILENO 1
+#define STDERR_FILENO 2
+#define HAVE_ERRMSG_H 0
+#undef HAVE_ADABAS
+#undef HAVE_SOLID
+#undef HAVE_LINK
+#undef HAVE_SYMLINK
+
+/* its in win32/time.c */
+#define HAVE_USLEEP 1
+#define HAVE_NANOSLEEP 1
+#define PHP_SLEEP_NON_VOID 1
+
+#define HAVE_GETHOSTNAME 1
+#define HAVE_GETCWD 1
+#define HAVE_POSIX_READDIR_R 1
+#define NEED_ISBLANK 1
+#define DISCARD_PATH 0
+#undef HAVE_SETITIMER
+#undef HAVE_SIGSETJMP
+#undef HAVE_IODBC
+#define HAVE_LIBDL 1
+#define HAVE_GETTIMEOFDAY 1
+#define HAVE_PUTENV 1
+#define HAVE_LIMITS_H 1
+#define HAVE_TZSET 1
+#define HAVE_TZNAME 1
+#undef HAVE_FLOCK
+#define HAVE_ALLOCA 1
+#undef HAVE_SYS_TIME_H
+#define HAVE_SIGNAL_H 1
+#undef HAVE_ST_BLKSIZE
+#undef HAVE_ST_BLOCKS
+#define HAVE_ST_RDEV 1
+#define HAVE_UTIME_NULL 1
+#define HAVE_VPRINTF 1
+#define STDC_HEADERS 1
+#define REGEX 1
+#define HSREGEX 1
+#define HAVE_GCVT 1
+#define HAVE_GETLOGIN 1
+#define HAVE_GETTIMEOFDAY 1
+#define HAVE_MEMCPY 1
+#define HAVE_MEMMOVE 1
+#define HAVE_PUTENV 1
+#define HAVE_REGCOMP 1
+#define HAVE_SETLOCALE 1
+#define HAVE_LOCALECONV 1
+#define HAVE_LOCALE_H 1
+#ifndef HAVE_LIBBIND
+# define HAVE_SETVBUF 1
+#endif
+#define HAVE_SHUTDOWN 1
+#define HAVE_SNPRINTF 1
+#define HAVE_VSNPRINTF 1
+#define HAVE_STRCASECMP 1
+#define HAVE_STRDUP 1
+#define HAVE_STRERROR 1
+#define HAVE_STRSTR 1
+#define HAVE_TEMPNAM 1
+#define HAVE_UTIME 1
+#undef HAVE_DIRENT_H
+#define HAVE_ASSERT_H 1
+#define HAVE_FCNTL_H 1
+#define HAVE_GRP_H 0
+#undef HAVE_PWD_H
+#define HAVE_STRING_H 1
+#undef HAVE_SYS_FILE_H
+#undef HAVE_SYS_SOCKET_H
+#undef HAVE_SYS_WAIT_H
+#define HAVE_SYSLOG_H 1
+#undef HAVE_UNISTD_H
+#define HAVE_SYS_TYPES_H 1
+#define HAVE_STDARG_H 1
+#undef HAVE_ALLOCA_H
+#undef HAVE_KILL
+#define HAVE_GETPID 1
+#define HAVE_LIBM 1
+#define HAVE_CUSERID 0
+#undef HAVE_RINT
+#define HAVE_STRFTIME 1
+#define SIZEOF_SHORT 2
+/* int and long are stll 32bit in 64bit compiles */
+#define SIZEOF_INT 4
+#define SIZEOF_LONG 4
+/* MSVC.6/NET don't allow 'long long' or know 'intmax_t' */
+#define SIZEOF_LONG_LONG_INT 0
+#define SIZEOF_LONG_LONG 8 /* defined as __int64 */
+#define SIZEOF_INTMAX_T 0
+#define ssize_t SSIZE_T
+#ifdef _WIN64
+# define SIZEOF_SIZE_T 8
+# define SIZEOF_PTRDIFF_T 8
+#else
+# define SIZEOF_SIZE_T 4
+# define SIZEOF_PTRDIFF_T 4
+#endif
+#define HAVE_FNMATCH
+#define HAVE_GLOB
+#define PHP_SHLIB_SUFFIX "dll"
+#define HAVE_SQLDATASOURCES
+
+/* Win32 supports strcoll */
+#define HAVE_STRCOLL 1
+
+/* Win32 supports socketpair by the emulation in win32/sockets.c */
+#define HAVE_SOCKETPAIR 1
+#define HAVE_SOCKLEN_T 1
+
+/* Win32 support proc_open */
+#define PHP_CAN_SUPPORT_PROC_OPEN 1
+
+/* inet_ntop() / inet_pton() */
+#define HAVE_INET_PTON 1
+#define HAVE_INET_NTOP 1
+
+#define HAVE_MBLEN
+
+#undef HAVE_ATOF_ACCEPTS_NAN
+#undef HAVE_ATOF_ACCEPTS_INF
+#define HAVE_HUGE_VAL_NAN 0
+
+/* vs.net 2005 has a 64-bit time_t. This will likely break
+ * 3rdParty libs that were built with older compilers; switch
+ * back to 32-bit */
+#ifndef _WIN64
+# define _USE_32BIT_TIME_T 1
+#endif
+#define HAVE_STDLIB_H 1
diff --git a/win32/build/config.w32.phpize.in b/win32/build/config.w32.phpize.in
new file mode 100644
index 0000000..b8bf45e
--- /dev/null
+++ b/win32/build/config.w32.phpize.in
@@ -0,0 +1,358 @@
+// vim:ft=javascript
+// $Id: config.w32 306241 2010-12-11 22:18:10Z pajoye $
+// "Master" config file; think of it as a configure.in
+// equivalent.
+
+var PHP_CYGWIN="notset";
+PHP_CL = PATH_PROG('cl', null, 'PHP_CL');
+if (!PHP_CL) {
+ ERROR("MS C++ compiler is required");
+}
+/* For the record here: */
+// 1200 is VC6
+// 1300 is vs.net 2002
+// 1310 is vs.net 2003
+// 1400 is vs.net 2005
+// 1500 is vs.net 2008
+// 1600 is vs.net 2010
+// Which version of the compiler do we have?
+VCVERS = probe_binary(PHP_CL).substr(0, 5).replace('.', '');
+STDOUT.WriteLine(" Detected compiler " + VC_VERSIONS[VCVERS]);
+
+if (VCVERS < 1500) {
+ ERROR("Unsupported MS C++ Compiler, VC9 (2008) minimum is required");
+}
+
+AC_DEFINE('COMPILER', VC_VERSIONS[VCVERS], "Detected compiler version");
+DEFINE("PHP_COMPILER_SHORT", VC_VERSIONS_SHORT[VCVERS]);
+AC_DEFINE('PHP_COMPILER_ID', VC_VERSIONS_SHORT[VCVERS], "Compiler compatibility ID");
+
+// do we use x64 or 80x86 version of compiler?
+X64 = probe_binary(PHP_CL, 64, null, 'PHP_CL');
+if (X64) {
+ STDOUT.WriteLine(" Detected 64-bit compiler");
+} else {
+ STDOUT.WriteLine(" Detected 32-bit compiler");
+}
+AC_DEFINE('ARCHITECTURE', X64 ? 'x64' : 'x86', "Detected compiler architecture");
+DEFINE("PHP_ARCHITECTURE", X64 ? 'x64' : 'x86');
+
+// cygwin now ships with link.exe. Avoid searching the cygwin path
+// for this, as we want the MS linker, not the fileutil
+PATH_PROG('link', WshShell.Environment("Process").Item("PATH"));
+PATH_PROG('nmake');
+
+// we don't want to define LIB, as that will override the default library path
+// that is set in that env var
+PATH_PROG('lib', null, 'MAKE_LIB');
+if (!PATH_PROG('bison')) {
+ ERROR('bison is required')
+}
+
+// There's a minimum requirement for re2c..
+MINRE2C = "0.13.4";
+
+RE2C = PATH_PROG('re2c');
+if (RE2C) {
+ var intvers, intmin;
+ var pattern = /\./g;
+
+ RE2CVERS = probe_binary(RE2C, "version");
+ STDOUT.WriteLine(' Detected re2c version ' + RE2CVERS);
+
+ intvers = RE2CVERS.replace(pattern, '') - 0;
+ intmin = MINRE2C.replace(pattern, '') - 0;
+
+ if (intvers < intmin) {
+ STDOUT.WriteLine('WARNING: The minimum RE2C version requirement is ' + MINRE2C);
+ STDOUT.WriteLine('Parsers will not be generated. Upgrade your copy at http://sf.net/projects/re2c');
+ DEFINE('RE2C', '');
+ } else {
+ DEFINE('RE2C_FLAGS', '');
+ }
+} else {
+ STDOUT.WriteLine('Parsers will not be regenerated');
+}
+PATH_PROG('zip');
+PATH_PROG('lemon');
+
+// avoid picking up midnight commander from cygwin
+PATH_PROG('mc', WshShell.Environment("Process").Item("PATH"));
+
+// Try locating manifest tool
+if (VCVERS > 1200) {
+ PATH_PROG('mt', WshShell.Environment("Process").Item("PATH"));
+}
+
+// stick objects somewhere outside of the source tree
+ARG_ENABLE('object-out-dir', 'Alternate location for binary objects during build', '');
+if (PHP_OBJECT_OUT_DIR.length) {
+ PHP_OBJECT_OUT_DIR = FSO.GetAbsolutePathName(PHP_OBJECT_OUT_DIR);
+ if (!FSO.FolderExists(PHP_OBJECT_OUT_DIR)) {
+ ERROR('you chosen output directory ' + PHP_OBJECT_OUT_DIR + ' does not exist');
+ }
+ PHP_OBJECT_OUT_DIR += '\\';
+} else if (X64) {
+ if (!FSO.FolderExists("x64")) {
+ FSO.CreateFolder("x64");
+ }
+ PHP_OBJECT_OUT_DIR = 'x64\\';
+}
+
+ARG_ENABLE('debug', 'Compile with debugging symbols', "no");
+ARG_ENABLE('debug-pack', 'Release binaries with external debug symbols (--enable-debug must not be specified)', 'no');
+if (PHP_DEBUG == "yes" && PHP_DEBUG_PACK == "yes") {
+ ERROR("Use of both --enable-debug and --enable-debug-pack not allowed.");
+}
+
+DEFINE('PHP_PREFIX', PHP_PREFIX);
+
+DEFINE("BASE_INCLUDES", "/I " + PHP_DIR + "/include /I " + PHP_DIR + "/include/main /I " + PHP_DIR + "/include/Zend /I " + PHP_DIR + "/include/TSRM /I " + PHP_DIR + "/include/ext ");
+
+// CFLAGS for building the PHP dll
+DEFINE("CFLAGS_PHP", "/D _USRDLL /D PHP5DLLTS_EXPORTS /D PHP_EXPORTS \
+/D LIBZEND_EXPORTS /D TSRM_EXPORTS /D SAPI_EXPORTS /D WINVER=0x500");
+
+DEFINE('CFLAGS_PHP_OBJ', '$(CFLAGS_PHP) $(STATIC_EXT_CFLAGS)');
+
+// General CFLAGS for building objects
+DEFINE("CFLAGS", "/nologo /FD $(BASE_INCLUDES) /D _WINDOWS \
+/D ZEND_WIN32=1 /D PHP_WIN32=1 /D WIN32 /D _MBCS /W3 ");
+
+if (VCVERS < 1400) {
+ // Enable automatic precompiled headers
+ ADD_FLAG('CFLAGS', ' /YX ');
+
+ if (PHP_DEBUG == "yes") {
+ // Set some debug/release specific options
+ ADD_FLAG('CFLAGS', ' /GZ ');
+ }
+}
+
+if (VCVERS >= 1400) {
+ // fun stuff: MS deprecated ANSI stdio and similar functions
+ // disable annoying warnings. In addition, time_t defaults
+ // to 64-bit. Ask for 32-bit.
+ if (X64) {
+ ADD_FLAG('CFLAGS', ' /wd4996 /Wp64 ');
+ } else {
+ ADD_FLAG('CFLAGS', ' /wd4996 /D_USE_32BIT_TIME_T=1 ');
+ }
+
+ if (PHP_DEBUG == "yes") {
+ // Set some debug/release specific options
+ ADD_FLAG('CFLAGS', ' /RTC1 ');
+ }
+}
+
+ARG_WITH('prefix', 'PHP installation prefix', '');
+ARG_WITH('mp', 'Tell VC9+ use up to [n,auto,disable] processes for compilation', 'auto');
+if (VCVERS >= 1500 && PHP_MP != 'disable') {
+ // no from disable-all
+ if(PHP_MP == 'auto' || PHP_MP == 'no') {
+ ADD_FLAG('CFLAGS', ' /MP ');
+ } else {
+ if(parseInt(PHP_MP) != 0) {
+ ADD_FLAG('CFLAGS', ' /MP'+ PHP_MP +' ');
+ } else {
+ STDOUT.WriteLine('WARNING: Invalid argument for MP: ' + PHP_MP);
+ }
+ }
+}
+
+/* For snapshot builders, where can we find the additional
+ * files that make up the snapshot template? */
+ARG_WITH("snapshot-template", "Path to snapshot builder template dir", "no");
+
+// General DLL link flags
+DEFINE("DLL_LDFLAGS", "/dll ");
+
+// PHP DLL link flags
+DEFINE("PHP_LDFLAGS", "$(DLL_LDFLAGS)");
+
+// General libs
+// urlmon.lib ole32.lib oleaut32.lib uuid.lib gdi32.lib winspool.lib comdlg32.lib
+DEFINE("LIBS", "kernel32.lib ole32.lib user32.lib advapi32.lib shell32.lib ws2_32.lib Dnsapi.lib");
+
+// Set some debug/release specific options
+if (PHP_DEBUG == "yes") {
+ ADD_FLAG("CFLAGS", "/LDd /MDd /W3 /Gm /Od /D _DEBUG /D ZEND_DEBUG=1 " +
+ (X64?"/Zi":"/ZI"));
+ ADD_FLAG("LDFLAGS", "/debug");
+ // Avoid problems when linking to release libraries that use the release
+ // version of the libc
+ ADD_FLAG("PHP_LDFLAGS", "/nodefaultlib:msvcrt");
+} else {
+ // Generate external debug files when --enable-debug-pack is specified
+ if (PHP_DEBUG_PACK == "yes") {
+ ADD_FLAG("CFLAGS", "/Zi");
+ ADD_FLAG("LDFLAGS", "/incremental:no /debug /opt:ref,icf");
+ }
+ // Equivalent to Release_TSInline build -> best optimization
+ ADD_FLAG("CFLAGS", "/LD /MD /W3 /Ox /D NDebug /D NDEBUG /D ZEND_WIN32_FORCE_INLINE /GF /D ZEND_DEBUG=0");
+
+ // if you have VS.Net /GS hardens the binary against buffer overruns
+ // ADD_FLAG("CFLAGS", "/GS");
+}
+
+if (PHP_ZTS == "yes") {
+ ADD_FLAG("CFLAGS", "/D ZTS=1");
+}
+
+DEFINE("PHP_ZTS_ARCHIVE_POSTFIX", PHP_ZTS == "yes" ? '' : "-nts");
+
+
+// we want msvcrt in the PHP DLL
+ADD_FLAG("PHP_LDFLAGS", "/nodefaultlib:libcmt");
+
+// set up the build dir and DLL name
+if (PHP_DEBUG == "yes" && PHP_ZTS == "yes") {
+ DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Debug_TS");
+ if (!MODE_PHPIZE) {
+ DEFINE("PHPDLL", "php" + PHP_VERSION + "ts_debug.dll");
+ DEFINE("PHPLIB", "php" + PHP_VERSION + "ts_debug.lib");
+ }
+} else if (PHP_DEBUG == "yes" && PHP_ZTS == "no") {
+ DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Debug");
+ if (!MODE_PHPIZE) {
+ DEFINE("PHPDLL", "php" + PHP_VERSION + "_debug.dll");
+ DEFINE("PHPLIB", "php" + PHP_VERSION + "_debug.lib");
+ }
+} else if (PHP_DEBUG == "no" && PHP_ZTS == "yes") {
+ DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Release_TS");
+ if (!MODE_PHPIZE) {
+ DEFINE("PHPDLL", "php" + PHP_VERSION + "ts.dll");
+ DEFINE("PHPLIB", "php" + PHP_VERSION + "ts.lib");
+ }
+} else if (PHP_DEBUG == "no" && PHP_ZTS == "no") {
+ DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Release");
+ if (!MODE_PHPIZE) {
+ DEFINE("PHPDLL", "php" + PHP_VERSION + ".dll");
+ DEFINE("PHPLIB", "php" + PHP_VERSION + ".lib");
+ }
+}
+
+if (MODE_PHPIZE) {
+ DEFINE("PHPDLL", PHP_DLL);
+ DEFINE("PHPLIB", PHP_DLL_LIB);
+}
+
+// Find the php_build dir - it contains headers and libraries
+// that we need
+ARG_WITH('php-build', 'Path to where you extracted the development libraries (http://wiki.php.net/internals/windows/libs). Assumes that it is a sibling of this source dir (..\\deps) if not specified', 'no');
+
+if (PHP_PHP_BUILD == 'no') {
+ if (FSO.FolderExists("..\\deps")) {
+ PHP_PHP_BUILD = "..\\deps";
+ } else {
+ if (FSO.FolderExists("..\\php_build")) {
+ PHP_PHP_BUILD = "..\\php_build";
+ } else {
+ if (X64) {
+ if (FSO.FolderExists("..\\win64build")) {
+ PHP_PHP_BUILD = "..\\win64build";
+ } else if (FSO.FolderExists("..\\php-win64-dev\\php_build")) {
+ PHP_PHP_BUILD = "..\\php-win64-dev\\php_build";
+ }
+ } else {
+ if (FSO.FolderExists("..\\win32build")) {
+ PHP_PHP_BUILD = "..\\win32build";
+ } else if (FSO.FolderExists("..\\php-win32-dev\\php_build")) {
+ PHP_PHP_BUILD = "..\\php-win32-dev\\php_build";
+ }
+ }
+ }
+ }
+ PHP_PHP_BUILD = FSO.GetAbsolutePathName(PHP_PHP_BUILD);
+}
+DEFINE("PHP_BUILD", PHP_PHP_BUILD);
+
+ARG_WITH('extra-includes', 'Extra include path to use when building everything', '');
+ARG_WITH('extra-libs', 'Extra library path to use when linking everything', '');
+
+var php_usual_include_suspects = PHP_PHP_BUILD+"\\include";
+var php_usual_lib_suspects = PHP_PHP_BUILD+"\\lib";
+
+ADD_FLAG("CFLAGS", '/I "' + php_usual_include_suspects + '" ');
+ADD_FLAG("LDFLAGS", '/libpath:"\\"' + php_usual_lib_suspects + '\\"" ');
+
+// Poke around for some headers
+function probe_basic_headers()
+{
+ var p;
+
+ if (PHP_PHP_BUILD != "no") {
+ php_usual_include_suspects += ";" + PHP_PHP_BUILD + "\\include";
+ php_usual_lib_suspects += ";" + PHP_PHP_BUILD + "\\lib";
+ }
+}
+
+function add_extra_dirs()
+{
+ var path, i, f;
+
+ if (PHP_EXTRA_INCLUDES.length) {
+ path = PHP_EXTRA_INCLUDES.split(';');
+ for (i = 0; i < path.length; i++) {
+ f = FSO.GetAbsolutePathName(path[i]);
+ if (FSO.FolderExists(f)) {
+ ADD_FLAG("CFLAGS", '/I "' + f + '" ');
+ }
+ }
+ }
+ if (PHP_EXTRA_LIBS.length) {
+ path = PHP_EXTRA_LIBS.split(';');
+ for (i = 0; i < path.length; i++) {
+ f = FSO.GetAbsolutePathName(path[i]);
+ if (FSO.FolderExists(f)) {
+ if (VCVERS <= 1200 && f.indexOf(" ") >= 0) {
+ ADD_FLAG("LDFLAGS", '/libpath:"\\"' + f + '\\"" ');
+ } else {
+ ADD_FLAG("LDFLAGS", '/libpath:"' + f + '" ');
+ }
+ }
+ }
+ }
+
+}
+
+probe_basic_headers();
+add_extra_dirs();
+
+//DEFINE("PHP_BUILD", PHP_PHP_BUILD);
+
+STDOUT.WriteBlankLines(1);
+STDOUT.WriteLine("Build dir: " + get_define('BUILD_DIR'));
+STDOUT.WriteLine("PHP Core: " + get_define('PHPDLL') + " and " + get_define('PHPLIB'));
+
+
+if (VCVERS == 1200) {
+ AC_DEFINE('ZEND_DVAL_TO_LVAL_CAST_OK', 1);
+}
+
+if (VCVERS >= 1400) {
+ AC_DEFINE('HAVE_STRNLEN', 1);
+}
+
+STDOUT.WriteBlankLines(1);
+
+if (PHP_SNAPSHOT_TEMPLATE == "no") {
+ /* default is as a sibling of the php_build dir */
+ if (FSO.FolderExists(PHP_PHP_BUILD + "\\template")) {
+ PHP_SNAPSHOT_TEMPLATE = FSO.GetAbsolutePathName(PHP_PHP_BUILD + "\\template");
+ } else if (FSO.FolderExists(PHP_PHP_BUILD + "\\..\\template")) {
+ PHP_SNAPSHOT_TEMPLATE = FSO.GetAbsolutePathName(PHP_PHP_BUILD + "\\..\\template");
+ }
+}
+
+DEFINE('SNAPSHOT_TEMPLATE', PHP_SNAPSHOT_TEMPLATE);
+
+if (PHP_DSP != "no") {
+ if (FSO.FolderExists("tmp")) {
+ FSO.DeleteFolder("tmp");
+ }
+ FSO.CreateFolder("tmp");
+}
+
+AC_DEFINE("PHP_DIR", PHP_DIR);
+DEFINE("PHP_DIR", PHP_DIR);
diff --git a/win32/build/configure.bat b/win32/build/configure.bat
new file mode 100644
index 0000000..45d273d
--- /dev/null
+++ b/win32/build/configure.bat
@@ -0,0 +1,2 @@
+@echo off
+cscript /nologo configure.js %*
diff --git a/win32/build/configure.tail b/win32/build/configure.tail
new file mode 100644
index 0000000..70625a4
--- /dev/null
+++ b/win32/build/configure.tail
@@ -0,0 +1,11 @@
+// vim:ft=javascript
+// $Id$
+// tail end of configure
+
+if (!MODE_PHPIZE && sapi_enabled.length < 1) {
+ MESSAGE("");
+ ERROR("No SAPI selected, please enable at least one SAPI.");
+}
+
+generate_files();
+
diff --git a/win32/build/confutils.js b/win32/build/confutils.js
new file mode 100644
index 0000000..c0a1ce8
--- /dev/null
+++ b/win32/build/confutils.js
@@ -0,0 +1,2048 @@
+// Utils for configure script
+/*
+ +----------------------------------------------------------------------+
+ | PHP Version 5 |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1997-2008 The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Author: Wez Furlong <wez@thebrainroom.com> |
+ +----------------------------------------------------------------------+
+*/
+
+// $Id: confutils.js,v 1.60.2.1.2.8.2.33 2009-05-29 07:43:07 kalle Exp $
+
+var STDOUT = WScript.StdOut;
+var STDERR = WScript.StdErr;
+var WshShell = WScript.CreateObject("WScript.Shell");
+var FSO = WScript.CreateObject("Scripting.FileSystemObject");
+var MFO = null;
+var SYSTEM_DRIVE = WshShell.Environment("Process").Item("SystemDrive");
+var PROGRAM_FILES = WshShell.Environment("Process").Item("ProgramFiles");
+var DSP_FLAGS = new Array();
+var PHP_SRC_DIR=FSO.GetParentFolderName(WScript.ScriptFullName);
+
+/* Store the enabled extensions (summary + QA check) */
+var extensions_enabled = new Array();
+
+/* Store the SAPI enabled (summary + QA check) */
+var sapi_enabled = new Array();
+
+/* Store the headers to install */
+var headers_install = new Array();
+
+/* Mapping CL version > human readable name */
+var VC_VERSIONS = new Array();
+VC_VERSIONS[1200] = 'MSVC6 (Visual C++ 6.0)';
+VC_VERSIONS[1300] = 'MSVC7 (Visual C++ 2002)';
+VC_VERSIONS[1310] = 'MSVC7.1 (Visual C++ 2003)';
+VC_VERSIONS[1400] = 'MSVC8 (Visual C++ 2005)';
+VC_VERSIONS[1500] = 'MSVC9 (Visual C++ 2008)';
+VC_VERSIONS[1600] = 'MSVC10 (Visual C++ 2010)';
+
+var VC_VERSIONS_SHORT = new Array();
+VC_VERSIONS_SHORT[1200] = 'VC6';
+VC_VERSIONS_SHORT[1300] = 'VC7';
+VC_VERSIONS_SHORT[1310] = 'VC7.1';
+VC_VERSIONS_SHORT[1400] = 'VC8';
+VC_VERSIONS_SHORT[1500] = 'VC9';
+VC_VERSIONS_SHORT[1600] = 'VC10';
+
+if (PROGRAM_FILES == null) {
+ PROGRAM_FILES = "C:\\Program Files";
+}
+
+if (MODE_PHPIZE) {
+ if (!FSO.FileExists("config.w32")) {
+ STDERR.WriteLine("Must be run from the root of the extension source");
+ WScript.Quit(10);
+ }
+} else {
+ if (!FSO.FileExists("README.GIT-RULES")) {
+ STDERR.WriteLine("Must be run from the root of the php source");
+ WScript.Quit(10);
+ }
+}
+
+var CWD = WshShell.CurrentDirectory;
+
+if (typeof(CWD) == "undefined") {
+ CWD = FSO.GetParentFolderName(FSO.GetAbsolutePathName("README.GIT-RULES"));
+}
+
+/* defaults; we pick up the precise versions from configure.in */
+var PHP_VERSION = 5;
+var PHP_MINOR_VERSION = 0;
+var PHP_RELEASE_VERSION = 0;
+var PHP_EXTRA_VERSION = "";
+var PHP_VERSION_STRING = "5.0.0";
+
+function get_version_numbers()
+{
+ var cin = file_get_contents("configure.in");
+
+ if (cin.match(new RegExp("PHP_MAJOR_VERSION=(\\d+)"))) {
+ PHP_VERSION = RegExp.$1;
+ }
+ if (cin.match(new RegExp("PHP_MINOR_VERSION=(\\d+)"))) {
+ PHP_MINOR_VERSION = RegExp.$1;
+ }
+ if (cin.match(new RegExp("PHP_RELEASE_VERSION=(\\d+)"))) {
+ PHP_RELEASE_VERSION = RegExp.$1;
+ }
+ PHP_VERSION_STRING = PHP_VERSION + "." + PHP_MINOR_VERSION + "." + PHP_RELEASE_VERSION;
+
+ if (cin.match(new RegExp("PHP_EXTRA_VERSION=\"([^\"]+)\""))) {
+ PHP_EXTRA_VERSION = RegExp.$1;
+ if (PHP_EXTRA_VERSION.length) {
+ PHP_VERSION_STRING += PHP_EXTRA_VERSION;
+ }
+ }
+ DEFINE('PHP_VERSION_STRING', PHP_VERSION_STRING);
+}
+
+configure_args = new Array();
+configure_subst = WScript.CreateObject("Scripting.Dictionary");
+
+configure_hdr = WScript.CreateObject("Scripting.Dictionary");
+build_dirs = new Array();
+
+extension_include_code = "";
+extension_module_ptrs = "";
+
+if (!MODE_PHPIZE) {
+ get_version_numbers();
+}
+
+/* execute a command and return the output as a string */
+function execute(command_line)
+{
+ var e = WshShell.Exec(command_line);
+ var ret = "";
+
+ ret = e.StdOut.ReadAll();
+
+//STDOUT.WriteLine("command " + command_line);
+//STDOUT.WriteLine(ret);
+
+ return ret;
+}
+
+function probe_binary(EXE, what)
+{
+ // tricky escapes to get stderr redirection to work
+ var command = 'cmd /c ""' + EXE;
+ if (what == "version") {
+ command = command + '" -v"';
+ }
+ var version = execute(command + '" 2>&1"');
+
+ if (what == "64") {
+ if (version.match(/x64/)) {
+ return 1;
+ }
+ } else {
+ if (version.match(/(\d+\.\d+(\.\d+)?(\.\d+)?)/)) {
+ return RegExp.$1;
+ }
+ }
+ return 0;
+}
+
+function condense_path(path)
+{
+ path = FSO.GetAbsolutePathName(path);
+
+ if (path.substr(0, CWD.length).toLowerCase()
+ == CWD.toLowerCase() &&
+ (path.charCodeAt(CWD.length) == 92 || path.charCodeAt(CWD.length) == 47)) {
+ return path.substr(CWD.length + 1);
+ }
+
+ var a = CWD.split("\\");
+ var b = path.split("\\");
+ var i, j;
+
+ for (i = 0; i < b.length; i++) {
+ if (a[i].toLowerCase() == b[i].toLowerCase())
+ continue;
+ if (i > 0) {
+ /* first difference found */
+ path = "";
+ for (j = 0; j < a.length - i; j++) {
+ path += "..\\";
+ }
+ for (j = i; j < b.length; j++) {
+ path += b[j];
+ if (j < b.length - 1)
+ path += "\\";
+ }
+ return path;
+ }
+ /* on a different drive */
+ break;
+ }
+
+ return path;
+}
+
+function ConfigureArg(type, optname, helptext, defval)
+{
+ var opptype = type == "enable" ? "disable" : "without";
+
+ if (defval == "yes" || defval == "yes,shared") {
+ this.arg = "--" + opptype + "-" + optname;
+ this.imparg = "--" + type + "-" + optname;
+ } else {
+ this.arg = "--" + type + "-" + optname;
+ this.imparg = "--" + opptype + "-" + optname;
+ }
+
+ this.optname = optname;
+ this.helptext = helptext;
+ this.defval = defval;
+ this.symval = optname.toUpperCase().replace(new RegExp("-", "g"), "_");
+ this.seen = false;
+ this.argval = defval;
+}
+
+function ARG_WITH(optname, helptext, defval)
+{
+ configure_args[configure_args.length] = new ConfigureArg("with", optname, helptext, defval);
+}
+
+function ARG_ENABLE(optname, helptext, defval)
+{
+ configure_args[configure_args.length] = new ConfigureArg("enable", optname, helptext, defval);
+}
+
+function analyze_arg(argval)
+{
+ var ret = new Array();
+ var shared = false;
+
+ if (argval == "shared") {
+ shared = true;
+ argval = "yes";
+ } else if (argval == null) {
+ /* nothing */
+ } else if (arg_match = argval.match(new RegExp("^shared,(.*)"))) {
+ shared = true;
+ argval = arg_match[1];
+ } else if (arg_match = argval.match(new RegExp("^(.*),shared$"))) {
+ shared = true;
+ argval = arg_match[1];
+ }
+
+ ret[0] = shared;
+ ret[1] = argval;
+ return ret;
+}
+
+function word_wrap_and_indent(indent, text, line_suffix, indent_char)
+{
+ if (text == null) {
+ return "";
+ }
+
+ var words = text.split(new RegExp("\\s+", "g"));
+ var i = 0;
+ var ret_text = "";
+ var this_line = "";
+ var t;
+ var space = "";
+ var lines = 0;
+
+ if (line_suffix == null) {
+ line_suffix = "";
+ }
+
+ if (indent_char == null) {
+ indent_char = " ";
+ }
+
+ for (i = 0; i < indent; i++) {
+ space += indent_char;
+ }
+
+ for (i = 0; i < words.length; i++) {
+ if (this_line.length) {
+ t = this_line + " " + words[i];
+ } else {
+ t = words[i];
+ }
+
+ if (t.length + indent > 78) {
+ if (lines++) {
+ ret_text += space;
+ }
+ ret_text += this_line + line_suffix + "\r\n";
+ this_line = "";
+ }
+
+ if (this_line.length) {
+ this_line += " " + words[i];
+ } else {
+ this_line = words[i];
+ }
+ }
+
+ if (this_line.length) {
+ if (lines)
+ ret_text += space;
+ ret_text += this_line;
+ }
+
+ return ret_text;
+}
+
+function conf_process_args()
+{
+ var i, j;
+ var configure_help_mode = false;
+ var analyzed = false;
+ var nice = "cscript /nologo configure.js ";
+ var disable_all = false;
+
+ args = WScript.Arguments;
+ for (i = 0; i < args.length; i++) {
+ arg = args(i);
+ nice += ' "' + arg + '"';
+ if (arg == "--help") {
+ configure_help_mode = true;
+ break;
+ }
+ if (arg == "--disable-all") {
+ disable_all = true;
+ continue;
+ }
+
+ // If it is --foo=bar, split on the equals sign
+ arg = arg.split("=", 2);
+ argname = arg[0];
+ if (arg.length > 1) {
+ argval = arg[1];
+ } else {
+ argval = null;
+ }
+
+ // Find the arg
+ found = false;
+ for (j = 0; j < configure_args.length; j++) {
+ if (argname == configure_args[j].imparg || argname == configure_args[j].arg) {
+ found = true;
+
+ arg = configure_args[j];
+ arg.seen = true;
+
+ analyzed = analyze_arg(argval);
+
+ /* Force shared when called after phpize */
+ if (MODE_PHPIZE) {
+ shared = "shared";
+ } else {
+ shared = analyzed[0];
+ }
+ argval = analyzed[1];
+
+ if (argname == arg.imparg) {
+ /* we matched the implicit, or default arg */
+ if (argval == null) {
+ argval = arg.defval;
+ }
+ } else {
+ /* we matched the non-default arg */
+ if (argval == null) {
+ argval = arg.defval == "no" ? "yes" : "no";
+ }
+ }
+
+ arg.argval = argval;
+ eval("PHP_" + arg.symval + " = argval;");
+ eval("PHP_" + arg.symval + "_SHARED = shared;");
+ break;
+ }
+ }
+ if (!found) {
+ STDERR.WriteLine("Unknown option " + argname + "; please try configure.js --help for a list of valid options");
+ WScript.Quit(2);
+ }
+ }
+
+ if (configure_help_mode) {
+ STDOUT.WriteLine(word_wrap_and_indent(0,
+"Options that enable extensions and SAPI will accept \
+'yes' or 'no' as a parameter. They also accept 'shared' \
+as a synonym for 'yes' and request a shared build of that \
+module. Not all modules can be built as shared modules; \
+configure will display [shared] after the module name if \
+can be built that way. \
+"
+ ));
+ STDOUT.WriteBlankLines(1);
+
+ // Measure width to pretty-print the output
+ max_width = 0;
+ for (i = 0; i < configure_args.length; i++) {
+ arg = configure_args[i];
+ if (arg.arg.length > max_width)
+ max_width = arg.arg.length;
+ }
+
+ for (i = 0; i < configure_args.length; i++) {
+ arg = configure_args[i];
+
+ n = max_width - arg.arg.length;
+ pad = " ";
+ for (j = 0; j < n; j++) {
+ pad += " ";
+ }
+ STDOUT.WriteLine(" " + arg.arg + pad + word_wrap_and_indent(max_width + 5, arg.helptext));
+ }
+ WScript.Quit(1);
+ }
+
+ var snapshot_build_exclusions = new Array(
+ 'debug', 'crt-debug', 'lzf-better-compression',
+ 'php-build', 'snapshot-template', 'ereg',
+ 'pcre-regex', 'fastcgi', 'force-cgi-redirect',
+ 'path-info-check', 'zts', 'ipv6', 'memory-limit',
+ 'zend-multibyte', 'fd-setsize', 'memory-manager',
+ 't1lib', 'pgi', 'pgo'
+ );
+ var force;
+
+ // Now set any defaults we might have missed out earlier
+ for (i = 0; i < configure_args.length; i++) {
+ arg = configure_args[i];
+ if (arg.seen)
+ continue;
+ analyzed = analyze_arg(arg.defval);
+ shared = analyzed[0];
+ argval = analyzed[1];
+
+ // Don't trust a default "yes" answer for a non-core module
+ // in a snapshot build
+ if (PHP_SNAPSHOT_BUILD != "no" && argval == "yes" && !shared) {
+
+ force = true;
+ for (j = 0; j < snapshot_build_exclusions.length; j++) {
+ if (snapshot_build_exclusions[j] == arg.optname) {
+ force = false;
+ break;
+ }
+ }
+
+ if (force) {
+ /* now check if it is a core module */
+ force = false;
+ for (j = 0; j < core_module_list.length; j++) {
+ if (core_module_list[j] == arg.optname) {
+ force = true;
+ break;
+ }
+ }
+
+ if (!force) {
+ STDOUT.WriteLine("snapshot: forcing " + arg.arg + " shared");
+ shared = true;
+ }
+ }
+ }
+
+ if (PHP_SNAPSHOT_BUILD != "no" && argval == "no") {
+ force = true;
+ for (j = 0; j < snapshot_build_exclusions.length; j++) {
+ if (snapshot_build_exclusions[j] == arg.optname) {
+ force = false;
+ break;
+ }
+ }
+ if (force) {
+ STDOUT.WriteLine("snapshot: forcing " + arg.optname + " on");
+ argval = "yes";
+ shared = true;
+ }
+ }
+
+ if (disable_all) {
+ force = true;
+ for (j = 0; j < snapshot_build_exclusions.length; j++) {
+ if (snapshot_build_exclusions[j] == arg.optname) {
+ force = false;
+ break;
+ }
+ }
+ if (force) {
+ if (arg.defval == '') {
+ argval = '';
+ } else {
+ argval = "no";
+ }
+ shared = false;
+ }
+ }
+
+ eval("PHP_" + arg.symval + " = argval;");
+ eval("PHP_" + arg.symval + "_SHARED = shared;");
+ }
+
+ MFO = FSO.CreateTextFile("Makefile.objects", true);
+
+ STDOUT.WriteLine("Saving configure options to config.nice.bat");
+ var nicefile = FSO.CreateTextFile("config.nice.bat", true);
+ nicefile.WriteLine(nice + " %*");
+ nicefile.Close();
+
+ AC_DEFINE('CONFIGURE_COMMAND', nice, "Configure line");
+}
+
+function DEFINE(name, value)
+{
+ if (configure_subst.Exists(name)) {
+ configure_subst.Remove(name);
+ }
+ configure_subst.Add(name, value);
+}
+
+// Searches a set of paths for a file;
+// returns the dir in which the file was found,
+// true if it was found in the default env path,
+// or false if it was not found at all.
+// env_name is the optional name of an env var
+// specifying the default path to search
+function search_paths(thing_to_find, explicit_path, env_name)
+{
+ var i, found = false, place = false, file, env;
+
+ STDOUT.Write("Checking for " + thing_to_find + " ... ");
+
+ thing_to_find = thing_to_find.replace(new RegExp("/", "g"), "\\");
+
+ if (explicit_path != null) {
+ if (typeof(explicit_path) == "string") {
+ explicit_path = explicit_path.split(";");
+ }
+
+ for (i = 0; i < explicit_path.length; i++) {
+ file = glob(explicit_path[i] + "\\" + thing_to_find);
+ if (file) {
+ found = true;
+ place = file[0];
+ place = place.substr(0, place.length - thing_to_find.length - 1);
+ break;
+ }
+ }
+ }
+
+ if (!found && env_name != null) {
+ env = WshShell.Environment("Process").Item(env_name);
+ env = env.split(";");
+ for (i = 0; i < env.length; i++) {
+ file = glob(env[i] + "\\" + thing_to_find);
+ if (file) {
+ found = true;
+ place = true;
+ break;
+ }
+ }
+ }
+
+ if (found && place == true) {
+ STDOUT.WriteLine(" <in default path>");
+ } else if (found) {
+ STDOUT.WriteLine(" " + place);
+ } else {
+ STDOUT.WriteLine(" <not found>");
+ }
+ return place;
+}
+
+function PATH_PROG(progname, additional_paths, symbol)
+{
+ var exe;
+ var place;
+ var cyg_path = PHP_CYGWIN + "\\bin;" + PHP_CYGWIN + "\\usr\\local\\bin";
+ var php_build_bin_path = PHP_PHP_BUILD + "\\bin"
+
+ exe = progname + ".exe";
+
+ if (additional_paths == null) {
+ additional_paths = cyg_path;
+ } else {
+ additional_paths += ";" + cyg_path;
+ }
+
+ additional_paths = additional_paths + ";" + php_build_bin_path;
+
+ place = search_paths(exe, additional_paths, "PATH");
+
+ if (place == true) {
+ place = exe;
+ } else if (place != false) {
+ place = place + "\\" + exe;
+ }
+
+ if (place) {
+ if (symbol == null) {
+ symbol = progname.toUpperCase();
+ }
+ DEFINE(symbol, place);
+ }
+ return place;
+}
+
+function find_pattern_in_path(pattern, path)
+{
+ if (path == null) {
+ return false;
+ }
+
+ var dirs = path.split(';');
+ var i;
+ var items;
+
+ for (i = 0; i < dirs.length; i++) {
+ items = glob(dirs[i] + "\\" + pattern);
+ if (items) {
+ return condense_path(items[0]);
+ }
+ }
+ return false;
+}
+
+function CHECK_LIB(libnames, target, path_to_check, common_name)
+{
+ STDOUT.Write("Checking for library " + libnames + " ... ");
+
+ if (common_name == null && target != null) {
+ common_name = target;
+ }
+
+ if (path_to_check == null) {
+ path_to_check = "";
+ }
+
+ // if they specified a common name for the package that contains
+ // the library, tag some useful defaults on to the end of the
+ // path to be searched
+ if (common_name != null) {
+ path_to_check += ";" + PHP_PHP_BUILD + "\\" + common_name + "*";
+ path_to_check += ";" + PHP_PHP_BUILD + "\\lib\\" + common_name + "*";
+ path_to_check += ";..\\" + common_name + "*";
+ }
+
+ // Determine target for build flags
+ if (target == null) {
+ target = "";
+ } else {
+ target = "_" + target.toUpperCase();
+ }
+
+ // Expand path to include general dirs
+ path_to_check += ";" + php_usual_lib_suspects;
+
+ // It is common practice to put libs under one of these dir names
+ var subdirs = new Array(PHP_DEBUG == "yes" ? "Debug" : (PHP_DEBUG_PACK == "yes"?"Release_Dbg":"Release"), "lib", "libs", "libexec");
+
+ // libnames can be ; separated list of accepted library names
+ libnames = libnames.split(';');
+
+ // for debug builds, lib may have _debug appended, we want that first
+ if (PHP_DEBUG == "yes") {
+ var length = libnames.length;
+ for (var i = 0; i < length; i++) {
+ var name = new String(libnames[i]);
+ rExp = /.lib$/i;
+ name = name.replace(rExp,"_debug.lib");
+ libnames.unshift(name);
+ }
+ }
+
+ var i, j, k, libname;
+ var location = false;
+ var path = path_to_check.split(';');
+
+ for (i = 0; i < libnames.length; i++) {
+ libname = libnames[i];
+
+ for (k = 0; k < path.length; k++) {
+ location = glob(path[k] + "\\" + libname);
+ if (location) {
+ location = location[0];
+ break;
+ }
+ for (j = 0; j < subdirs.length; j++) {
+ location = glob(path[k] + "\\" + subdirs[j] + "\\" + libname);
+ if (location) {
+ location = location[0];
+ break;
+ }
+ }
+ if (location)
+ break;
+ }
+
+ if (location) {
+ location = condense_path(location);
+ var libdir = FSO.GetParentFolderName(location);
+ libname = FSO.GetFileName(location);
+ ADD_FLAG("LDFLAGS" + target, '/libpath:"' + libdir + '" ');
+ ADD_FLAG("LIBS" + target, libname);
+
+ STDOUT.WriteLine(location);
+
+ return location;
+ }
+
+ // Check in their standard lib path
+ location = find_pattern_in_path(libname, WshShell.Environment("Process").Item("LIB"));
+
+ if (location) {
+ location = condense_path(location);
+ libname = FSO.GetFileName(location);
+ ADD_FLAG("LIBS" + target, libname);
+
+ STDOUT.WriteLine("<in LIB path> " + libname);
+ return location;
+ }
+
+ // Check in their general extra libs path
+ location = find_pattern_in_path(libname, PHP_EXTRA_LIBS);
+ if (location) {
+ location = condense_path(location);
+ libname = FSO.GetFileName(location);
+ ADD_FLAG("LIBS" + target, libname);
+ STDOUT.WriteLine("<in extra libs path>");
+ return location;
+ }
+ }
+
+ STDOUT.WriteLine("<not found>");
+
+ return false;
+}
+
+function OLD_CHECK_LIB(libnames, target, path_to_check)
+{
+ if (target == null) {
+ target = "";
+ } else {
+ target = "_" + target.toUpperCase();
+ }
+
+ if (path_to_check == null) {
+ path_to_check = php_usual_lib_suspects;
+ } else {
+ path_to_check += ";" + php_usual_lib_suspects;
+ }
+ var have = 0;
+ var p;
+ var i;
+ var libname;
+
+ var subdir = PHP_DEBUG == "yes" ? "Debug" : (PHP_DEBUG_PACK == "yes"?"Release_Dbg":"Release");
+
+ libnames = libnames.split(';');
+ for (i = 0; i < libnames.length; i++) {
+ libname = libnames[i];
+ p = search_paths(libname, path_to_check, "LIB");
+
+ if (!p) {
+ p = search_paths(subdir + "\\" + libname, path_to_check, "LIB");
+ if (p) {
+ p += "\\" + subdir;
+ }
+ }
+
+ if (typeof(p) == "string") {
+ ADD_FLAG("LDFLAGS" + target, '/libpath:"' + p + '" ');
+ ADD_FLAG("LIBS" + target, libname);
+ have = 1;
+ } else if (p == true) {
+ ADD_FLAG("LIBS" + target, libname);
+ have = 1;
+ } else {
+ /* not found in the defaults or the explicit paths,
+ * so check the general extra libs; if we find
+ * it here, no need to add another /libpath: for it as we
+ * already have it covered, but we need to add the lib
+ * to LIBS_XXX */
+ if (false != search_paths(libname, PHP_EXTRA_LIBS, null)) {
+ ADD_FLAG("LIBS" + target, libname);
+ have = 1;
+ }
+ }
+
+ if (have) {
+ break;
+ }
+ }
+
+// AC_DEFINE("HAVE_" + header_name.toUpperCase().replace(new RegExp("/\\\\-\.", "g"), "_"), have);
+
+ return have;
+
+}
+
+function CHECK_FUNC_IN_HEADER(header_name, func_name, path_to_check, add_to_flag)
+{
+ var c = false;
+ var sym;
+
+ STDOUT.Write("Checking for " + func_name + " in " + header_name + " ... ");
+
+ c = GREP_HEADER(header_name, func_name, path_to_check);
+
+ sym = func_name.toUpperCase();
+ sym = sym.replace(new RegExp("[\\\\/\.-]", "g"), "_");
+
+ if (typeof(add_to_flag) == "undefined") {
+ AC_DEFINE("HAVE_" + sym, c ? 1 : 0);
+ } else {
+ ADD_FLAG(add_to_flag, "/DHAVE_" + sym + "=" + (c ? "1" : "0"));
+ }
+
+ if (c) {
+ STDOUT.WriteLine("OK");
+ return c;
+ }
+ STDOUT.WriteLine("No");
+ return false;
+}
+
+function GREP_HEADER(header_name, regex, path_to_check)
+{
+ var c = false;
+
+ if (FSO.FileExists(path_to_check + "\\" + header_name)) {
+ c = file_get_contents(path_to_check + "\\" + header_name);
+ }
+
+ if (!c) {
+ /* look in the include path */
+
+ var p = search_paths(header_name, path_to_check, "INCLUDE");
+ if (typeof(p) == "string") {
+ c = file_get_contents(p);
+ } else if (p == false) {
+ p = search_paths(header_name, PHP_EXTRA_INCLUDES, null);
+ if (typeof(p) == "string") {
+ c = file_get_contents(p);
+ }
+ }
+ if (!c) {
+ return false;
+ }
+ }
+
+ if (typeof(regex) == "string") {
+ regex = new RegExp(regex);
+ }
+
+ if (c.match(regex)) {
+ /* caller can now use RegExp.$1 etc. to get at patterns */
+ return true;
+ }
+ return false;
+}
+
+function CHECK_HEADER_ADD_INCLUDE(header_name, flag_name, path_to_check, use_env, add_dir_part, add_to_flag_only)
+{
+ var dir_part_to_add = "";
+
+ if (use_env == null) {
+ use_env = true;
+ }
+
+ // if true, add the dir part of the header_name to the include path
+ if (add_dir_part == null) {
+ add_dir_part = false;
+ } else if (add_dir_part) {
+ var basename = FSO.GetFileName(header_name);
+ dir_part_to_add = "\\" + header_name.substr(0, header_name.length - basename.length - 1);
+ }
+
+ if (path_to_check == null) {
+ path_to_check = php_usual_include_suspects;
+ } else {
+ path_to_check += ";" + php_usual_include_suspects;
+ }
+
+ var p = search_paths(header_name, path_to_check, use_env ? "INCLUDE" : null);
+ var have = 0;
+ var sym;
+
+ if (typeof(p) == "string") {
+ ADD_FLAG(flag_name, '/I "' + p + dir_part_to_add + '" ');
+ } else if (p == false) {
+ /* not found in the defaults or the explicit paths,
+ * so check the general extra includes; if we find
+ * it here, no need to add another /I for it as we
+ * already have it covered, unless we are adding
+ * the dir part.... */
+ p = search_paths(header_name, PHP_EXTRA_INCLUDES, null);
+ if (typeof(p) == "string" && add_dir_part) {
+ ADD_FLAG(flag_name, '/I "' + p + dir_part_to_add + '" ');
+ }
+ }
+ have = p ? 1 : 0
+
+ sym = header_name.toUpperCase();
+ sym = sym.replace(new RegExp("[\\\\/\.-]", "g"), "_");
+
+ if (typeof(add_to_flag_only) == "undefined" &&
+ flag_name.match(new RegExp("^CFLAGS_(.*)$"))) {
+ add_to_flag_only = true;
+ }
+
+ if (typeof(add_to_flag_only) != "undefined") {
+ ADD_FLAG(flag_name, "/DHAVE_" + sym + "=" + have);
+ } else {
+ AC_DEFINE("HAVE_" + sym, have, "have the " + header_name + " header file");
+ }
+
+ return p;
+}
+
+/* emits rule to generate version info for a SAPI
+ * or extension. Returns the name of the .res file
+ * that will be generated */
+function generate_version_info_resource(makefiletarget, basename, creditspath, sapi)
+{
+ var resname = makefiletarget + ".res";
+ var res_desc = makefiletarget;
+ var res_prod_name = "PHP " + makefiletarget;
+ var credits;
+ var thanks = "";
+ var logo = "";
+ var debug = "";
+ var project_url = "http://www.php.net";
+ var project_header = creditspath + "/php_" + basename + ".h";
+ var versioning = "";
+
+ if (sapi) {
+ var internal_name = basename.toUpperCase() + " SAPI";
+ } else {
+ var internal_name = basename.toUpperCase() + " extension";
+ }
+
+ if (FSO.FileExists(creditspath + '/CREDITS')) {
+ credits = FSO.OpenTextFile(creditspath + '/CREDITS', 1);
+ res_desc = credits.ReadLine();
+ try {
+ thanks = credits.ReadLine();
+ } catch (e) {
+ thanks = null;
+ }
+ if (thanks == null) {
+ thanks = "";
+ } else {
+ thanks = "Thanks to " + thanks;
+ }
+ credits.Close();
+ }
+
+ if (creditspath.match(new RegExp("pecl"))) {
+ /* PECL project url - this will eventually work correctly for all */
+ project_url = "http://pecl.php.net/" + basename;
+
+ /* keep independent versioning PECL-specific for now */
+ if (FSO.FileExists(project_header)) {
+ if (header = FSO.OpenTextFile(project_header, 1)) {
+ contents = header.ReadAll();
+ /* allowed: x.x.x[a|b|-alpha|-beta][RCx][-dev] */
+ if (contents.match(new RegExp('PHP_' + basename.toUpperCase() + '_VERSION(\\s+)"((\\d+\.\\d+(\.\\d+)?)((a|b)(\\d)?|\-[a-z]{3,5})?(RC\\d+)?(\-dev)?)'))) {
+ project_version = RegExp.$2;
+ file_version = RegExp.$3.split('.');
+ if (!file_version[2]) {
+ file_version[2] = 0;
+ }
+ versioning = '\\"" /d EXT_FILE_VERSION=' + file_version[0] + ',' + file_version[1] + ',' + file_version[2] + ' /d EXT_VERSION="\\"' + project_version;
+ }
+ header.Close();
+ }
+ }
+ }
+
+ if (makefiletarget.match(new RegExp("\\.exe$"))) {
+ logo = " /d WANT_LOGO ";
+ }
+
+ if (PHP_DEBUG != "no") {
+ debug = " /d _DEBUG";
+ }
+
+ /**
+ * Use user supplied template.rc if it exists
+ */
+ if (FSO.FileExists(creditspath + '\\template.rc')) {
+ MFO.WriteLine("$(BUILD_DIR)\\" + resname + ": " + creditspath + "\\template.rc");
+ MFO.WriteLine("\t$(RC) /fo $(BUILD_DIR)\\" + resname + logo + debug +
+ ' /d FILE_DESCRIPTION="\\"' + res_desc + '\\"" /d FILE_NAME="\\"' +
+ makefiletarget + '\\"" /d PRODUCT_NAME="\\"' + res_prod_name +
+ versioning + '\\"" /d THANKS_GUYS="\\"' + thanks + '\\"" ' +
+ creditspath + '\\template.rc');
+ return resname;
+ }
+ if (MODE_PHPIZE) {
+ MFO.WriteLine("$(BUILD_DIR)\\" + resname + ": $(PHP_DIR)\\build\\template.rc");
+ MFO.WriteLine("\t$(RC) /I $(PHP_DIR)/include /n /fo $(BUILD_DIR)\\" + resname + logo + debug +
+ ' /d FILE_DESCRIPTION="\\"' + res_desc + '\\"" /d FILE_NAME="\\"'
+ + makefiletarget + '\\"" /d URL="\\"' + project_url +
+ '\\"" /d INTERNAL_NAME="\\"' + internal_name + versioning +
+ '\\"" /d THANKS_GUYS="\\"' + thanks + '\\"" $(PHP_DIR)\\build\\template.rc');
+ } else {
+ MFO.WriteLine("$(BUILD_DIR)\\" + resname + ": win32\\build\\template.rc");
+ MFO.WriteLine("\t$(RC) /n /fo $(BUILD_DIR)\\" + resname + logo + debug +
+ ' /d FILE_DESCRIPTION="\\"' + res_desc + '\\"" /d FILE_NAME="\\"'
+ + makefiletarget + '\\"" /d URL="\\"' + project_url +
+ '\\"" /d INTERNAL_NAME="\\"' + internal_name + versioning +
+ '\\"" /d THANKS_GUYS="\\"' + thanks + '\\"" win32\\build\\template.rc');
+ }
+ MFO.WriteBlankLines(1);
+ return resname;
+}
+
+function SAPI(sapiname, file_list, makefiletarget, cflags, obj_dir)
+{
+ var SAPI = sapiname.toUpperCase();
+ var ldflags;
+ var resname;
+ var ld;
+ var manifest;
+
+ if (typeof(obj_dir) == "undefined") {
+ sapiname_for_printing = configure_module_dirname;
+ } else {
+ sapiname_for_printing = configure_module_dirname + " (via " + obj_dir + ")";
+ }
+
+ STDOUT.WriteLine("Enabling SAPI " + sapiname_for_printing);
+
+ MFO.WriteBlankLines(1);
+ MFO.WriteLine("# objects for SAPI " + sapiname);
+ MFO.WriteBlankLines(1);
+
+ if (cflags) {
+ ADD_FLAG('CFLAGS_' + SAPI, cflags);
+ }
+
+ ADD_SOURCES(configure_module_dirname, file_list, sapiname, obj_dir);
+ MFO.WriteBlankLines(1);
+ MFO.WriteLine("# SAPI " + sapiname);
+ MFO.WriteBlankLines(1);
+
+ /* generate a .res file containing version information */
+ resname = generate_version_info_resource(makefiletarget, sapiname, configure_module_dirname, true);
+
+ MFO.WriteLine(makefiletarget + ": $(BUILD_DIR)\\" + makefiletarget);
+ MFO.WriteLine("\t@echo SAPI " + sapiname_for_printing + " build complete");
+ if (MODE_PHPIZE) {
+ MFO.WriteLine("$(BUILD_DIR)\\" + makefiletarget + ": $(DEPS_" + SAPI + ") $(" + SAPI + "_GLOBAL_OBJS) $(PHPLIB) $(BUILD_DIR)\\" + resname);
+ } else {
+ MFO.WriteLine("$(BUILD_DIR)\\" + makefiletarget + ": $(DEPS_" + SAPI + ") $(" + SAPI + "_GLOBAL_OBJS) $(BUILD_DIR)\\$(PHPLIB) $(BUILD_DIR)\\" + resname);
+ }
+
+ if (makefiletarget.match(new RegExp("\\.dll$"))) {
+ ldflags = "/dll $(LDFLAGS)";
+ manifest = "-@$(_VC_MANIFEST_EMBED_DLL)";
+ } else if (makefiletarget.match(new RegExp("\\.lib$"))) {
+ ldflags = "$(LDFLAGS)";
+ ld = "$(MAKE_LIB)";
+ } else {
+ ldflags = "$(LDFLAGS)";
+ manifest = "-@$(_VC_MANIFEST_EMBED_EXE)";
+ }
+
+ if(PHP_PGI == "yes" || PHP_PGO != "no") {
+ ldflags += " /PGD:$(PGOPGD_DIR)\\" + makefiletarget.substring(0, makefiletarget.indexOf(".")) + ".pgd";
+ }
+
+ if (MODE_PHPIZE) {
+ if (ld) {
+ MFO.WriteLine("\t" + ld + " /nologo /out:$(BUILD_DIR)\\" + makefiletarget + " " + ldflags + " $(" + SAPI + "_GLOBAL_OBJS) $(PHPLIB) $(LDFLAGS_" + SAPI + ") $(LIBS_" + SAPI + ") $(BUILD_DIR)\\" + resname);
+ } else {
+ ld = "@$(CC)";
+ MFO.WriteLine("\t" + ld + " /nologo " + " $(" + SAPI + "_GLOBAL_OBJS) $(PHPLIB) $(LIBS_" + SAPI + ") $(BUILD_DIR)\\" + resname + " /link /out:$(BUILD_DIR)\\" + makefiletarget + " " + ldflags + " $(LDFLAGS_" + SAPI + ")");
+ }
+ } else {
+ if (ld) {
+ MFO.WriteLine("\t" + ld + " /nologo /out:$(BUILD_DIR)\\" + makefiletarget + " " + ldflags + " $(" + SAPI + "_GLOBAL_OBJS) $(BUILD_DIR)\\$(PHPLIB) $(LDFLAGS_" + SAPI + ") $(LIBS_" + SAPI + ") $(BUILD_DIR)\\" + resname);
+ } else {
+ ld = "@$(CC)";
+ MFO.WriteLine("\t" + ld + " /nologo " + " $(" + SAPI + "_GLOBAL_OBJS) $(BUILD_DIR)\\$(PHPLIB) $(LIBS_" + SAPI + ") $(BUILD_DIR)\\" + resname + " /link /out:$(BUILD_DIR)\\" + makefiletarget + " " + ldflags + " $(LDFLAGS_" + SAPI + ")");
+ }
+ }
+
+ if (manifest) {
+ MFO.WriteLine("\t" + manifest);
+ }
+
+ DEFINE('CFLAGS_' + SAPI + '_OBJ', '$(CFLAGS_' + SAPI + ')');
+
+ if (configure_module_dirname.match("pecl")) {
+ ADD_FLAG("PECL_TARGETS", makefiletarget);
+ } else {
+ ADD_FLAG("SAPI_TARGETS", makefiletarget);
+ }
+
+ if (PHP_DSP != "no") {
+ generate_dsp_file(sapiname, configure_module_dirname, file_list, false);
+ }
+
+ MFO.WriteBlankLines(1);
+ sapi_enabled[sapi_enabled.length] = [sapiname];
+}
+
+function ADD_DIST_FILE(filename)
+{
+ if (configure_module_dirname.match("pecl")) {
+ ADD_FLAG("PECL_EXTRA_DIST_FILES", filename);
+ } else {
+ ADD_FLAG("PHP_EXTRA_DIST_FILES", filename);
+ }
+}
+
+function file_get_contents(filename)
+{
+ var f, c;
+ try {
+ f = FSO.OpenTextFile(filename, 1);
+ c = f.ReadAll();
+ f.Close();
+ return c;
+ } catch (e) {
+ STDOUT.WriteLine("Problem reading " + filename);
+ return false;
+ }
+}
+
+// Add a dependency on another extension, so that
+// the dependencies are built before extname
+function ADD_EXTENSION_DEP(extname, dependson, optional)
+{
+ var EXT = extname.toUpperCase();
+ var DEP = dependson.toUpperCase();
+ var dep_present = false;
+ var dep_shared = false;
+
+ if (MODE_PHPIZE) {
+ ext_deps_js = file_get_contents(PHP_DIR + "\\script\\ext_deps.js");
+ eval(ext_deps_js);
+ }
+
+ try {
+ dep_present = eval("PHP_" + DEP);
+
+ if (dep_present != "no") {
+ try {
+ dep_shared = eval("PHP_" + DEP + "_SHARED");
+ } catch (e) {
+ dep_shared = false;
+ }
+ }
+
+ } catch (e) {
+ dep_present = "no";
+ }
+
+ if (optional) {
+ if (dep_present == "no") {
+ MESSAGE("\t" + dependson + " not found: " + dependson + " support in " + extname + " disabled");
+ return false;
+ }
+ }
+
+ var ext_shared = eval("PHP_" + EXT + "_SHARED");
+
+ if (dep_shared) {
+ if (!ext_shared) {
+ if (optional) {
+ MESSAGE("\tstatic " + extname + " cannot depend on shared " + dependson + ": " + dependson + "support disabled");
+ return false;
+ }
+ ERROR("static " + extname + " cannot depend on shared " + dependson);
+ }
+
+ ADD_FLAG("LDFLAGS_" + EXT, "/libpath:$(BUILD_DIR)");
+ ADD_FLAG("LIBS_" + EXT, "php_" + dependson + ".lib");
+ ADD_FLAG("DEPS_" + EXT, "$(BUILD_DIR)\\php_" + dependson + ".lib");
+
+ } else {
+
+ if (dep_present == "no") {
+ if (ext_shared) {
+ WARNING(extname + " cannot be built: missing dependency, " + dependson + " not found");
+
+ var dllname = ' php_' + extname + '.dll';
+
+ if (!REMOVE_TARGET(dllname, 'EXT_TARGETS')) {
+ REMOVE_TARGET(dllname, 'PECL_TARGETS');
+ }
+
+ return false;
+
+ }
+
+ ERROR("Cannot build " + extname + "; " + dependson + " not enabled");
+ return false;
+ }
+ } // dependency is statically built-in to PHP
+ return true;
+}
+
+function EXTENSION(extname, file_list, shared, cflags, dllname, obj_dir)
+{
+ var objs = null;
+ var EXT = extname.toUpperCase();
+ var extname_for_printing;
+ var ldflags;
+
+ if (shared == null) {
+ eval("shared = PHP_" + EXT + "_SHARED;");
+ } else {
+ eval("PHP_" + EXT + "_SHARED = shared;");
+ }
+
+ if (cflags == null) {
+ cflags = "";
+ }
+
+ if (typeof(obj_dir) == "undefined") {
+ extname_for_printing = configure_module_dirname;
+ } else {
+ extname_for_printing = configure_module_dirname + " (via " + obj_dir + ")";
+ }
+
+ if (shared) {
+ STDOUT.WriteLine("Enabling extension " + extname_for_printing + " [shared]");
+ cflags = "/D COMPILE_DL_" + EXT + " /D " + EXT + "_EXPORTS=1 " + cflags;
+ ADD_FLAG("CFLAGS_PHP", "/D COMPILE_DL_" + EXT);
+ } else {
+ STDOUT.WriteLine("Enabling extension " + extname_for_printing);
+ }
+
+ MFO.WriteBlankLines(1);
+ MFO.WriteLine("# objects for EXT " + extname);
+ MFO.WriteBlankLines(1);
+
+ ADD_SOURCES(configure_module_dirname, file_list, extname, obj_dir);
+
+ MFO.WriteBlankLines(1);
+
+ if (shared) {
+ if (dllname == null) {
+ dllname = "php_" + extname + ".dll";
+ }
+ var libname = dllname.substring(0, dllname.length-4) + ".lib";
+
+ var resname = generate_version_info_resource(dllname, extname, configure_module_dirname, false);
+ var ld = "@$(CC)";
+
+ ldflags = "";
+ if (PHP_PGI == "yes" || PHP_PGO != "no") {
+ ldflags = " /PGD:$(PGOPGD_DIR)\\" + dllname.substring(0, dllname.indexOf(".")) + ".pgd";
+ }
+
+ MFO.WriteLine("$(BUILD_DIR)\\" + libname + ": $(BUILD_DIR)\\" + dllname);
+ MFO.WriteBlankLines(1);
+ if (MODE_PHPIZE) {
+ MFO.WriteLine("$(BUILD_DIR)\\" + dllname + ": $(DEPS_" + EXT + ") $(" + EXT + "_GLOBAL_OBJS) $(PHPLIB) $(BUILD_DIR)\\" + resname);
+ MFO.WriteLine("\t" + ld + " $(" + EXT + "_GLOBAL_OBJS) $(PHPLIB) $(LIBS_" + EXT + ") $(LIBS) $(BUILD_DIR)\\" + resname + " /link /out:$(BUILD_DIR)\\" + dllname + " $(DLL_LDFLAGS) $(LDFLAGS) $(LDFLAGS_" + EXT + ")");
+ } else {
+ MFO.WriteLine("$(BUILD_DIR)\\" + dllname + ": $(DEPS_" + EXT + ") $(" + EXT + "_GLOBAL_OBJS) $(BUILD_DIR)\\$(PHPLIB) $(BUILD_DIR)\\" + resname);
+ MFO.WriteLine("\t" + ld + " $(" + EXT + "_GLOBAL_OBJS) $(BUILD_DIR)\\$(PHPLIB) $(LIBS_" + EXT + ") $(LIBS) $(BUILD_DIR)\\" + resname + " /link /out:$(BUILD_DIR)\\" + dllname + ldflags + " $(DLL_LDFLAGS) $(LDFLAGS) $(LDFLAGS_" + EXT + ")");
+ }
+ MFO.WriteLine("\t-@$(_VC_MANIFEST_EMBED_DLL)");
+ MFO.WriteBlankLines(1);
+
+ if (configure_module_dirname.match("pecl")) {
+ ADD_FLAG("PECL_TARGETS", dllname);
+ } else {
+ ADD_FLAG("EXT_TARGETS", dllname);
+ }
+ MFO.WriteLine(dllname + ": $(BUILD_DIR)\\" + dllname);
+ MFO.WriteLine("\t@echo EXT " + extname + " build complete");
+ MFO.WriteBlankLines(1);
+
+ DEFINE('CFLAGS_' + EXT + '_OBJ', '$(CFLAGS_' + EXT + ')');
+ } else {
+ ADD_FLAG("STATIC_EXT_OBJS", "$(" + EXT + "_GLOBAL_OBJS)");
+ ADD_FLAG("STATIC_EXT_LIBS", "$(LIBS_" + EXT + ")");
+ ADD_FLAG("STATIC_EXT_LDFLAGS", "$(LDFLAGS_" + EXT + ")");
+ ADD_FLAG("STATIC_EXT_CFLAGS", "$(CFLAGS_" + EXT + ")");
+
+ /* find the header that declares the module pointer,
+ * so we can include it in internal_functions.c */
+ var ext_dir = FSO.GetFolder(configure_module_dirname);
+ var fc = new Enumerator(ext_dir.Files);
+ var re = /\.h$/;
+ var s, c;
+ for (; !fc.atEnd(); fc.moveNext()) {
+ s = fc.item() + "";
+ if (s.match(re)) {
+ c = file_get_contents(s);
+ if (c.match("phpext_")) {
+ extension_include_code += '#include "' + configure_module_dirname + '/' + FSO.GetFileName(s) + '"\r\n';
+ }
+ }
+ }
+
+ extension_module_ptrs += '\tphpext_' + extname + '_ptr,\r\n';
+
+ DEFINE('CFLAGS_' + EXT + '_OBJ', '$(CFLAGS_PHP) $(CFLAGS_' + EXT + ')');
+ }
+ ADD_FLAG("CFLAGS_" + EXT, cflags);
+
+ if (PHP_DSP != "no") {
+ generate_dsp_file(extname, configure_module_dirname, file_list, shared);
+ }
+
+ extensions_enabled[extensions_enabled.length] = [extname, shared ? 'shared' : 'static'];
+}
+
+function ADD_SOURCES(dir, file_list, target, obj_dir)
+{
+ var i;
+ var tv;
+ var src, obj, sym, flags;
+
+ if (target == null) {
+ target = "php";
+ }
+
+ sym = target.toUpperCase() + "_GLOBAL_OBJS";
+ flags = "CFLAGS_" + target.toUpperCase() + '_OBJ';
+
+ if (configure_subst.Exists(sym)) {
+ tv = configure_subst.Item(sym);
+ } else {
+ tv = "";
+ }
+
+ file_list = file_list.split(new RegExp("\\s+"));
+ file_list.sort();
+
+ var re = new RegExp("\.[a-z0-9A-Z]+$");
+
+ dir = dir.replace(new RegExp("/", "g"), "\\");
+ var objs_line = "";
+ var srcs_line = "";
+
+ var sub_build = "$(BUILD_DIR)\\";
+
+ /* if module dir is not a child of the main source dir,
+ * we need to tweak it; we should have detected such a
+ * case in condense_path and rewritten the path to
+ * be relative.
+ * This probably breaks for non-sibling dirs, but that
+ * is not a problem as buildconf only checks for pecl
+ * as either a child or a sibling */
+ if (obj_dir == null) {
+ var build_dir = dir.replace(new RegExp("^..\\\\"), "");
+ var mangle_dir = build_dir.replace(new RegExp("[\\\\/.-]", "g"), "_");
+ var bd_flags_name = "CFLAGS_BD_" + mangle_dir.toUpperCase();
+ }
+ else {
+ var build_dir = obj_dir.replace(new RegExp("^..\\\\"), "");
+ var mangle_dir = build_dir.replace(new RegExp("[\\\\/.-]", "g"), "_");
+ var bd_flags_name = "CFLAGS_BD_" + mangle_dir.toUpperCase();
+ }
+
+ var dirs = build_dir.split("\\");
+ var i, d = "";
+ for (i = 0; i < dirs.length; i++) {
+ d += dirs[i];
+ build_dirs[build_dirs.length] = d;
+ d += "\\";
+ }
+ sub_build += d;
+
+
+ DEFINE(bd_flags_name, " /Fd" + sub_build + " /Fp" + sub_build + " /FR" + sub_build + " ");
+
+ for (i in file_list) {
+ src = file_list[i];
+ obj = src.replace(re, ".obj");
+ tv += " " + sub_build + obj;
+
+ if (!MODE_PHPIZE && PHP_ONE_SHOT == "yes") {
+ if (i > 0) {
+ objs_line += " " + sub_build + obj;
+ srcs_line += " " + dir + "\\" + src;
+ } else {
+ objs_line = sub_build + obj;
+ srcs_line = dir + "\\" + src;
+ }
+ } else {
+ MFO.WriteLine(sub_build + obj + ": " + dir + "\\" + src);
+ MFO.WriteLine("\t@$(CC) $(" + flags + ") $(CFLAGS) $(" + bd_flags_name + ") /c " + dir + "\\" + src + " /Fo" + sub_build + obj);
+ }
+ }
+
+ if (!MODE_PHPIZE && PHP_ONE_SHOT == "yes") {
+ MFO.WriteLine(objs_line + ": " + srcs_line);
+ MFO.WriteLine("\t$(CC) $(" + flags + ") $(CFLAGS) /Fo" + sub_build + " $(" + bd_flags_name + ") /c " + srcs_line);
+ }
+
+ DEFINE(sym, tv);
+}
+
+function REMOVE_TARGET(dllname, flag)
+{
+ var dllname = dllname.replace(/\s/g, "");
+ var EXT = dllname.replace(/php_(\S+)\.dll/, "$1").toUpperCase();
+ var php_flags = configure_subst.Item("CFLAGS_PHP");
+
+ if (configure_subst.Exists(flag)) {
+ var targets = configure_subst.Item(flag);
+
+ if (targets.match(dllname)) {
+ configure_subst.Remove(flag);
+ targets = targets.replace(dllname, "");
+ targets = targets.replace(/\s+/, " ");
+ targets = targets.replace(/\s$/, "");
+ configure_subst.Add(flag, targets);
+ configure_hdr.Add("HAVE_" + EXT, new Array(0, ""));
+ configure_subst.Item("CFLAGS_PHP") = php_flags.replace(" /D COMPILE_DL_" + EXT, "");
+ extensions_enabled.pop();
+ return true;
+ }
+ }
+ return false;
+}
+
+function generate_internal_functions()
+{
+ var infile, outfile;
+ var indata;
+
+ STDOUT.WriteLine("Generating main/internal_functions.c");
+
+ infile = FSO.OpenTextFile("main/internal_functions.c.in", 1);
+ indata = infile.ReadAll();
+ infile.Close();
+
+ indata = indata.replace("@EXT_INCLUDE_CODE@", extension_include_code);
+ indata = indata.replace("@EXT_MODULE_PTRS@", extension_module_ptrs);
+
+ if (FSO.FileExists("main/internal_functions.c")) {
+ var origdata = file_get_contents("main/internal_functions.c");
+
+ if (origdata == indata) {
+ STDOUT.WriteLine("\t[content unchanged; skipping]");
+ return;
+ }
+ }
+
+ outfile = FSO.CreateTextFile("main/internal_functions.c", true);
+ outfile.Write(indata);
+ outfile.Close();
+}
+
+function output_as_table(header, ar_out)
+{
+ var l = header.length;
+ var cols = 80;
+ var fixedlenght = "";
+ var t = 0;
+ var i,j,k,m;
+ var out = "| ";
+ var min = new Array(l);
+ var max = new Array(l);
+
+ if (l != ar_out[0].length) {
+ STDOUT.WriteLine("Invalid header argument, can't output the table " + l + " " + ar_out[0].length );
+ return;
+ }
+
+ for (j=0; j < l; j++) {
+ var tmax, tmin;
+
+ /*Figure out the max length per column */
+ tmin = 0;
+ tmax = 0;
+ for (k = 0; k < ar_out.length; k++) {
+ var t = ar_out[k][j].length;
+ if (t > tmax) tmax = t;
+ else if (t < tmin) tmin = t;
+ }
+ if (tmax > header[j].length) {
+ max[j] = tmax;
+ } else {
+ max[j] = header[j].length;
+ }
+ if (tmin < header[j].length) {
+ min[j] = header[j].length;
+ }
+ }
+
+ sep = "";
+ k = 0;
+ for (i = 0; i < l; i++) {
+ k += max[i] + 3;
+ }
+ k++;
+
+ for (j=0; j < k; j++) {
+ sep += "-";
+ }
+
+ STDOUT.WriteLine(sep);
+ out = "|";
+ for (j=0; j < l; j++) {
+ out += " " + header[j];
+ for (var i = 0; i < (max[j] - header[j].length); i++){
+ out += " ";
+ }
+ out += " |";
+ }
+ STDOUT.WriteLine(out);
+
+ STDOUT.WriteLine(sep);
+
+ out = "|";
+ for (i=0; i < ar_out.length; i++) {
+ line = ar_out[i];
+ for (j=0; j < l; j++) {
+ out += " " + line[j];
+ for (var k = 0; k < (max[j] - line[j].length); k++){
+ out += " ";
+ }
+ out += " |";
+ }
+ STDOUT.WriteLine(out);
+ out = "|";
+ }
+
+ STDOUT.WriteLine(sep);
+}
+
+function write_summary()
+{
+ var ar = new Array();
+
+ STDOUT.WriteBlankLines(2);
+
+ STDOUT.WriteLine("Enabled extensions:");
+ output_as_table(["Extension", "Mode"], extensions_enabled.sort());
+ STDOUT.WriteBlankLines(2);
+ if (!MODE_PHPIZE) {
+ STDOUT.WriteLine("Enabled SAPI:");
+ output_as_table(["Sapi Name"], sapi_enabled);
+ STDOUT.WriteBlankLines(2);
+ }
+ ar[0] = ['Build type', PHP_DEBUG == "yes" ? "Debug" : "Release"];
+ ar[1] = ['Thread Safety', PHP_ZTS == "yes" ? "Yes" : "No"];
+ ar[2] = ['Compiler', VC_VERSIONS[VCVERS]];
+ ar[3] = ['Architecture', X64 ? 'x64' : 'x86'];
+
+ output_as_table(["",""], ar);
+ STDOUT.WriteBlankLines(2);
+}
+
+function generate_files()
+{
+ var i, dir, bd, last;
+
+ STDOUT.WriteBlankLines(1);
+ STDOUT.WriteLine("Creating build dirs...");
+ dir = get_define("BUILD_DIR");
+ build_dirs.sort();
+ last = null;
+
+ if (!FSO.FolderExists(dir)) {
+ FSO.CreateFolder(dir);
+ }
+
+ for (i = 0; i < build_dirs.length; i++) {
+ bd = FSO.BuildPath(dir, build_dirs[i]);
+ if (bd == last) {
+ continue;
+ }
+ last = bd;
+
+ build_dir = get_define('BUILD_DIR');
+ build_dir = build_dir.replace(new RegExp("\\\\", "g"), "\\\\");
+ if (build_dir.substr(build_dir.Length - 2, 2) != '\\\\') {
+ build_dir += '\\\\';
+ }
+ ADD_FLAG("BUILD_DIRS_SUB", bd.replace(new RegExp(build_dir), ''));
+
+ if (!FSO.FolderExists(bd)) {
+ FSO.CreateFolder(bd);
+ }
+ }
+
+ if (PHP_DSP != "no") {
+ generate_dsp_file("TSRM", "TSRM", null, false);
+ generate_dsp_file("Zend", "Zend", null, false);
+ generate_dsp_file("win32", "win32", null, false);
+ generate_dsp_file("main", "main", null, false);
+ generate_dsp_file("streams", "main\\streams", null, false);
+ copy_dsp_files();
+ }
+
+ STDOUT.WriteLine("Generating files...");
+ generate_makefile();
+ if (!MODE_PHPIZE) {
+ generate_internal_functions();
+ generate_config_h();
+ generate_phpize();
+ }
+ STDOUT.WriteLine("Done.");
+ STDOUT.WriteBlankLines(1);
+ write_summary();
+
+ if (PHP_SNAPSHOT_BUILD != "no") {
+ STDOUT.WriteLine("Type 'nmake snap' to build a PHP snapshot");
+ } else {
+ STDOUT.WriteLine("Type 'nmake' to build PHP");
+ }
+}
+
+function generate_config_h()
+{
+ var infile, outfile;
+ var indata;
+ var prefix;
+
+ prefix = PHP_PREFIX.replace(new RegExp("\\\\", "g"), "\\\\");
+
+ STDOUT.WriteLine("Generating main/config.w32.h");
+
+ infile = FSO.OpenTextFile("win32/build/config.w32.h.in", 1);
+ indata = infile.ReadAll();
+ infile.Close();
+
+ outfile = FSO.CreateTextFile("main/config.w32.h", true);
+
+ indata = indata.replace(new RegExp("@PREFIX@", "g"), prefix);
+ outfile.Write(indata);
+
+ var keys = (new VBArray(configure_hdr.Keys())).toArray();
+ var i, j;
+ var item;
+ var pieces, stuff_to_crack, chunk;
+
+ outfile.WriteBlankLines(1);
+ outfile.WriteLine("/* values determined by configure.js */");
+
+ for (i in keys) {
+ item = configure_hdr.Item(keys[i]);
+ outfile.WriteBlankLines(1);
+ pieces = item[0];
+
+ if (item[1] != undefined) {
+ outfile.WriteLine("/* " + item[1] + " */");
+ }
+
+ if (typeof(pieces) == "string" && pieces.charCodeAt(0) == 34) {
+ /* quoted string have a maximal length of 2k under vc.
+ * solution is to crack them and let the compiler concat
+ * them implicitly */
+ stuff_to_crack = pieces;
+ pieces = "";
+
+ while (stuff_to_crack.length) {
+ j = 65;
+ while (stuff_to_crack.charCodeAt(j) != 32 && j < stuff_to_crack.length)
+ j++;
+
+ chunk = stuff_to_crack.substr(0, j);
+ pieces += chunk;
+ stuff_to_crack = stuff_to_crack.substr(chunk.length);
+ if (stuff_to_crack.length)
+ pieces += '" "';
+ }
+ }
+
+ outfile.WriteLine("#define " + keys[i] + " " + pieces);
+ }
+
+ outfile.Close();
+}
+
+function generate_phpize()
+{
+ STDOUT.WriteLine("Generating phpize");
+ dest = get_define("BUILD_DIR") + '/devel';
+
+ if (!FSO.FolderExists(dest)) {
+ FSO.CreateFolder(dest);
+ }
+
+ var MF = FSO.CreateTextFile(dest + "/phpize.js", true);
+ var DEPS = FSO.CreateTextFile(dest + "/ext_deps.js", true);
+ prefix = get_define("PHP_PREFIX");
+ prefix = prefix.replace(new RegExp("/", "g"), "\\");
+ prefix = prefix.replace(new RegExp("\\\\", "g"), "\\\\");
+ MF.WriteLine("var PHP_PREFIX=" + '"' + prefix + '"');
+ MF.WriteLine("var PHP_ZTS=" + '"' + (PHP_ZTS.toLowerCase() == "yes" ? "Yes" : "No") + '"');
+ MF.WriteLine("var VC_VERSION=" + VCVERS);
+ MF.WriteLine("var PHP_VERSION=" + PHP_VERSION);
+ MF.WriteLine("var PHP_MINOR_VERSION=" + PHP_MINOR_VERSION);
+ MF.WriteLine("var PHP_RELEASE_VERSION=" + PHP_RELEASE_VERSION);
+ MF.WriteBlankLines(1);
+ MF.WriteLine("/* Genereted extensions list with mode (static/shared) */");
+
+ var count = extensions_enabled.length;
+ for (i in extensions_enabled) {
+ out = "PHP_" + extensions_enabled[i][0].toUpperCase() + "_SHARED=" + (extensions_enabled[i][1] == 'shared' ? 'true' : 'false') + ";";
+ DEPS.WriteLine("PHP_" + extensions_enabled[i][0].toUpperCase() + "=true;");
+ DEPS.WriteLine(out);
+ MF.WriteLine(out);
+ }
+
+ MF.WriteBlankLines(2);
+ MF.WriteLine("/* Genereted win32/build/phpize.js.in */");
+ MF.WriteBlankLines(1);
+ MF.Write(file_get_contents("win32/build/phpize.js.in"));
+ MF.Close();
+ DEPS.Close();
+
+ /* Generate flags file */
+ /* spit out variable definitions */
+ CJ = FSO.CreateTextFile(dest + "/config.phpize.js");
+
+ CJ.WriteLine("var PHP_ZTS =" + '"' + PHP_ZTS + '"');
+ CJ.WriteLine("var PHP_DLL_LIB =" + '"' + get_define('PHPLIB') + '"');
+ CJ.WriteLine("var PHP_DLL =" + '"' + get_define('PHPDLL') + '"');
+ CJ.WriteBlankLines(1);
+ CJ.Close();
+}
+
+function generate_makefile()
+{
+ STDOUT.WriteLine("Generating Makefile");
+ var MF = FSO.CreateTextFile("Makefile", true);
+
+ MF.WriteLine("# Generated by configure.js");
+ /* spit out variable definitions */
+ var keys = (new VBArray(configure_subst.Keys())).toArray();
+ var i;
+ MF.WriteLine("PHP_SRC_DIR =" + PHP_SRC_DIR);
+ for (i in keys) {
+ // The trailing space is needed to prevent the trailing backslash
+ // that is part of the build dir flags (CFLAGS_BD_XXX) from being
+ // seen as a line continuation character
+ MF.WriteLine(keys[i] + "=" +
+ //word_wrap_and_indent(1, configure_subst.Item(keys[i]), ' \\', '\t') + " "
+ configure_subst.Item(keys[i]) + " "
+ );
+ MF.WriteBlankLines(1);
+ }
+
+ MF.WriteBlankLines(1);
+ if (MODE_PHPIZE) {
+ var TF = FSO.OpenTextFile(PHP_DIR + "/script/Makefile.phpize", 1);
+ } else {
+ var TF = FSO.OpenTextFile("win32/build/Makefile", 1);
+ }
+
+ MF.Write(TF.ReadAll());
+
+ MF.WriteLine("build-headers:");
+ MF.WriteLine(" @if not exist $(BUILD_DIR_DEV)\\include mkdir $(BUILD_DIR_DEV)\\include >nul");
+ MF.WriteLine(" @for %D in ($(INSTALL_HEADERS_DIR)) do @if not exist $(BUILD_DIR_DEV)\\include\\%D mkdir $(BUILD_DIR_DEV)\\include\\%D >nul");
+ for (i in headers_install) {
+ if (headers_install[i][2] != "") {
+ MF.WriteLine(" @if not exist $(BUILD_DIR_DEV)\\include\\" + headers_install[i][2] + " mkdir $(BUILD_DIR_DEV)\\include\\" +
+ headers_install[i][2] + ">nul");
+ MF.WriteLine(" @copy " + headers_install[i][0] + " " + "$(BUILD_DIR_DEV)\\include\\" + headers_install[i][2] + " /y >nul");
+ }
+ }
+ MF.WriteLine(" @for %D in ($(INSTALL_HEADERS_DIR)) do @copy %D*.h $(BUILD_DIR_DEV)\\include\\%D /y >nul");
+ TF.Close();
+
+ MF.WriteBlankLines(2);
+
+ MFO.Close();
+ TF = FSO.OpenTextFile("Makefile.objects", 1);
+ MF.Write(TF.ReadAll());
+ TF.Close();
+
+ MF.Close();
+}
+
+function ADD_FLAG(name, flags, target)
+{
+ if (target != null) {
+ name = target.toUpperCase() + "_" + name;
+ }
+ if (configure_subst.Exists(name)) {
+ var curr_flags = configure_subst.Item(name);
+
+ if (curr_flags.indexOf(flags) >= 0) {
+ return;
+ }
+
+ flags = curr_flags + " " + flags;
+ configure_subst.Remove(name);
+ }
+ configure_subst.Add(name, flags);
+
+ if (PHP_DSP != "no") {
+ if (flags && (name.substr(name.length-3) != "PHP") && (name.substr(0, 7) == "CFLAGS_")) {
+ DSP_FLAGS[DSP_FLAGS.length] = new Array(name, flags);
+ }
+ }
+}
+
+function get_define(name)
+{
+ if (configure_subst.Exists(name)) {
+ return configure_subst.Item(name);
+ }
+ return "";
+}
+
+// Add a .def to the core to export symbols
+function ADD_DEF_FILE(name)
+{
+ if (!configure_subst.Exists("PHPDEF")) {
+ DEFINE("PHPDEF", "$(BUILD_DIR)\\$(PHPDLL).def");
+ ADD_FLAG("PHP_LDFLAGS", "/def:$(PHPDEF)");
+ }
+ ADD_FLAG("PHP_DLL_DEF_SOURCES", name);
+}
+
+function AC_DEFINE(name, value, comment, quote)
+{
+ if (quote == null) {
+ quote = true;
+ }
+ if (quote && typeof(value) == "string") {
+ value = '"' + value.replace(new RegExp('(["\\\\])', "g"), '\\$1') + '"';
+ } else if (value.length == 0) {
+ value = '""';
+ }
+ var item = new Array(value, comment);
+ if (configure_hdr.Exists(name)) {
+ var orig_item = configure_hdr.Item(name);
+ STDOUT.WriteLine("AC_DEFINE[" + name + "]=" + value + ": is already defined to " + orig_item[0]);
+ } else {
+ configure_hdr.Add(name, item);
+ }
+}
+
+function MESSAGE(msg)
+{
+ STDOUT.WriteLine("" + msg);
+}
+
+function ERROR(msg)
+{
+ STDERR.WriteLine("ERROR: " + msg);
+ WScript.Quit(3);
+}
+
+function WARNING(msg)
+{
+ STDERR.WriteLine("WARNING: " + msg);
+ STDERR.WriteBlankLines(1);
+}
+
+function copy_and_subst(srcname, destname, subst_array)
+{
+ if (!FSO.FileExists(srcname)) {
+ srcname = configure_module_dirname + "\\" + srcname;
+ destname = configure_module_dirname + "\\" + destname;
+ }
+
+ var content = file_get_contents(srcname);
+ var i;
+
+ for (i = 0; i < subst_array.length; i+=2) {
+ var re = subst_array[i];
+ var rep = subst_array[i+1];
+
+ content = content.replace(re, rep);
+ }
+
+ var f = FSO.CreateTextFile(destname, true);
+ f.Write(content);
+ f.Close();
+}
+
+// glob using simple filename wildcards
+// returns an array of matches that are found
+// in the filesystem
+function glob(path_pattern)
+{
+ var path_parts = path_pattern.replace(new RegExp("/", "g"), "\\").split("\\");
+ var p;
+ var base = "";
+ var is_pat_re = /\*/;
+
+//STDOUT.WriteLine("glob: " + path_pattern);
+
+ if (FSO.FileExists(path_pattern)) {
+ return new Array(path_pattern);
+ }
+
+ // first, build as much as possible that doesn't have a pattern
+ for (p = 0; p < path_parts.length; p++) {
+ if (path_parts[p].match(is_pat_re))
+ break;
+ if (p)
+ base += "\\";
+ base += path_parts[p];
+ }
+
+ return _inner_glob(base, p, path_parts);
+}
+
+function _inner_glob(base, p, parts)
+{
+ var pat = parts[p];
+ var full_name = base + "\\" + pat;
+ var re = null;
+ var items = null;
+
+ if (p == parts.length) {
+ return false;
+ }
+
+//STDOUT.WriteLine("inner: base=" + base + " p=" + p + " pat=" + pat);
+
+ if (FSO.FileExists(full_name)) {
+ if (p < parts.length - 1) {
+ // we didn't reach the full extent of the pattern
+ return false;
+ }
+ return new Array(full_name);
+ }
+
+ if (FSO.FolderExists(full_name) && p == parts.length - 1) {
+ // we have reached the end of the pattern; no need to recurse
+ return new Array(full_name);
+ }
+
+ // Convert the pattern into a regexp
+ re = new RegExp("^" + pat.replace(/\./g, '\\.').replace(/\*/g, '.*').replace(/\?/g, '.') + "$", "i");
+
+ items = new Array();
+
+ if (!FSO.FolderExists(base)) {
+ return false;
+ }
+
+ var folder = FSO.GetFolder(base);
+ var fc = null;
+ var subitems = null;
+ var item_name = null;
+ var j;
+
+ fc = new Enumerator(folder.SubFolders);
+ for (; !fc.atEnd(); fc.moveNext()) {
+ item_name = FSO.GetFileName(fc.item());
+
+ if (item_name.match(re)) {
+ // got a match; if we are at the end of the pattern, just add these
+ // things to the items array
+ if (p == parts.length - 1) {
+ items[items.length] = fc.item();
+ } else {
+ // we should recurse and do more matches
+ subitems = _inner_glob(base + "\\" + item_name, p + 1, parts);
+ if (subitems) {
+ for (j = 0; j < subitems.length; j++) {
+ items[items.length] = subitems[j];
+ }
+ }
+ }
+ }
+ }
+
+ // if we are at the end of the pattern, we should match
+ // files too
+ if (p == parts.length - 1) {
+ fc = new Enumerator(folder.Files);
+ for (; !fc.atEnd(); fc.moveNext()) {
+ item_name = FSO.GetFileName(fc.item());
+ if (item_name.match(re)) {
+ items[items.length] = fc.item();
+ }
+ }
+ }
+
+ if (items.length == 0)
+ return false;
+
+ return items;
+}
+
+function PHP_INSTALL_HEADERS(dir, headers_list)
+{
+ headers_list = headers_list.split(new RegExp("\\s+"));
+ headers_list.sort();
+ if (dir.length > 0 && dir.substr(dir.length - 1) != '/' && dir.substr(dir.length - 1) != '\\') {
+ dir += '/';
+ }
+ dir = dir.replace(new RegExp("/", "g"), "\\");
+
+ for (i in headers_list) {
+ found = false;
+ src = headers_list[i];
+ src = src.replace(new RegExp("/", "g"), "\\");
+ isdir = FSO.FolderExists(dir + src);
+ isfile = FSO.FileExists(dir + src);
+ if (isdir) {
+ if (src.length > 0 && src.substr(src.length - 1) != '/' && src.substr(src.length - 1) != '\\') {
+ src += '\\';
+ }
+ headers_install[headers_install.length] = [dir + src, 'dir',''];
+ ADD_FLAG("INSTALL_HEADERS_DIR", dir + src);
+ found = true;
+ } else if (isfile) {
+ dirname = FSO.GetParentFolderName(dir + src);
+ headers_install[headers_install.length] = [dir + src, 'file', dirname];
+ ADD_FLAG("INSTALL_HEADERS", dir + src);
+ found = true;
+ } else {
+ path = configure_module_dirname + "\\"+ src;
+ isdir = FSO.FolderExists(path);
+ isfile = FSO.FileExists(path);
+ if (isdir) {
+ if (src.length > 0 && src.substr(src.length - 1) != '/' && src.substr(src.length - 1) != '\\') {
+ src += '\\';
+ }
+ headers_install[headers_install.length] = [path, 'dir',''];
+ ADD_FLAG("INSTALL_HEADERS_DIR", path);
+ } else if (isfile) {
+ dirname = FSO.GetParentFolderName(path);
+ headers_install[headers_install.length] = [path, 'file', dir];
+ ADD_FLAG("INSTALL_HEADERS", dir + src);
+ found = true;
+ }
+ }
+
+ if (found == false) {
+ STDOUT.WriteLine(headers_list);
+ ERROR("Cannot find header " + dir + src);
+ }
+ }
+}
+
+// for snapshot builders, this option will attempt to enable everything
+// and you can then build everything, ignoring fatal errors within a module
+// by running "nmake snap"
+PHP_SNAPSHOT_BUILD = "no";
+if (!MODE_PHPIZE) {
+ ARG_ENABLE('snapshot-build', 'Build a snapshot; turns on everything it can and ignores build errors', 'no');
+
+ // one-shot build optimizes build by asking compiler to build
+ // several objects at once, reducing overhead of starting new
+ // compiler processes.
+ ARG_ENABLE('one-shot', 'Optimize for fast build - best for release and snapshot builders, not so hot for edit-and-rebuild hacking', 'no');
+}
+
diff --git a/win32/build/cvsclean.js b/win32/build/cvsclean.js
new file mode 100644
index 0000000..c5f92a3
--- /dev/null
+++ b/win32/build/cvsclean.js
@@ -0,0 +1,120 @@
+/*
+ +----------------------------------------------------------------------+
+ | PHP Version 5 |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1997-2009 The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Author: Wez Furlong <wez@thebrainroom.com> |
+ | Pierre A. Joye <pierre@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id$ */
+// Cleans up files that do not belong in the repository
+
+var FSO = WScript.CreateObject("Scripting.FileSystemObject");
+var WshShell = WScript.CreateObject("WScript.Shell");
+var STDOUT = WScript.StdOut;
+
+/* svn propget svn:ignore dirname */
+function find_ignore(dirname)
+{
+ dirname = "" + dirname;
+ dirname_len = dirname.length;
+
+ if (!FSO.FolderExists(dirname) || (dirname_len >= 4 &&
+ dirname.substring(dirname_len - 4) == ".svn")) {
+ return;
+ }
+
+ var f = FSO.GetFolder(dirname);
+ var fc = new Enumerator(f.SubFolders);
+
+ for (; !fc.atEnd(); fc.moveNext()) {
+ find_ignore(fc.item());
+ }
+
+ kill_from_ignore(dirname);
+}
+
+/* recursive remove using ignore props style wildcard matching;
+ * note that FSO.DeleteFolder and FSO.DeleteFile methods both
+ * accept wildcards, but that they are dangerous to use eg:
+ * "*.php" will match "*.phpt" */
+function rm_r(filename)
+{
+ if (FSO.FolderExists(filename)) {
+ var fc = new Enumerator(FSO.GetFolder(filename).SubFolders);
+
+ for (; !fc.atEnd(); fc.moveNext()) {
+ rm_r(fc.item());
+ }
+
+ fc = new Enumerator(FSO.GetFolder(filename).Files);
+
+ for (; !fc.atEnd(); fc.moveNext()) {
+ FSO.DeleteFile(fc.item(), true);
+ }
+
+ FSO.DeleteFolder(filename, true);
+ } else if (FSO.FileExists(filename)) {
+ FSO.DeleteFile(filename, true);
+ } else {
+ /* we need to handle wildcards here */
+ var foldername = FSO.GetParentFolderName(filename);
+
+ if (foldername == "")
+ foldername = ".";
+
+ var filename = FSO.GetFileName(filename);
+
+ var retext = filename.replace(/\./g, '\\.');
+ retext = '^' + retext.replace(/\*/g, '.*') + "$";
+ var re = new RegExp(retext);
+
+ var folder = FSO.GetFolder(foldername);
+ var fc = new Enumerator(folder.SubFolders);
+ for (; !fc.atEnd(); fc.moveNext()) {
+
+ var item = FSO.GetFileName(fc.item());
+
+ if (item.match(re)) {
+ rm_r(fc.item());
+ }
+ }
+ var fc = new Enumerator(folder.Files);
+ for (; !fc.atEnd(); fc.moveNext()) {
+ item = FSO.GetFileName(fc.item());
+
+ if (item.match(re)) {
+ FSO.DeleteFile(fc.item(), true);
+ }
+ }
+ }
+}
+
+function kill_from_ignore(dirname)
+{
+ var l;
+ var e = WshShell.Exec("svn propget svn:ignore " + dirname);
+ var re = /^(config\.nice.*)|(\*)$/i;
+
+ while (!e.StdOut.atEndOfStream) {
+ l = e.StdOut.ReadLine();
+ if (l.length == 0 || re.test(l)) {
+ continue;
+ }
+ rm_r(dirname + l);
+ }
+
+}
+
+find_ignore(".");
diff --git a/win32/build/deplister.c b/win32/build/deplister.c
new file mode 100644
index 0000000..8da65ba
--- /dev/null
+++ b/win32/build/deplister.c
@@ -0,0 +1,60 @@
+/*
+ +----------------------------------------------------------------------+
+ | PHP Version 5 |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1997-2013 The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Author: Wez Furlong <wez@thebrainroom.com> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id$ */
+
+/* This little application will list the DLL dependencies for a PE
+ * module to it's stdout for use by distro/installer building tools */
+
+#include <windows.h>
+#include <imagehlp.h>
+
+BOOL CALLBACK StatusRoutine(IMAGEHLP_STATUS_REASON reason,
+ PSTR image_name, PSTR dll_name,
+ ULONG va, ULONG param)
+{
+ switch (reason) {
+ case BindImportModuleFailed:
+ printf("%s,NOTFOUND\n", dll_name);
+ return TRUE;
+
+ case BindImportModule:
+ printf("%s,OK\n", dll_name);
+ return TRUE;
+ }
+ return TRUE;
+}
+
+/* usage:
+ * deplister.exe path\to\module.exe path\to\symbols\root
+ * */
+
+int main(int argc, char *argv[])
+{
+ return BindImageEx(BIND_NO_BOUND_IMPORTS | BIND_NO_UPDATE | BIND_ALL_IMAGES,
+ argv[1], NULL, argv[2], StatusRoutine);
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/win32/build/libs_version.txt b/win32/build/libs_version.txt
new file mode 100644
index 0000000..decae8f
--- /dev/null
+++ b/win32/build/libs_version.txt
@@ -0,0 +1,16 @@
+bz2-1.0.6
+cclient-2007e
+freetype-2.4.3
+icu-49.1.2
+jpeglib-8
+libcurl-7.29.0
+libiconv-1.14
+libmcrypt-2.5.8
+libmpir-2.5.1
+libpng-1.2.50
+libpq-8.3.6
+libssh2-1.4.2
+libtidy-20090325
+libxslt-1.1.27
+libxml-2.7.8
+openssl-0.9.8y
diff --git a/win32/build/mkdist.php b/win32/build/mkdist.php
new file mode 100644
index 0000000..5ed9bdc
--- /dev/null
+++ b/win32/build/mkdist.php
@@ -0,0 +1,548 @@
+<?php # $Id$
+/* piece together a windows binary distro */
+
+$build_dir = $argv[1];
+$php_build_dir = $argv[2];
+$phpdll = $argv[3];
+$sapi_targets = explode(" ", $argv[4]);
+$ext_targets = explode(" ", $argv[5]);
+$pecl_targets = explode(" ", $argv[6]);
+$snapshot_template = $argv[7];
+
+$is_debug = preg_match("/^debug/i", $build_dir);
+
+echo "Making dist for $build_dir\n";
+
+$dist_dir = $build_dir . "/php-" . phpversion();
+$test_dir = $build_dir . "/php-test-pack-" . phpversion();
+$pecl_dir = $build_dir . "/pecl-" . phpversion();
+
+@mkdir($dist_dir);
+@mkdir("$dist_dir/ext");
+@mkdir("$dist_dir/dev");
+@mkdir("$dist_dir/extras");
+@mkdir($pecl_dir);
+
+/* figure out additional DLL's that are required */
+$extra_dll_deps = array();
+$per_module_deps = array();
+$pecl_dll_deps = array();
+
+function get_depends($module)
+{
+ static $no_dist = array(
+ /* windows system dlls that should not be bundled */
+ 'advapi32.dll', 'comdlg32.dll', 'crypt32.dll', 'gdi32.dll', 'kernel32.dll', 'ntdll.dll',
+ 'odbc32.dll', 'ole32.dll', 'oleaut32.dll', 'rpcrt4.dll',
+ 'shell32.dll', 'shlwapi.dll', 'user32.dll', 'ws2_32.dll', 'ws2help.dll',
+ 'comctl32.dll', 'winmm.dll', 'wsock32.dll', 'winspool.drv', 'msasn1.dll',
+ 'secur32.dll', 'netapi32.dll',
+
+ /* apache */
+ 'apachecore.dll',
+
+ /* apache 2 */
+ 'libhttpd.dll', 'libapr.dll', 'libaprutil.dll','libapr-1.dll', 'libaprutil-1.dll',
+
+ /* pi3web */
+ 'piapi.dll', 'pi3api.dll',
+
+ /* nsapi */
+ 'ns-httpd30.dll', 'ns-httpd35.dll', 'ns-httpd36.dll', 'ns-httpd40.dll',
+
+ /* oracle */
+ 'oci.dll', 'ociw32.dll',
+
+ /* sybase */
+ 'libcs.dll', 'libct.dll',
+
+ /* firebird */
+ 'fbclient.dll',
+
+ /* visual C++; mscvrt.dll is present on everyones system,
+ * but the debug version (msvcrtd.dll) and those from visual studio.net
+ * (msvcrt7x.dll) are not */
+ 'msvcrt.dll',
+ 'msvcr90.dll',
+ 'wldap32.dll'
+ );
+ global $build_dir, $extra_dll_deps, $ext_targets, $sapi_targets, $pecl_targets, $phpdll, $per_module_deps, $pecl_dll_deps;
+
+ $bd = strtolower(realpath($build_dir));
+
+ $is_pecl = in_array($module, $pecl_targets);
+
+ $cmd = "$GLOBALS[build_dir]\\deplister.exe \"$module\" \"$GLOBALS[build_dir]\"";
+ $proc = proc_open($cmd,
+ array(1 => array("pipe", "w")),
+ $pipes);
+
+ $n = 0;
+ while (($line = fgetcsv($pipes[1]))) {
+ $n++;
+
+ $dep = strtolower($line[0]);
+ $depbase = basename($dep);
+ /* ignore stuff in our build dir, but only if it is
+ * one of our targets */
+ if (((in_array($depbase, $sapi_targets) ||
+ in_array($depbase, $ext_targets) || in_array($depbase, $pecl_targets)) ||
+ $depbase == $phpdll) && file_exists($GLOBALS['build_dir'] . "/$depbase")) {
+ continue;
+ }
+ /* ignore some well-known system dlls */
+ if (in_array(basename($dep), $no_dist)) {
+ continue;
+ }
+
+ if ($is_pecl) {
+ if (!in_array($dep, $pecl_dll_deps)) {
+ $pecl_dll_deps[] = $dep;
+ }
+ } else {
+ if (!in_array($dep, $extra_dll_deps)) {
+ $extra_dll_deps[] = $dep;
+ }
+ }
+
+ $per_module_deps[basename($module)][] = $dep;
+ }
+ fclose($pipes[1]);
+ proc_close($proc);
+//echo "Module $module [$n lines]\n";
+}
+
+function copy_file_list($source_dir, $dest_dir, $list)
+{
+ global $is_debug, $dist_dir;
+
+ foreach ($list as $item) {
+ if (empty($item)) {
+ continue;
+ } elseif (!is_file($source_dir . DIRECTORY_SEPARATOR . $item)) {
+ echo "WARNING: $item not found\n";
+ continue;
+ }
+
+ echo "Copying $item from $source_dir to $dest_dir\n";
+ copy($source_dir . DIRECTORY_SEPARATOR . $item, $dest_dir . DIRECTORY_SEPARATOR . $item);
+ if ($is_debug) {
+ $itemdb = preg_replace("/\.(exe|dll|lib)$/i", ".pdb", $item);
+ if (file_exists("$source_dir/$itemdb")) {
+ copy("$source_dir/$itemdb", "$dist_dir/dev/$itemdb");
+ }
+ }
+ if (preg_match("/\.(exe|dll)$/i", $item)) {
+ get_depends($source_dir . '/' . $item);
+ }
+ }
+}
+
+function copy_text_file($source, $dest)
+{
+ $text = file_get_contents($source);
+ $text = preg_replace("/(\r\n?)|\n/", "\r\n", $text);
+ $fp = fopen($dest, "w");
+ fwrite($fp, $text);
+ fclose($fp);
+}
+
+/* very light-weight function to extract a single named file from
+ * a gzipped tarball. This makes assumptions about the files
+ * based on the PEAR info set in $packages. */
+function extract_file_from_tarball($pkg, $filename, $dest_dir) /* {{{ */
+{
+ global $packages;
+
+ $name = $pkg . '-' . $packages[$pkg];
+ $tarball = $dest_dir . "/" . $name . '.tgz';
+ $filename = $name . '/' . $filename;
+ $destfilename = $dest_dir . "/" . basename($filename);
+
+ $fp = gzopen($tarball, 'rb');
+
+ $done = false;
+ do {
+ /* read the header */
+ $hdr_data = gzread($fp, 512);
+ if (strlen($hdr_data) == 0)
+ break;
+ $checksum = 0;
+ for ($i = 0; $i < 148; $i++)
+ $checksum += ord($hdr_data{$i});
+ for ($i = 148; $i < 156; $i++)
+ $checksum += 32;
+ for ($i = 156; $i < 512; $i++)
+ $checksum += ord($hdr_data{$i});
+
+ $hdr = unpack("a100filename/a8mode/a8uid/a8gid/a12size/a12mtime/a8checksum/a1typeflag/a100link/a6magic/a2version/a32uname/a32gname/a8devmajor/a8devminor", $hdr_data);
+
+ $hdr['checksum'] = octdec(trim($hdr['checksum']));
+
+ if ($hdr['checksum'] != $checksum) {
+ echo "Checksum for $tarball $hdr[filename] is invalid\n";
+ print_r($hdr);
+ return;
+ }
+
+ $hdr['size'] = octdec(trim($hdr['size']));
+ echo "File: $hdr[filename] $hdr[size]\n";
+
+ if ($filename == $hdr['filename']) {
+ echo "Found the file we want\n";
+ $dest = fopen($destfilename, 'wb');
+ $x = stream_copy_to_stream($fp, $dest, $hdr['size']);
+ fclose($dest);
+ echo "Wrote $x bytes into $destfilename\n";
+ break;
+ }
+
+ /* skip body of the file */
+ $size = 512 * ceil((int)$hdr['size'] / 512);
+ echo "Skipping $size bytes\n";
+ gzseek($fp, gztell($fp) + $size);
+
+ } while (!$done);
+
+} /* }}} */
+
+
+/* the core dll */
+copy("$build_dir/php.exe", "$dist_dir/php.exe");
+copy("$build_dir/$phpdll", "$dist_dir/$phpdll");
+
+/* and the .lib goes into dev */
+$phplib = str_replace(".dll", ".lib", $phpdll);
+copy("$build_dir/$phplib", "$dist_dir/dev/$phplib");
+/* debug builds; copy the symbols too */
+if ($is_debug) {
+ $phppdb = str_replace(".dll", ".pdb", $phpdll);
+ copy("$build_dir/$phppdb", "$dist_dir/dev/$phppdb");
+}
+/* copy the sapi */
+copy_file_list($build_dir, "$dist_dir", $sapi_targets);
+
+/* copy the extensions */
+copy_file_list($build_dir, "$dist_dir/ext", $ext_targets);
+
+/* pecl sapi and extensions */
+if(sizeof($pecl_targets)) {
+ copy_file_list($build_dir, $pecl_dir, $pecl_targets);
+}
+
+/* populate reading material */
+$text_files = array(
+ "LICENSE" => "license.txt",
+ "NEWS" => "news.txt",
+ "README.REDIST.BINS" => "readme-redist-bins.txt",
+ "php.ini-development" => "php.ini-development",
+ "php.ini-production" => "php.ini-production",
+ "win32/install.txt" => "install.txt",
+ "win32/pws-php5cgi.reg" => "pws-php5cgi.reg",
+ "win32/pws-php5isapi.reg" => "pws-php5isapi.reg",
+);
+
+foreach ($text_files as $src => $dest) {
+ copy_text_file($src, $dist_dir . '/' . $dest);
+}
+
+/* general other files */
+$general_files = array(
+ "php.gif" => "php.gif",
+);
+
+foreach ($general_files as $src => $dest) {
+ copy($src, $dist_dir . '/' . $dest);
+}
+
+/* include a snapshot identifier */
+$branch = "HEAD"; // TODO - determine this from SVN branche name
+$fp = fopen("$dist_dir/snapshot.txt", "w");
+$now = date("r");
+$version = phpversion();
+fwrite($fp, <<<EOT
+This snapshot was automatically generated on
+$now
+
+Version: $version
+Branch: $branch
+Build: $build_dir
+
+EOT
+);
+/* list build-in extensions */
+$exts = get_loaded_extensions();
+fprintf($fp, "\r\nBuilt-in Extensions\r\n");
+fwrite($fp, "===========================\r\n");
+foreach ($exts as $ext) {
+ fprintf($fp, "%s\r\n", $ext);
+}
+fwrite($fp, "\r\n\r\n");
+
+/* list dependencies */
+fprintf($fp, "Dependency information:\r\n");
+foreach ($per_module_deps as $modulename => $deps) {
+ if (in_array($modulename, $pecl_targets))
+ continue;
+
+ fprintf($fp, "Module: %s\r\n", $modulename);
+ fwrite($fp, "===========================\r\n");
+ foreach ($deps as $dll) {
+ fprintf($fp, "\t%s\r\n", basename($dll));
+ }
+ fwrite($fp, "\r\n");
+}
+fclose($fp);
+
+/* Now add those dependencies */
+foreach ($extra_dll_deps as $dll) {
+ if (!file_exists($dll)) {
+ /* try template dir */
+ $tdll = $snapshot_template . "/dlls/" . basename($dll);
+ if (!file_exists($tdll)) {
+ $tdll = $php_build_dir . '/bin/' . basename($dll);
+ if (!file_exists($tdll)) {
+ echo "WARNING: distro depends on $dll, but could not find it on your system\n";
+ continue;
+ }
+ }
+ $dll = $tdll;
+ }
+ copy($dll, "$dist_dir/" . basename($dll));
+}
+
+/* TODO:
+add sanity check and test if all required DLLs are present, per version
+This version works at least for 3.6, 3.8 and 4.0 (5.3-vc6, 5.3-vc9 and HEAD).
+Add ADD_DLLS to add extra DLLs like dynamic dependencies for standard
+deps. For example, libenchant.dll loads libenchant_myspell.dll or
+libenchant_ispell.dll
+*/
+$ICU_DLLS = $php_build_dir . '/bin/icu*.dll';
+foreach (glob($ICU_DLLS) as $filename) {
+ copy($filename, "$dist_dir/" . basename($filename));
+}
+$ENCHANT_DLLS = array(
+ 'glib-2.dll',
+ 'gmodule-2.dll',
+ 'libenchant_myspell.dll',
+ 'libenchant_ispell.dll',
+);
+foreach ($ENCHANT_DLLS as $filename) {
+ copy($php_build_dir . '/bin/' . $filename, "$dist_dir/" . basename($filename));
+}
+
+/* and those for pecl */
+foreach ($pecl_dll_deps as $dll) {
+ if (in_array($dll, $extra_dll_deps)) {
+ /* already in main distro */
+ continue;
+ }
+ if (!file_exists($dll)) {
+ /* try template dir */
+ $tdll = $snapshot_template . "/dlls/" . basename($dll);
+ if (!file_exists($tdll)) {
+ echo "WARNING: distro depends on $dll, but could not find it on your system\n";
+ continue;
+ }
+ $dll = $tdll;
+ }
+ copy($dll, "$pecl_dir/" . basename($dll));
+}
+
+function copy_dir($source, $dest)
+{
+ if (!is_dir($dest)) {
+ if (!mkdir($dest)) {
+ return false;
+ }
+ }
+
+ $d = opendir($source);
+ while (($f = readdir($d)) !== false) {
+ if ($f == '.' || $f == '..' || $f == '.svn') {
+ continue;
+ }
+ $fs = $source . '/' . $f;
+ $fd = $dest . '/' . $f;
+ if (is_dir($fs)) {
+ copy_dir($fs, $fd);
+ } else {
+ copy($fs, $fd);
+ }
+ }
+ closedir($d);
+}
+
+
+
+function copy_test_dir($directory, $dest)
+{
+ if(substr($directory,-1) == '/') {
+ $directory = substr($directory,0,-1);
+ }
+
+ if ($directory == 'tests' || $directory == 'examples') {
+ if (!is_dir($dest . '/tests')) {
+ mkdir($dest . '/tests', 0775, true);
+ }
+ copy_dir($directory, $dest . '/tests/');
+
+ return false;
+ }
+
+ if(!file_exists($directory) || !is_dir($directory)) {
+ echo "failed... $directory\n";
+ return FALSE;
+ }
+
+ $directory_list = opendir($directory);
+
+ while (FALSE !== ($file = readdir($directory_list))) {
+ $full_path = $directory . '/' . $file;
+ if($file != '.' && $file != '..' && $file != '.svn' && is_dir($full_path)) {
+ if ($file == 'tests' || $file == 'examples') {
+ if (!is_dir($dest . '/' . $full_path)) {
+ mkdir($dest . '/' . $full_path , 0775, true);
+ }
+ copy_dir($full_path, $dest . '/' . $full_path . '/');
+ continue;
+ } else {
+ copy_test_dir($full_path, $dest);
+ }
+ }
+ }
+
+ closedir($directory_list);
+}
+
+function make_phar_dot_phar($dist_dir)
+{
+ if (!extension_loaded('phar')) {
+ return;
+ }
+
+ $path_to_phar = realpath(__DIR__ . '/../../ext/phar');
+
+ echo "Generating pharcommand.phar\n";
+ $phar = new Phar($dist_dir . '/pharcommand.phar', 0, 'pharcommand');
+
+ foreach (new DirectoryIterator($path_to_phar . '/phar') as $file) {
+ if ($file->isDir() || $file == 'phar.php') {
+ continue;
+ }
+
+ echo 'adding ', $file, "\n";
+ $phar[(string) $file] = file_get_contents($path_to_phar. '/phar/' . $file);
+ }
+
+ $phar->setSignatureAlgorithm(Phar::SHA1);
+ $stub = file($path_to_phar . '/phar/phar.php');
+
+ unset($stub[0]); // remove hashbang
+ $phar->setStub(implode('', $stub));
+
+ echo "Creating phar.phar.bat\n";
+ file_put_contents($dist_dir . '/phar.phar.bat', "%~dp0php.exe %~dp0pharcommand.phar %*\r\n");
+}
+
+if (!is_dir($test_dir)) {
+ mkdir($test_dir);
+}
+
+$dirs = array(
+ 'ext',
+ 'Sapi',
+ 'Zend',
+ 'tests'
+);
+foreach ($dirs as $dir) {
+ copy_test_dir($dir, $test_dir);
+}
+copy('run-tests.php', $test_dir . '/run-test.php');
+
+/* change this next line to true to use good-old
+ * hand-assembled go-pear-bundle from the snapshot template */
+$use_pear_template = true;
+
+if (!$use_pear_template) {
+ /* Let's do a PEAR-less pear setup */
+ mkdir("$dist_dir/PEAR");
+ mkdir("$dist_dir/PEAR/go-pear-bundle");
+
+ /* grab the bootstrap script */
+ echo "Downloading go-pear\n";
+ copy("http://pear.php.net/go-pear", "$dist_dir/PEAR/go-pear.php");
+
+ /* import the package list -- sets $packages variable */
+ include "pear/go-pear-list.php";
+
+ /* download the packages into the destination */
+ echo "Fetching packages\n";
+
+ foreach ($packages as $name => $version) {
+ $filename = "$name-$version.tgz";
+ $destfilename = "$dist_dir/PEAR/go-pear-bundle/$filename";
+ if (file_exists($destfilename))
+ continue;
+ $url = "http://pear.php.net/get/$filename";
+ echo "Downloading $name from $url\n";
+ flush();
+ copy($url, $destfilename);
+ }
+
+ echo "Download complete. Extracting bootstrap files\n";
+
+ /* Now, we want PEAR.php, Getopt.php (Console_Getopt) and Tar.php (Archive_Tar)
+ * broken out of the tarballs */
+ extract_file_from_tarball('PEAR', 'PEAR.php', "$dist_dir/PEAR/go-pear-bundle");
+ extract_file_from_tarball('Archive_Tar', 'Archive/Tar.php', "$dist_dir/PEAR/go-pear-bundle");
+ extract_file_from_tarball('Console_Getopt', 'Console/Getopt.php', "$dist_dir/PEAR/go-pear-bundle");
+}
+
+/* add extras from the template dir */
+if (file_exists($snapshot_template)) {
+ $items = glob("$snapshot_template/*");
+ print_r($items);
+
+ foreach ($items as $item) {
+ $bi = basename($item);
+ if (is_dir($item)) {
+ if ($bi == 'dlls' || $bi == 'symbols') {
+ continue;
+ } else if ($bi == 'PEAR') {
+ if ($use_pear_template) {
+ /* copy to top level */
+ copy_dir($item, "$dist_dir/$bi");
+ }
+ } else {
+ /* copy that dir into extras */
+ copy_dir($item, "$dist_dir/extras/$bi");
+ }
+ } else {
+ if ($bi == 'go-pear.bat') {
+ /* copy to top level */
+ copy($item, "$dist_dir/$bi");
+ } else {
+ /* copy to extras */
+ copy($item, "$dist_dir/extras/$bi");
+ }
+ }
+ }
+
+ /* copy c++ runtime */
+ $items = glob("$snapshot_template/dlls/*.CRT");
+
+ foreach ($items as $item) {
+ $bi = basename($item);
+ if (is_dir($item)) {
+ copy_dir($item, "$dist_dir/$bi");
+ copy_dir($item, "$dist_dir/ext/$bi");
+ }
+ }
+} else {
+ echo "WARNING: you don't have a snapshot template, your dist will not be complete\n";
+}
+
+make_phar_dot_phar($dist_dir);
+?>
diff --git a/win32/build/php.ico b/win32/build/php.ico
new file mode 100644
index 0000000..43bf002
--- /dev/null
+++ b/win32/build/php.ico
Binary files differ
diff --git a/win32/build/phpize.bat b/win32/build/phpize.bat
new file mode 100644
index 0000000..c8840d3
--- /dev/null
+++ b/win32/build/phpize.bat
@@ -0,0 +1,6 @@
+@echo off
+SET PHP_BUILDCONF_PATH=%~dp0
+cscript /nologo %PHP_BUILDCONF_PATH%\script\phpize.js %*
+copy %PHP_BUILDCONF_PATH%\win32\build\configure.bat %PHP_BUILDCONF_PATH% > nul
+IF NOT EXIST %PHP_BUILDCONF_PATH% (echo Error generating configure script, configure script was not copied) ELSE (echo Now run 'configure --help')
+SET PHP_BUILDCONF_PATH=
diff --git a/win32/build/phpize.js.in b/win32/build/phpize.js.in
new file mode 100644
index 0000000..4813ec0
--- /dev/null
+++ b/win32/build/phpize.js.in
@@ -0,0 +1,260 @@
+/*
+ +----------------------------------------------------------------------+
+ | PHP Version 5 |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1997-2008 The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Author: Pierre Joye <pierre1@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id$ */
+// This generates a configure script for win32 build
+
+var STDOUT = WScript.StdOut;
+
+var FSO = WScript.CreateObject("Scripting.FileSystemObject");
+var C = FSO.CreateTextFile("configure.js", true);
+var B = FSO.CreateTextFile("configure.bat", true);
+var DSP = false;
+re = /\\script/i;
+var PHP_DIR=FSO.GetParentFolderName(WScript.ScriptFullName).replace(re,"");
+
+var modules = "";
+var MODULES = WScript.CreateObject("Scripting.Dictionary");
+var module_dirs = new Array();
+
+function ERROR(msg)
+{
+ STDERR.WriteLine("ERROR: " + msg);
+ WScript.Quit(3);
+}
+
+function file_get_contents(filename)
+{
+ var F = FSO.OpenTextFile(filename, 1);
+ var t = F.ReadAll();
+ F.Close();
+ return t;
+}
+
+function Module_Item(module_name, config_path, dir_line, deps, content)
+{
+ this.module_name = module_name;
+ this.config_path = config_path;
+ this.dir_line = dir_line;
+ this.deps = deps;
+ this.content = content;
+}
+
+function get_module_dep(contents)
+{
+ var re_dep_line = new RegExp("ADD_EXTENSION_DEP\\([^,]*\\s*,\\s*['\"]([^'\"]+)['\"].*\\)", "gm");
+ var calls = contents.match(re_dep_line);
+ var deps = new Array();
+ if (calls != null) {
+ for (i = 0; i < calls.length; i++) {
+ // now we need the extension name out of this thing
+ if (calls[i].match(re_dep_line)) {
+ deps[deps.length] = RegExp.$1;
+
+ }
+ }
+ }
+ return deps;
+}
+
+function find_config_w32(dirname)
+{
+ if (!FSO.FolderExists(dirname)) {
+ return;
+ }
+
+ var f = FSO.GetFolder(dirname);
+ var fc = new Enumerator(f.SubFolders);
+ var c, i, ok, n;
+ var item = null;
+
+ c = dirname + "\\config.w32";
+ if (FSO.FileExists(c)) {
+ var dir_line = "configure_module_dirname = condense_path(FSO.GetParentFolderName('"
+ + c.replace(new RegExp('(["\\\\])', "g"), '\\$1') + "'));\r\n";
+ var contents = file_get_contents(c);
+
+ deps = get_module_dep(contents);
+
+ item = new Module_Item(n, c, dir_line, deps, contents);
+ MODULES.Add(n, item);
+ }
+
+ for (; !fc.atEnd(); fc.moveNext()) {
+ /* check if we already picked up a module with the same dirname;
+ * if we have, don't include it here */
+ n = FSO.GetFileName(fc.item());
+ if (n == '.svn' || n == 'tests' || n == '.git') {
+ continue;
+ }
+
+ c = FSO.BuildPath(fc.item(), "config.w32");
+ if (FSO.FileExists(c)) {
+ var dir_line = "configure_module_dirname = condense_path(FSO.GetParentFolderName('"
+ + c.replace(new RegExp('(["\\\\])', "g"), '\\$1') + "'));\r\n";
+ var contents = file_get_contents(c);
+
+ deps = get_module_dep(contents);
+
+ item = new Module_Item(n, c, dir_line, deps, contents);
+ MODULES.Add(n, item);
+ }
+ }
+}
+
+function emit_module(item)
+{
+ return item.dir_line + item.content;
+}
+
+function emit_dep_modules(module_names)
+{
+ var i, mod_name, j;
+ var output = "";
+ var item = null;
+
+ for (i in module_names) {
+ mod_name = module_names[i];
+
+ if (MODULES.Exists(mod_name)) {
+ item = MODULES.Item(mod_name);
+ MODULES.Remove(mod_name);
+ if (item.deps.length) {
+ output += emit_dep_modules(item.deps);
+ }
+ output += emit_module(item);
+ }
+ }
+
+ return output;
+}
+
+function gen_modules()
+{
+ var module_names = (new VBArray(MODULES.Keys())).toArray();
+ var i, mod_name, j;
+ var item;
+ var output = "";
+
+ // first, look for modules with empty deps; emit those first
+ for (i in module_names) {
+ STDOUT.WriteLine("module ... " + module_names);
+ mod_name = module_names[i];
+ item = MODULES.Item(mod_name);
+ if (item.deps.length == 0) {
+ MODULES.Remove(mod_name);
+ output += emit_module(item);
+ }
+ }
+
+ // now we are left with modules that have dependencies on other modules
+ module_names = (new VBArray(MODULES.Keys())).toArray();
+ output += emit_dep_modules(module_names);
+
+ return output;
+}
+
+// Process buildconf arguments
+function buildconf_process_args()
+{
+ args = WScript.Arguments;
+
+ for (i = 0; i < args.length; i++) {
+ arg = args(i);
+ // If it is --foo=bar, split on the equals sign
+ arg = arg.split("=", 2);
+ argname = arg[0];
+ if (arg.length > 1) {
+ argval = arg[1];
+ } else {
+ argval = null;
+ }
+
+ if (argname == '--clean' && argval != null) {
+ STDOUT.WriteLine("Cleaning...");
+ return 0;
+ }
+
+ if (argname == '--help') {
+ STDOUT.WriteLine("Usage: phpize [--clean|--help|--version|-v]");
+ return 0;
+ }
+ return 1;
+ }
+}
+
+if (buildconf_process_args() == 0) {
+ WScript.Quit(3);
+}
+STDOUT.WriteLine("Rebuilding configure.js");
+STDOUT.WriteLine(PHP_DIR);
+
+// Write the head of the configure script
+C.WriteLine("/* This file automatically generated from script/confutils.js */");
+C.WriteLine("var MODE_PHPIZE = true;");
+C.WriteLine("var PHP_DIR = " + '"' + PHP_DIR.replace(new RegExp('(["\\\\])', "g"), '\\$1') + '"');
+
+C.Write(file_get_contents(PHP_DIR + "/script/confutils.js"));
+C.Write(file_get_contents(PHP_DIR + "/script/config.phpize.js"));
+
+// If project files were requested, pull in the code to generate them
+if (DSP == true) {
+ C.WriteLine('PHP_DSP="yes"');
+ C.WriteBlankLines(1);
+ C.Write(file_get_contents(PHP_DIR + "win32/build/projectgen.js"));
+} else {
+ C.WriteLine('PHP_DSP="no"');
+ C.WriteBlankLines(1);
+}
+
+// Pull in code for the base detection
+modules = file_get_contents(PHP_DIR + "/script/config.w32.phpize.in");
+
+C.WriteLine("ARG_ENABLE('debug', 'Compile with debugging symbols', \"no\");");
+find_config_w32(".");
+
+// Now generate contents of module based on MODULES, chasing dependencies
+// to ensure that dependent modules are emitted first
+modules += gen_modules();
+
+// Look for ARG_ENABLE or ARG_WITH calls
+re = new RegExp("(ARG_(ENABLE|WITH)\([^;]+\);)", "gm");
+calls = modules.match(re);
+for (i = 0; i < calls.length; i++) {
+ item = calls[i];
+ C.WriteLine("try {");
+ C.WriteLine(item);
+ C.WriteLine("} catch (e) {");
+ C.WriteLine('\tSTDOUT.WriteLine("problem: " + e);');
+ C.WriteLine("}");
+}
+
+C.WriteBlankLines(1);
+C.WriteLine("conf_process_args();");
+C.WriteBlankLines(1);
+
+// Comment out the calls from their original positions
+modules = modules.replace(re, "/* $1 */");
+C.Write(modules);
+
+
+C.WriteBlankLines(1);
+C.Write(file_get_contents(PHP_DIR + "\\script\\configure.tail"));
+
+B.WriteLine("@echo off");
+B.WriteLine("cscript /nologo configure.js %*");
diff --git a/win32/build/projectgen.js b/win32/build/projectgen.js
new file mode 100644
index 0000000..390a303
--- /dev/null
+++ b/win32/build/projectgen.js
@@ -0,0 +1,625 @@
+/* check for duplicate entries */
+function check_duplicates(local, core)
+{
+ if (!local) {
+ return core;
+ }
+
+ arr = local.split(" ");
+
+ for(i = 0; i < arr.length; i++) {
+ if (core.match(arr[i])) {
+ continue;
+ }
+ core += " " + arr[i];
+ }
+
+ return core;
+}
+
+/* read .dsp source blocks */
+function read_src_files(ext, tmpl, path)
+{
+ sources = file_get_contents("tmp\\src\\" + ext + ".sources.tmp");
+ sources = (path ? sources.replace(/\.\//g, path) : sources);
+ tmpl = tmpl.replace("SOURCEFILES", sources);
+ FSO.DeleteFile("tmp\\src\\" + ext + ".sources.tmp");
+
+ headers = file_get_contents("tmp\\src\\" + ext + ".headers.tmp");
+ headers = (path ? headers.replace(/\.\//g, path) : headers);
+ tmpl = tmpl.replace("HEADERFILES", headers);
+ FSO.DeleteFile("tmp\\src\\" + ext + ".headers.tmp");
+
+ return tmpl;
+}
+
+/* write a .dsp source block */
+function write_src_file(fname, path, intpath, arr)
+{
+ FSO.FolderExists("tmp\\src") ? "" : FSO.CreateFolder("tmp\\src");
+ var src = FSO.CreateTextFile("tmp\\src\\" + fname, true);
+ var out = get_define("BUILD_DIR");
+ var libpath = "";
+
+ for (i = 0; i < arr.length; i++) {
+ if (arr[i].length > 1) {
+ if (arr[i].match('alloca.c') ||
+ arr[i].match(/internal_functions_(nw|win32)\.c/) ||
+ arr[i].match(/flock\.(c|h)/) ||
+ arr[i].match(/zend_static_allocator\.(c|h)/) ||
+ arr[i].match(/zend_(ini|language)_scanner_defs\.h/)) {
+ continue;
+ }
+
+ libpath = arr[i].substr(2, arr[i].lastIndexOf("\\") - 2);
+ if (libpath) {
+ libpath = "\\" + libpath;
+ }
+
+ src.WriteLine("# Begin Source File");
+ src.WriteLine("SOURCE=" + arr[i]);
+ src.WriteLine('# PROP Intermediate_Dir "' + intpath + out + '\\' + path + libpath + '"');
+ src.WriteLine("# End Source File");
+ src.WriteBlankLines(1);
+ }
+ }
+
+ src.Close();
+ return;
+}
+
+/* generate list of text files */
+function generate_text_filelist(ext, ext_dir)
+{
+ var txtdir = FSO.GetFolder(ext_dir);
+
+ block = '# Begin Group "Text Files"\r\n\# PROP Default_Filter ""\r\n\r\n';
+ txt = new Enumerator(txtdir.Files);
+
+ for (; !txt.atEnd(); txt.moveNext()) {
+ fname = FSO.GetFileName(txt.item());
+ munged = fname.replace(ext, ""); /* TSRM...! */
+
+ if (munged.match(/[A-Z]{4}/)){
+ block += "# Begin Source File\r\n";
+ block += "SOURCE=./" + fname + "\r\n";
+ block += "# End Source File\r\n\r\n";
+ }
+ }
+
+ block += "# End Group\r\n";
+ return block;
+}
+
+/* generate list of resource files */
+function generate_resource_filelist(ext, ext_dir)
+{
+ var resdir = FSO.GetFolder(ext_dir);
+ res = new Enumerator(resdir.Files);
+ block = "";
+
+ for (; !res.atEnd(); res.moveNext()) {
+ fname = FSO.GetFileName(res.item());
+
+ if (fname.match(/\.(ico|rc)/)) {
+ block += "# Begin Source File\r\n";
+ block += "SOURCE=./" + fname + "\r\n";
+ block += "# End Source File\r\n\r\n";
+ }
+ }
+
+ return block;
+}
+
+/* generate parser and scanner files for Zend */
+function generate_parsers_or_scanners(arr, type)
+{
+ var filter = (type.match("Parsers") ? "y" : "l");
+
+ ret = '# Begin Group "' + type + '"\r\n# PROP Default_Filter "' + filter + '"\r\n\r\n';
+
+ for (i = 0; i < arr.length; i++) {
+
+ fl = "zend_" + arr[i] + "_" + type.toLowerCase().substr(0, type.length - 1);
+ ret += "# Begin Source File\r\n";
+ ret += "SOURCE=.\\" + fl + "." + filter + "\r\n\r\n";
+ ret += '# Begin Custom Build\r\n\r\n';
+
+ if (type.match("Parsers")) {
+ pre = (arr[i].match(/ini/) ? "ini_ " : "zend ");
+ ret += fl + ".c " + fl + ".h: " + fl + ".y\r\n";
+ ret += "\tbison --output=" + fl + ".c -v -d -p " + pre + fl + ".y\r\n\r\n";
+ } else {
+ ret += fl + ".c: " + fl + ".l\r\n";
+ ret += "\tre2c --case-inverted -cbdFt " + fl + "_defs.h -o" + fl + ".c " + fl + ".l\r\n\r\n";
+ }
+
+ ret += "# End Custom Build\r\n";
+ ret += "# End Source File\r\n";
+ }
+
+ ret += "# End Group\r\n\r\n";
+ return ret;
+}
+
+/* generate .defs file for php5[ts].dll */
+function generate_php_defs()
+{
+ var defs = get_define("PHP_DLL_DEF_SOURCES").split(" ");
+ var bdir = get_define("BUILD_DIR") + "\\";
+ var file = get_define("PHPLIB").replace("lib", "def");
+ var path = "..\\" + bdir + file;
+ var deps = "USERDEP__PHP5TS=";
+ var cmds = "BuildCmds= \\\r\n";
+ var cmd = '$(SOURCE) "$(INTDIR)" "$(OUTDIR)"\r\n\t$(BuildCmds)\r\n';
+
+ for (i = 0; i < defs.length; i++) {
+ deps += '"..\\' + defs[i] + '" ';
+ cmds += "\ttype ..\\" + defs[i] + (i == 0 ? " > " : " >> ") + path + " \\\r\n";
+ }
+
+ ret = '# Begin Group "Defs Files"\r\n\r\n';
+ ret += "# Begin Source File\r\nSOURCE=" + path + "\r\n\r\n";
+ ret += deps.substr(0, deps.length-1) + "\r\n# Begin Custom Build - ";
+ ret += "Generating $(InputPath)\r\nInputPath=" + path + "\r\n\r\n";
+ ret += cmds + '\r\n\"' + path + '" : ' + cmd + "\r\n";
+ ret += "# End Custom Build\r\n# End Source File\r\n\r\n";
+ ret += "# End Group\r\n";
+ return ret;
+}
+
+/* generate win32\wsyslog.h for php5[ts].dll */
+function generate_wsyslog()
+{
+ var path = ".\\build\\wsyslog.mc\r\n\r\n";
+ var intdir = "..\\" + get_define("BUILD_DIR");
+
+ ret = "# Begin Source File\r\nSOURCE=" + path;
+ ret += "# Begin Custom Build\r\nInputDir=.\\build\r\n";
+ ret += "IntDir=" + intdir + "\r\nInputPath=" + path;
+ ret += '"wsyslog.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"\r\n';
+ ret += "\tmc -h $(InputDir)/.. -r $(InputDir) -x $(IntDir) $(InputPath)\r\n\r\n";
+ ret += "# End Custom Build\r\n# End Source File\r\n";
+ return ret;
+}
+
+/* generate ext\date\lib\timelib_config.h for php5[ts].dll */
+function generate_timelib_conf(headers)
+{
+ var file = "timelib_config.h";
+ var path = "..\\ext\\date\\lib\\timelib_config.h";
+ var pos = headers.search(file);
+ var entry = headers.slice(pos, pos + 64);
+
+ replace = entry.replace(file, file + ".win32");
+ replace += "\r\n\r\n# Begin Custom Build\r\nInputDir=..\\ext\\date\\lib\r\n";
+ replace += "InputPath=" + path + ".win32\r\n\r\n";
+ replace += '"' + path + '" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"\r\n';
+ replace += "\tcopy $(InputPath) $(InputDir)\\" + file + "\r\n\r\n";
+ replace += "# End Custom Build";
+
+ headers = headers.replace(entry, replace);
+ return headers;
+}
+
+/* generate php5[ts].dsp */
+function generate_core_dsp(core_headers, core_sources, headers, sources, cflags, ldflags, libs)
+{
+ var ts = (PHP_ZTS != "no" ? "ts" : "");
+ var extname = "php5" + ts;
+ var tmpl = generate_dsp_file(extname, ".", false, false);
+
+ cflags += get_define("CFLAGS_PHP").replace("/D _USRDLL", "");
+ cflags = cflags.replace(/\/(I|D)(\S)/g, "/$1 $2");
+ ldflags += get_define("LDFLAGS_PHP");
+ libs += get_define("LIBS_PHP");
+
+ tmpl = tmpl.replace(/LOCALCPP/, cflags.replace(/\"ext/g, '"../ext') + " /c");
+ tmpl = tmpl.replace(/LOCALLIBS/, libs);
+ tmpl = tmpl.replace(/LOCALLDFLAGS/, ldflags);
+ tmpl = tmpl.replace(extname + ".dll", get_define("PHPDLL"));
+
+ wsyslog = (core_headers.match("wsyslog.h") ? "" : generate_wsyslog(core_headers));
+ core_sources = '# Begin Group "CORE"\r\n' + core_sources + "# End Group\r\n";
+ tmpl = tmpl.replace(/CORESOURCES/, core_sources);
+ core_headers = '# Begin Group "CORE "\r\n' + core_headers + "# End Group\r\n";
+ tmpl = tmpl.replace(/COREHEADERS/, core_headers + wsyslog);
+
+ headers = generate_timelib_conf(headers);
+ tmpl = tmpl.replace(/SOURCEFILES/, sources);
+ tmpl = tmpl.replace(/HEADERFILES/, headers);
+
+ defs = generate_php_defs();
+ tmpl = tmpl.replace(/DEFS/, defs);
+
+ dsp = FSO.CreateTextFile("win32\\php5" + ts + ".dsp", true);
+ STDOUT.WriteLine("\tGenerating win32\\php5" + ts + ".dsp");
+ dsp.Write(tmpl);
+ dsp.Close();
+
+ return;
+}
+
+/* generate .dsw files */
+function generate_dsw_files(sblocks, mblocks)
+{
+ var stmpl = file_get_contents("win32\\build\\template.dsw");
+ var mtmpl = file_get_contents("win32\\build\\template.dsw");
+ var ts = (PHP_ZTS != "no" ? "ts" : "");
+
+ /* push all the sapi blocks to the same tag */
+ stmpl = stmpl.replace("INSERT", sblocks);
+ stmpl = (PHP_ZTS != "no" ? stmpl : stmpl.replace(/dllts/g, "dll"));
+ sdsw = FSO.CreateTextFile("win32\\php5" + ts + ".dsw", true);
+ STDOUT.WriteLine("\tGenerating win32\\php5" + ts + ".dsw");
+ sdsw.Write(stmpl);
+ sdsw.Close();
+
+ /* same for shared modules - except that nothing else goes in here */
+ garbage = mtmpl.slice(200, mtmpl.search("INSERT"));
+ mtmpl = mtmpl.replace(garbage, "\r\n");
+ mtmpl = mtmpl.replace("INSERT", mblocks);
+ mtmpl = (PHP_ZTS != "no" ? mtmpl : mtmpl.replace(/dllts/g, "dll"));
+ mdsw = FSO.CreateTextFile("win32\\php_modules.dsw", true);
+ STDOUT.WriteLine("\tGenerating win32\\php_modules.dsw");
+ mdsw.Write(mtmpl);
+ mdsw.Close();
+
+ return;
+}
+
+/* finalize .dsp files and copy to final destination */
+function copy_dsp_files()
+{
+ var tmp = FSO.GetFolder("tmp");
+ var CORE_HEADERS = "";
+ var CORE_SOURCES = "";
+ var EXT_HEADERS = "";
+ var EXT_SOURCES = "";
+ var EXT_CFLAGS = "";
+ var EXT_LDFLAGS = "";
+ var EXT_LIBS = "";
+ var sblocks = ""; /* for sapis */
+ var mblocks = ""; /* for modules */
+
+ f = new Enumerator(tmp.Files);
+
+ for (; !f.atEnd(); f.moveNext()) {
+ /* retrieve the path */
+ contents = file_get_contents(f.item());
+ address = contents.slice(0, contents.indexOf("#"));
+ contents = contents.slice(contents.indexOf("#")+1);
+ shared = contents.slice(0, contents.indexOf("#"));
+ contents = contents.slice(contents.indexOf("#"));
+
+ /* pick up module name and path */
+ path = address.slice(0, address.lastIndexOf("\\")+1);
+ ext = address.slice(address.lastIndexOf("\\")+1, address.length-4);
+ EXT = ext.toUpperCase();
+
+ if (path.match(/(sapi|ext)/)) {
+ rel = "..\\..\\";
+ } else {
+ rel = "..\\";
+ }
+
+ /* pick up local flags and libs */
+ cflags = get_define("CFLAGS_" + EXT);
+ cflags += (ext.match(/(TSRM|Zend)/) ? "/D TSRM_EXPORTS " : "");
+ cflags += (ext.match(/Zend/) ? "/D LIBZEND_EXPORTS " : "");
+ libs = get_define("LIBS_" + EXT);
+ ldflags = get_define("LDFLAGS_" + EXT);
+ ldflags = ldflags.replace(/(\.\.\\)/g, rel + "$1");
+ contents = contents.replace(/LOCALCPP/, cflags + " /c");
+ contents = contents.replace(/LOCALLIBS/, libs);
+ contents = contents.replace(/LOCALLDFLAGS/, ldflags);
+
+ if (ext.match("Zend")) {
+ arr = new Array("ini", "language");
+ parsers = generate_parsers_or_scanners(arr, "Parsers");
+ scanners = generate_parsers_or_scanners(arr, "Scanners");
+ contents = contents.replace(/DEFS/, parsers + scanners);
+ }
+
+ /* none of these are core... */
+ contents = contents.replace(/\r\n(CORESOURCES|COREHEADERS|EXTSOURCES|EXTHEADERS|DEFS)\r\n/g, "");
+
+ if (address.match("sapi")) {
+ /* most sapis are .dlls, just not cgi, cli, embed */
+
+ if (ext == "cli") {
+
+ /* change of address: php.dsp */
+ newext = "cli";
+ address = "win32\\php.dsp";
+ srcpath = "..\\" + path;
+ contents = contents.replace(/cli\.exe/g, "php.exe");
+
+ } else if (ext == "cgi") {
+
+ /* change of address: php-cgi.dsp */
+ newext = "cgi";
+ address = "win32\\php-cgi.dsp";
+ srcpath = "..\\" + path;
+ contents = contents.replace(/cgi\.exe/g, "php-cgi.exe");
+
+ } else {
+
+ /* there's always one... most sapis just get a 'php5' prefix */
+ newext = (ext.match(/apache2handler/) ? "php5apache2" : "php5" + ext);
+ address = address.replace(ext + ".dsp", newext + ".dsp");
+ srcpath = ".\\";
+ oldext = new RegExp(('[^=\\\\]'+ext), "g");
+ contents = contents.replace(oldext, newext);
+ contents = contents.replace(ext + ".dll", newext + ".dll");
+ contents = contents.replace("CFG=" + ext, "CFG=" + newext);
+ }
+
+ contents = read_src_files(ext, contents, (srcpath ? srcpath : false));
+ dsp = FSO.CreateTextFile(address, true);
+ STDOUT.WriteLine("\tGenerating " + address);
+ dsp.Write(contents);
+ dsp.Close();
+
+ /* add all configured sapis to the list in php5ts.dsw */
+ sblocks += file_get_contents("win32\\build\\block.template.dsw");
+ sblocks = sblocks.replace("ADDRESS", address);
+ sblocks = sblocks.replace("EXTNAME", newext);
+
+ } else if (address.match("ext") && shared == "true") {
+
+ /* independent modules with their own .dsp */
+ contents = read_src_files(ext, contents, false);
+ dsp = FSO.CreateTextFile(address, true);
+ STDOUT.WriteLine("\tGenerating " + address);
+ dsp.Write(contents);
+ dsp.Close();
+
+ mblocks += file_get_contents("win32\\build\\block.template.dsw");
+ mblocks = mblocks.replace("ADDRESS", address);
+ mblocks = mblocks.replace("EXTNAME", ext);
+
+ } else if (ext.match(/(TSRM|Zend)/)) {
+
+ contents = read_src_files(ext, contents, false);
+ dsp = FSO.CreateTextFile(address, true);
+ STDOUT.WriteLine("\tGenerating " + address);
+ dsp.Write(contents);
+ dsp.Close();
+
+ } else {
+
+ /* bound for php5[ts].dsp */
+ cflags = get_define("CFLAGS_" + EXT);
+ cflags = cflags ? cflags.replace(/-(I|D)/g, " /$1") : "";
+ cflags = cflags? cflags.replace(/\/(I|D)\s+/g, "/$1") : "";
+ cflags = cflags ? cflags.replace(/\/I(?!\")(\S+)/g, '/I"$1"') : "";
+
+ EXT_CFLAGS = check_duplicates(cflags, EXT_CFLAGS);
+ EXT_LDFLAGS = check_duplicates(ldflags, EXT_LDFLAGS);
+ EXT_LIBS = check_duplicates(libs, EXT_LIBS);
+
+ beginh = '# Begin Group "' + ext + ' "\r\n';
+ begins = '# Begin Group "' + ext + '"\r\n';
+
+ hdr = file_get_contents("tmp\\src\\" + ext + ".headers.tmp");
+ hdr = hdr.replace(/\.\//g, "..\\" + path);
+ hdr = hdr.replace(/\.\.\\\.\.\\/g, "..\\");
+
+ src = file_get_contents("tmp\\src\\" + ext + ".sources.tmp");
+ src = src.replace(/\.\//g, "..\\" + path);
+ src = src.replace(/\.\.\\\.\.\\/g, "..\\");
+
+ if (ext.match(/(main|standard|streams|win32)/)) {
+ CORE_HEADERS += beginh + hdr + "# End Group\r\n";
+ CORE_SOURCES += begins + src + "# End Group\r\n";
+ } else {
+ EXT_HEADERS += beginh + hdr + "# End Group\r\n";
+ EXT_SOURCES += begins + src + "# End Group\r\n";
+ }
+
+ FSO.DeleteFile("tmp\\src\\" + ext + ".headers.tmp");
+ FSO.DeleteFile("tmp\\src\\" + ext + ".sources.tmp");
+ }
+
+ FSO.DeleteFile(f.item());
+ }
+
+ generate_core_dsp(CORE_HEADERS, CORE_SOURCES, EXT_HEADERS, EXT_SOURCES, EXT_CFLAGS, EXT_LDFLAGS, EXT_LIBS);
+ generate_dsw_files(sblocks, mblocks);
+
+ /* goodnight vienna */
+ FSO.DeleteFolder("tmp\\src");
+ FSO.DeleteFolder("tmp");
+}
+
+/* generate source and header entries for .dsp files */
+function generate_dsp_filelist(ext, ext_dir, files, intpath)
+{
+ var EXT = ext.toUpperCase();
+ var tabs = new RegExp("[\t\r\n\'\"]", "gm");
+ var ws = new RegExp("\\s+", "g");
+ var dir = FSO.GetFolder(ext_dir);
+ var configfile = FSO.BuildPath(ext_dir, "config.w32");
+ var headers = "";
+ var path = "";
+
+ if (!files) {
+ /* module either lacks a config.w32 or is core
+ * either way, we know nothing about its sources
+ */
+ files = "";
+ f = new Enumerator(dir.Files);
+
+ for (; !f.atEnd(); f.moveNext()) {
+ name = FSO.GetFileName(f.item());
+
+ if (name.substr(name.length-2) == ".c") {
+ files += " ./" + name;
+ }
+ }
+ } else {
+ files = files.replace(tabs, "");
+ files = "./" + files.replace(/ /g, " ./");
+ }
+
+ DSP_SOURCES = files.split(" ");
+
+ /* pick up headers (all modules) */
+ f = new Enumerator(dir.Files);
+
+ for (; !f.atEnd(); f.moveNext()) {
+ name = FSO.GetFileName(f.item());
+
+ if (name.substr(name.length-2) == ".h") {
+ headers += " ./" + name;
+ }
+ }
+
+ DSP_HEADERS = headers.split(" ");
+
+ /* check for bundled library paths and sourcefiles */
+ if (FSO.FileExists(configfile)) {
+ config = file_get_contents(configfile);
+
+ if (config.match("ADD_SOURCES")) {
+ sources = new RegExp("ADD_SOURCES\\([^,]*\\s*,\\s*['\"]([^'\"]+)['\"].*\\)", "gm");
+ arr = config.match(sources);
+ line = arr[0].replace(tabs, "");
+ line = line.replace(/ADD_SOURCES\((.+)\)/, "$1");
+ newarr = line.split(',');
+ orig_path = newarr[0].replace(/\//g, "\\");
+ orig_path = orig_path.replace(/configure_module_dirname(\s?\+\s?)?/, ext_dir);
+ path = orig_path.replace(ext_dir + '\\', "");
+
+ if (path.length > 0 && path != ext_dir) {
+ subdir = FSO.GetFolder(orig_path);
+ lib = new Enumerator(subdir.Files);
+ libheaders = "";
+
+ for (; !lib.atEnd(); lib.moveNext()) {
+ name = FSO.GetFileName(lib.item());
+
+ if (name.substr(name.length-2) == ".h") {
+ libheaders += " ./" + path + "\\" + name;
+ }
+ }
+
+ DSP_HEADERS = DSP_HEADERS.concat(libheaders.split(" "));
+
+ } else {
+ path = "";
+ }
+
+ sources = newarr[1].replace(/\\/g, ""); /* continuation lines */
+ sources = sources.replace(ws, " ");
+ sources = sources.replace(/\s/g, (path ? " ./" + path + "\\" : " ./"));
+ sources = check_duplicates(DSP_SOURCES.join(" "), sources);
+ DSP_SOURCES = sources.split(" ");
+ }
+ }
+
+ /* store the array contents in temp files for now */
+ write_src_file(ext + ".headers.tmp", ext_dir, intpath, DSP_HEADERS);
+ write_src_file(ext + ".sources.tmp", ext_dir, intpath, DSP_SOURCES);
+
+ return;
+}
+
+/* entry point. Called from EXTENSION(), SAPI() and generate_files() (confutils.js) */
+function generate_dsp_file(ext, ext_dir, files, shared)
+{
+ var dsp = FSO.CreateTextFile("tmp\\" + ext + ".dsp", true);
+ var tmpl = file_get_contents("win32\\build\\template.dsp");
+ var ts = (PHP_ZTS != "no" ? "ts" : "");
+ var debug = (PHP_DEBUG != "no" ? " /debug" : "");
+ var ld = (debug ? "/LDd" : "/LD");
+ var status = (PHP_DEBUG == "no" ? 'Release' : 'Debug');
+ var statusts = status + (ts ? "_" + ts.toUpperCase() : "");
+ var baseflags = "";
+
+ /* store the final path and value of shared in the tmp file */
+ if (!ext.match("php5")) {
+ tmpl = ext_dir + "\\" + ext + ".dsp#" + shared + tmpl;
+ }
+
+ tmpl = tmpl.replace(/extname/g, ext);
+ tmpl = tmpl.replace(/Status_TS/g, statusts);
+
+ if (debug) {
+ tmpl = tmpl.replace(/Use_Debug_Libraries 0/g, "Use_Debug_Libraries 1");
+ tmpl = tmpl.replace(/NDEBUG/g, "_DEBUG");
+ }
+
+ if (ext == "cli" || ext == "cgi") {
+ tmpl = tmpl.replace(/Dynamic-Link Library/g, "Console Application");
+ tmpl = tmpl.replace(/0x0102/, "0x0103");
+ path = "..\\";
+ type = ".exe";
+ } else if (ext == "embed" || ext == "TSRM" || ext == "Zend") {
+ tmpl = tmpl.replace(/Dynamic-Link/g, "Static");
+ tmpl = tmpl.replace(/0x0102/, "0x0104");
+ tmpl = tmpl.replace(/LINK32/g, "LIB32");
+ tmpl = tmpl.replace("link.exe", "link.exe -lib");
+ tmpl = tmpl.replace(/BASELIBS/g, "/nologo");
+ tmpl = tmpl.replace(/\s(LOCALLIBS|BASELDFLAGS|LOCALLDFLAGS|OUTPATH)/g, "");
+ path = "..\\";
+ if (ext == "embed") {
+ path += "..\\";
+ }
+ type = ".lib";
+ } else if (ext.match("php5")) {
+ path = "..\\";
+ type = ".dll";
+ } else {
+ path = "..\\..\\";
+ type = ".dll";
+ }
+
+ outpath = path + get_define("BUILD_DIR");
+ tmpl = tmpl.replace(/OUTPUTDIR/g, outpath);
+
+ /* populate the baseline CFLAGS and libs */
+ cflags = get_define("CFLAGS").replace(/\s+/g, " ");
+ cflags = cflags.replace('/I "..\\bindlib_w32" ', "");
+ bcflags = (cflags.replace(/\/([A-Z])\s/g, "/$1")).split(" ");
+
+ for (i= 0; i < bcflags.length; i++) {
+ baseflags += (bcflags[i].match(/(PHP|ZEND|ZTS|BASE|FD|WINDOWS)/) ? "" : bcflags[i]);
+ }
+
+ baseflags = baseflags.replace(/\//g, " /");
+ baseflags = baseflags.substr(1).replace(/(\/D)/g, "$1 ") + " /c";
+ tmpl = tmpl.replace(/BASECPP/, (type == ".dll" ? baseflags : baseflags.replace(ld + " ", "")));
+
+ tmpl = tmpl.replace(/BASELIBS/, "/nologo " + get_define("LIBS").replace(/\sresolv.lib/, ""));
+
+ /* now populate the bases in the 'local' lines */
+ incs = get_define("BASE_INCLUDES").replace(/\/I (\S+)/g, '/I "' + path + '$1"');
+ incs = incs.replace('"' + path + '."', '".."');
+ lcflags = cflags.replace(/\$\(BASE_INCLUDES\)/, incs + (type == ".exe" ? '/I "..\\sapi" ' : "") + '/I "' + path + '..\\bindlib_w32"');
+ tmpl = tmpl.replace(/BASECPP/, (type == ".dll" ? lcflags : lcflags.replace(ld + " ", "")));
+ tmpl = tmpl.replace(/BASELIBS/, "/nologo " + get_define("LIBS") + " " + (ext.match("php5") ? "" : get_define("PHPLIB")));
+ ldflags = get_define("LDFLAGS").replace(/\s?(\/nologo|\/libpath:\S+)\s?/g, "");
+ tmpl = tmpl.replace(/BASELDFLAGS/, ldflags + (type == ".dll" ? " " + get_define("DLL_LDFLAGS") : "") + (debug ? ' /nodefaultlib:"msvcrt"' : ""));
+ out = '/out:"' + outpath + "\\" + ext + type + '"' + ' /libpath:"' + outpath + '"' + ' /libpath:"..\\' + path + 'bindlib_w32\\' + status + '"';
+ tmpl = tmpl.replace(/OUTPATH/, out);
+
+ txt = generate_text_filelist(ext, ext_dir);
+ res = generate_resource_filelist(ext, ext_dir);
+
+ tmpl = tmpl.replace(/TEXTFILES/, txt);
+ tmpl = tmpl.replace(/RESOURCEFILES/, res);
+
+ if (ext.match("php5")) {
+ return tmpl;
+ }
+
+ /* generate source and header blocks for .dsp */
+ generate_dsp_filelist(ext, ext_dir, files, path);
+
+ dsp.Write(tmpl);
+ dsp.Close();
+
+ return;
+}
diff --git a/win32/build/registersyslog.php b/win32/build/registersyslog.php
new file mode 100755
index 0000000..ce28cbf
--- /dev/null
+++ b/win32/build/registersyslog.php
@@ -0,0 +1,44 @@
+<?php
+
+/* This script sets up an event source for use by the php syslog() function. */
+
+if (!extension_loaded("win32std")) {
+ @dl("php_win32std.dll");
+}
+
+$PATH = "SYSTEM\\CurrentControlSet\\Services\\Eventlog\\Application\\PHP-" . phpversion();
+
+$dll = $argv[1];
+
+if (extension_loaded("win32std")) {
+ $key = @reg_create_key(HKEY_LOCAL_MACHINE, $PATH, KEY_ALL_ACCESS);
+
+ if (!$key)
+ $key = reg_open_key(HKEY_LOCAL_MACHINE, $PATH, KEY_ALL_ACCESS);
+
+ if ($key) {
+ reg_set_value($key, "TypesSupported", REG_DWORD, 7) or die("Types");
+ reg_set_value($key, "EventMessageFile", REG_SZ, $dll) or die("EventMessageFile");
+
+ syslog(LOG_NOTICE, "Registered PHP Event source");
+ } else {
+ echo "Could not register event source\n";
+ }
+}
+
+/* let's also generate/update the bundled .reg file */
+
+$dll = addslashes($dll);
+
+file_put_contents("win32/syslog.reg", <<<REG
+REGEDIT4
+
+[HKEY_LOCAL_MACHINE\\$PATH]
+"TypesSupported"=dword:00000007
+"EventMessageFile"="$dll"
+
+REG
+);
+
+
+?>
diff --git a/win32/build/svnclean.js b/win32/build/svnclean.js
new file mode 100644
index 0000000..c5f92a3
--- /dev/null
+++ b/win32/build/svnclean.js
@@ -0,0 +1,120 @@
+/*
+ +----------------------------------------------------------------------+
+ | PHP Version 5 |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1997-2009 The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Author: Wez Furlong <wez@thebrainroom.com> |
+ | Pierre A. Joye <pierre@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id$ */
+// Cleans up files that do not belong in the repository
+
+var FSO = WScript.CreateObject("Scripting.FileSystemObject");
+var WshShell = WScript.CreateObject("WScript.Shell");
+var STDOUT = WScript.StdOut;
+
+/* svn propget svn:ignore dirname */
+function find_ignore(dirname)
+{
+ dirname = "" + dirname;
+ dirname_len = dirname.length;
+
+ if (!FSO.FolderExists(dirname) || (dirname_len >= 4 &&
+ dirname.substring(dirname_len - 4) == ".svn")) {
+ return;
+ }
+
+ var f = FSO.GetFolder(dirname);
+ var fc = new Enumerator(f.SubFolders);
+
+ for (; !fc.atEnd(); fc.moveNext()) {
+ find_ignore(fc.item());
+ }
+
+ kill_from_ignore(dirname);
+}
+
+/* recursive remove using ignore props style wildcard matching;
+ * note that FSO.DeleteFolder and FSO.DeleteFile methods both
+ * accept wildcards, but that they are dangerous to use eg:
+ * "*.php" will match "*.phpt" */
+function rm_r(filename)
+{
+ if (FSO.FolderExists(filename)) {
+ var fc = new Enumerator(FSO.GetFolder(filename).SubFolders);
+
+ for (; !fc.atEnd(); fc.moveNext()) {
+ rm_r(fc.item());
+ }
+
+ fc = new Enumerator(FSO.GetFolder(filename).Files);
+
+ for (; !fc.atEnd(); fc.moveNext()) {
+ FSO.DeleteFile(fc.item(), true);
+ }
+
+ FSO.DeleteFolder(filename, true);
+ } else if (FSO.FileExists(filename)) {
+ FSO.DeleteFile(filename, true);
+ } else {
+ /* we need to handle wildcards here */
+ var foldername = FSO.GetParentFolderName(filename);
+
+ if (foldername == "")
+ foldername = ".";
+
+ var filename = FSO.GetFileName(filename);
+
+ var retext = filename.replace(/\./g, '\\.');
+ retext = '^' + retext.replace(/\*/g, '.*') + "$";
+ var re = new RegExp(retext);
+
+ var folder = FSO.GetFolder(foldername);
+ var fc = new Enumerator(folder.SubFolders);
+ for (; !fc.atEnd(); fc.moveNext()) {
+
+ var item = FSO.GetFileName(fc.item());
+
+ if (item.match(re)) {
+ rm_r(fc.item());
+ }
+ }
+ var fc = new Enumerator(folder.Files);
+ for (; !fc.atEnd(); fc.moveNext()) {
+ item = FSO.GetFileName(fc.item());
+
+ if (item.match(re)) {
+ FSO.DeleteFile(fc.item(), true);
+ }
+ }
+ }
+}
+
+function kill_from_ignore(dirname)
+{
+ var l;
+ var e = WshShell.Exec("svn propget svn:ignore " + dirname);
+ var re = /^(config\.nice.*)|(\*)$/i;
+
+ while (!e.StdOut.atEndOfStream) {
+ l = e.StdOut.ReadLine();
+ if (l.length == 0 || re.test(l)) {
+ continue;
+ }
+ rm_r(dirname + l);
+ }
+
+}
+
+find_ignore(".");
diff --git a/win32/build/template.dsp b/win32/build/template.dsp
new file mode 100644
index 0000000..ce1b070
--- /dev/null
+++ b/win32/build/template.dsp
@@ -0,0 +1,81 @@
+# Microsoft Developer Studio Project File - Name="extname" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=extname - Win32 Status_TS
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "extname.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "extname.mak" CFG="extname - Win32 Status_TS"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "extname - Win32 Status_TS" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+RE2C=re2c.exe
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "OUTPUTDIR"
+# PROP BASE Intermediate_Dir "OUTPUTDIR"
+# PROP BASE Ignore_Export_Lib 0
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "OUTPUTDIR"
+# PROP Intermediate_Dir "OUTPUTDIR"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP BASECPP
+# ADD CPP BASECPP LOCALCPP
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 BASELIBS
+# ADD LINK32 BASELIBS LOCALLIBS BASELDFLAGS LOCALLDFLAGS OUTPATH
+
+# Begin Target
+# Name "extname - Win32 Status_TS"
+
+# Begin Group "Source Files"
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+
+CORESOURCES
+SOURCEFILES
+# End Group
+
+# Begin Group "Header Files"
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+
+COREHEADERS
+HEADERFILES
+# End Group
+
+DEFS
+
+TEXTFILES
+
+# Begin Group "Resource Files"
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+
+RESOURCEFILES
+# End Group
+# End Target
+# End Project
diff --git a/win32/build/template.dsw b/win32/build/template.dsw
new file mode 100644
index 0000000..ac78166
--- /dev/null
+++ b/win32/build/template.dsw
@@ -0,0 +1,63 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "TSRM"=..\TSRM\TSRM.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "Zend"=..\Zend\Zend.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name TSRM
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "php5ts"=..\win32\php5ts.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name TSRM
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name Zend
+ End Project Dependency
+}}}
+
+###############################################################################
+INSERT
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/win32/build/template.rc b/win32/build/template.rc
new file mode 100644
index 0000000..13e92e9
--- /dev/null
+++ b/win32/build/template.rc
@@ -0,0 +1,87 @@
+/* This is a template RC file.
+ * $Id$
+ * Do not edit with MSVC */
+#ifdef APSTUDIO_INVOKED
+# error dont edit with MSVC
+#endif
+
+#include "winresrc.h"
+#include "main/php_version.h"
+
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+
+#ifndef THANKS_GUYS
+# define THANKS_GUYS ""
+#endif
+
+#ifdef WANT_LOGO
+0 ICON win32\build\php.ico
+#endif
+
+#ifndef INTERNAL_NAME /* e.g. 'PHAR extension', 'CGI SAPI' */
+# ifdef FILE_DESCRIPTION
+#define INTERNAL_NAME FILE_DESCRIPTION /* e.g. 'PHP Script Interpreter', 'GD imaging' */
+# else
+#define INTERNAL_NAME FILE_NAME /* e.g. 'php5ts.dll', 'php_bz2.dll' */
+# endif
+#endif
+
+#ifndef URL
+#define URL "http://www.php.net/"
+#endif
+
+#ifndef EXT_VERSION
+#define EXT_VERSION PHP_VERSION
+#endif
+
+#ifndef EXT_FILE_VERSION
+#define EXT_FILE_VERSION PHP_MAJOR_VERSION,PHP_MINOR_VERSION,PHP_RELEASE_VERSION
+#endif
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION EXT_FILE_VERSION
+ PRODUCTVERSION PHP_MAJOR_VERSION,PHP_MINOR_VERSION,PHP_RELEASE_VERSION
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS (VS_FF_DEBUG|VS_FF_SPECIALBUILD)
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS VOS__WINDOWS32
+ FILETYPE VFT_DLL
+ FILESUBTYPE VFT2_UNKNOWN
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "Comments", THANKS_GUYS
+ VALUE "CompanyName", "The PHP Group"
+#ifdef _DEBUG
+ VALUE "FileDescription", FILE_DESCRIPTION " (DEBUG)"
+#else
+ VALUE "FileDescription", FILE_DESCRIPTION
+#endif
+ VALUE "FileVersion", EXT_VERSION
+ VALUE "InternalName", INTERNAL_NAME
+ VALUE "LegalCopyright", "Copyright © 1997-2013 The PHP Group"
+ VALUE "LegalTrademarks", "PHP"
+ VALUE "OriginalFilename", FILE_NAME
+ VALUE "ProductName", "PHP"
+ VALUE "ProductVersion", PHP_VERSION
+#ifdef _DEBUG
+ VALUE "SpecialBuild", "Debug build"
+#endif
+ VALUE "URL", URL
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#ifdef MC_INCLUDE
+#include MC_INCLUDE
+#endif
diff --git a/win32/build/wsyslog.mc b/win32/build/wsyslog.mc
new file mode 100755
index 0000000..01d4d3a
--- /dev/null
+++ b/win32/build/wsyslog.mc
@@ -0,0 +1,28 @@
+MessageId=1
+Severity=Success
+SymbolicName=PHP_SYSLOG_SUCCESS_TYPE
+Language=English
+%1 %2
+.
+
+MessageId=2
+Severity=Informational
+SymbolicName=PHP_SYSLOG_INFO_TYPE
+Language=English
+%1 %2
+.
+
+MessageId=3
+Severity=Warning
+SymbolicName=PHP_SYSLOG_WARNING_TYPE
+Language=English
+%1 %2
+.
+
+MessageId=4
+Severity=Error
+SymbolicName=PHP_SYSLOG_ERROR_TYPE
+Language=English
+%1 %2
+.
+
diff --git a/win32/builddef.bat b/win32/builddef.bat
new file mode 100644
index 0000000..f204812
--- /dev/null
+++ b/win32/builddef.bat
@@ -0,0 +1,7 @@
+@echo off
+rem Generate phpts.def file, which exports symbols from our dll that
+rem are present in some of the libraries which are compiled statically
+rem into PHP
+rem $Id: builddef.bat,v 1.4 2003-12-08 12:56:47 rrichards Exp $
+type ..\ext\sqlite\php_sqlite.def
+type ..\ext\libxml\php_libxml2.def
diff --git a/win32/flock.c b/win32/flock.c
new file mode 100644
index 0000000..e659de6
--- /dev/null
+++ b/win32/flock.c
@@ -0,0 +1,84 @@
+/*
+ * Program: Unix compatibility routines
+ *
+ * Author: Mark Crispin
+ * Networks and Distributed Computing
+ * Computing & Communications
+ * University of Washington
+ * Administration Building, AG-44
+ * Seattle, WA 98195
+ * Internet: MRC@CAC.Washington.EDU
+ *
+ * Date: 14 September 1996
+ * Last Edited: 14 August 1997
+ *
+ * Copyright 1997 by the University of Washington
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted, provided
+ * that the above copyright notice appears in all copies and that both the
+ * above copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of the University of Washington not be
+ * used in advertising or publicity pertaining to distribution of the software
+ * without specific, written prior permission. This software is made available
+ * "as is", and
+ * THE UNIVERSITY OF WASHINGTON DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED,
+ * WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT LIMITATION ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, AND IN
+ * NO EVENT SHALL THE UNIVERSITY OF WASHINGTON BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, TORT
+ * (INCLUDING NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+
+/* DEDICATION
+
+ * This file is dedicated to my dog, Unix, also known as Yun-chan and
+ * Unix J. Terwilliker Jehosophat Aloysius Monstrosity Animal Beast. Unix
+ * passed away at the age of 11 1/2 on September 14, 1996, 12:18 PM PDT, after
+ * a two-month bout with cirrhosis of the liver.
+ *
+ * He was a dear friend, and I miss him terribly.
+ *
+ * Lift a leg, Yunie. Luv ya forever!!!!
+ */
+
+#include "php.h"
+#include <windows.h>
+#include <io.h>
+#include <errno.h>
+#include "flock.h"
+
+PHPAPI int flock(int fd, int op)
+{
+ HANDLE hdl = (HANDLE) _get_osfhandle(fd);
+ DWORD low = 1, high = 0;
+ OVERLAPPED offset =
+ {0, 0, 0, 0, NULL};
+ if (hdl < 0)
+ return -1; /* error in file descriptor */
+ /* bug for bug compatible with Unix */
+ UnlockFileEx(hdl, 0, low, high, &offset);
+ switch (op & ~LOCK_NB) { /* translate to LockFileEx() op */
+ case LOCK_EX: /* exclusive */
+ if (LockFileEx(hdl, LOCKFILE_EXCLUSIVE_LOCK +
+ ((op & LOCK_NB) ? LOCKFILE_FAIL_IMMEDIATELY : 0),
+ 0, low, high, &offset))
+ return 0;
+ break;
+ case LOCK_SH: /* shared */
+ if (LockFileEx(hdl, ((op & LOCK_NB) ? LOCKFILE_FAIL_IMMEDIATELY : 0),
+ 0, low, high, &offset))
+ return 0;
+ break;
+ case LOCK_UN: /* unlock */
+ return 0; /* always succeeds */
+ default: /* default */
+ break;
+ }
+ errno = EINVAL; /* bad call */
+ return -1;
+}
diff --git a/win32/flock.h b/win32/flock.h
new file mode 100644
index 0000000..d228e85
--- /dev/null
+++ b/win32/flock.h
@@ -0,0 +1,11 @@
+#define fsync _commit
+#define ftruncate chsize
+
+/* For flock() emulation */
+
+#define LOCK_SH 1
+#define LOCK_EX 2
+#define LOCK_NB 4
+#define LOCK_UN 8
+
+PHPAPI int flock(int fd, int op);
diff --git a/win32/fnmatch.c b/win32/fnmatch.c
new file mode 100644
index 0000000..590d23f
--- /dev/null
+++ b/win32/fnmatch.c
@@ -0,0 +1,198 @@
+/*
+ * Copyright (c) 1989, 1993, 1994
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Guido van Rossum.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * From FreeBSD fnmatch.c 1.11
+ * $Id$
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)fnmatch.c 8.2 (Berkeley) 4/16/94";
+#endif /* LIBC_SCCS and not lint */
+
+/*
+ * Function fnmatch() as specified in POSIX 1003.2-1992, section B.6.
+ * Compares a filename or pathname to a pattern.
+ */
+
+#include <ctype.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "fnmatch.h"
+
+#define EOS '\0'
+
+static const char *rangematch(const char *, char, int);
+
+PHPAPI int fnmatch(const char *pattern, const char *string, int flags)
+{
+ const char *stringstart;
+ char c, test;
+
+ for (stringstart = string;;)
+ switch (c = *pattern++) {
+ case EOS:
+ if ((flags & FNM_LEADING_DIR) && *string == '/')
+ return (0);
+ return (*string == EOS ? 0 : FNM_NOMATCH);
+ case '?':
+ if (*string == EOS)
+ return (FNM_NOMATCH);
+ if (*string == '/' && (flags & FNM_PATHNAME))
+ return (FNM_NOMATCH);
+ if (*string == '.' && (flags & FNM_PERIOD) &&
+ (string == stringstart ||
+ ((flags & FNM_PATHNAME) && *(string - 1) == '/')))
+ return (FNM_NOMATCH);
+ ++string;
+ break;
+ case '*':
+ c = *pattern;
+ /* Collapse multiple stars. */
+ while (c == '*')
+ c = *++pattern;
+
+ if (*string == '.' && (flags & FNM_PERIOD) &&
+ (string == stringstart ||
+ ((flags & FNM_PATHNAME) && *(string - 1) == '/')))
+ return (FNM_NOMATCH);
+
+ /* Optimize for pattern with * at end or before /. */
+ if (c == EOS)
+ if (flags & FNM_PATHNAME)
+ return ((flags & FNM_LEADING_DIR) ||
+ strchr(string, '/') == NULL ?
+ 0 : FNM_NOMATCH);
+ else
+ return (0);
+ else if (c == '/' && flags & FNM_PATHNAME) {
+ if ((string = strchr(string, '/')) == NULL)
+ return (FNM_NOMATCH);
+ break;
+ }
+
+ /* General case, use recursion. */
+ while ((test = *string) != EOS) {
+ if (!fnmatch(pattern, string, flags & ~FNM_PERIOD))
+ return (0);
+ if (test == '/' && flags & FNM_PATHNAME)
+ break;
+ ++string;
+ }
+ return (FNM_NOMATCH);
+ case '[':
+ if (*string == EOS)
+ return (FNM_NOMATCH);
+ if (*string == '/' && flags & FNM_PATHNAME)
+ return (FNM_NOMATCH);
+ if ((pattern =
+ rangematch(pattern, *string, flags)) == NULL)
+ return (FNM_NOMATCH);
+ ++string;
+ break;
+ case '\\':
+ if (!(flags & FNM_NOESCAPE)) {
+ if ((c = *pattern++) == EOS) {
+ c = '\\';
+ --pattern;
+ }
+ }
+ /* FALLTHROUGH */
+ default:
+ if (c == *string)
+ ;
+ else if ((flags & FNM_CASEFOLD) &&
+ (tolower((unsigned char)c) ==
+ tolower((unsigned char)*string)))
+ ;
+ else if ((flags & FNM_PREFIX_DIRS) && *string == EOS &&
+ (c == '/' && string != stringstart ||
+ string == stringstart+1 && *stringstart == '/') )
+ return (0);
+ else
+ return (FNM_NOMATCH);
+ string++;
+ break;
+ }
+ /* NOTREACHED */
+}
+
+static const char *
+rangematch(const char *pattern, char test, int flags)
+{
+ int negate, ok;
+ char c, c2;
+
+ /*
+ * A bracket expression starting with an unquoted circumflex
+ * character produces unspecified results (IEEE 1003.2-1992,
+ * 3.13.2). This implementation treats it like '!', for
+ * consistency with the regular expression syntax.
+ * J.T. Conklin (conklin@ngai.kaleida.com)
+ */
+ if ( (negate = (*pattern == '!' || *pattern == '^')) )
+ ++pattern;
+
+ if (flags & FNM_CASEFOLD)
+ test = tolower((unsigned char)test);
+
+ for (ok = 0; (c = *pattern++) != ']';) {
+ if (c == '\\' && !(flags & FNM_NOESCAPE))
+ c = *pattern++;
+ if (c == EOS)
+ return (NULL);
+
+ if (flags & FNM_CASEFOLD)
+ c = tolower((unsigned char)c);
+
+ if (*pattern == '-'
+ && (c2 = *(pattern+1)) != EOS && c2 != ']') {
+ pattern += 2;
+ if (c2 == '\\' && !(flags & FNM_NOESCAPE))
+ c2 = *pattern++;
+ if (c2 == EOS)
+ return (NULL);
+
+ if (flags & FNM_CASEFOLD)
+ c2 = tolower((unsigned char)c2);
+
+ if ((unsigned char)c <= (unsigned char)test &&
+ (unsigned char)test <= (unsigned char)c2)
+ ok = 1;
+ } else if (c == test)
+ ok = 1;
+ }
+ return (ok == negate ? NULL : pattern);
+}
diff --git a/win32/fnmatch.h b/win32/fnmatch.h
new file mode 100644
index 0000000..a8e7d66
--- /dev/null
+++ b/win32/fnmatch.h
@@ -0,0 +1,54 @@
+/*-
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)fnmatch.h 8.1 (Berkeley) 6/2/93
+ *
+ * From FreeBSD fnmatch.h 1.7
+ * $Id$
+ */
+
+#ifndef _FNMATCH_H_
+#define _FNMATCH_H_
+#include "php.h"
+
+#define FNM_NOMATCH 1 /* Match failed. */
+
+#define FNM_NOESCAPE 0x01 /* Disable backslash escaping. */
+#define FNM_PATHNAME 0x02 /* Slash must be matched by slash. */
+#define FNM_PERIOD 0x04 /* Period must be matched by period. */
+#define FNM_LEADING_DIR 0x08 /* Ignore /<tail> after Imatch. */
+#define FNM_CASEFOLD 0x10 /* Case insensitive search. */
+#define FNM_PREFIX_DIRS 0x20 /* Directory prefixes of pattern match too. */
+
+PHPAPI int fnmatch(const char *pattern, const char *string, int flags);
+
+#endif /* !_FNMATCH_H_ */
diff --git a/win32/glob.c b/win32/glob.c
new file mode 100644
index 0000000..a197f3b
--- /dev/null
+++ b/win32/glob.c
@@ -0,0 +1,924 @@
+/*
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Guido van Rossum.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/* $Id$ */
+
+/*
+ * glob(3) -- a superset of the one defined in POSIX 1003.2.
+ *
+ * The [!...] convention to negate a range is supported (SysV, Posix, ksh).
+ *
+ * Optional extra services, controlled by flags not defined by POSIX:
+ *
+ * GLOB_QUOTE:
+ * Escaping convention: \ inhibits any special meaning the following
+ * character might have (except \ at end of string is retained).
+ * GLOB_MAGCHAR:
+ * Set in gl_flags if pattern contained a globbing character.
+ * GLOB_NOMAGIC:
+ * Same as GLOB_NOCHECK, but it will only append pattern if it did
+ * not contain any magic characters. [Used in csh style globbing]
+ * GLOB_ALTDIRFUNC:
+ * Use alternately specified directory access functions.
+ * GLOB_TILDE:
+ * expand ~user/foo to the /home/dir/of/user/foo
+ * GLOB_BRACE:
+ * expand {1,2}{a,b} to 1a 1b 2a 2b
+ * gl_matchc:
+ * Number of matches in the current invocation of glob.
+ */
+#ifdef PHP_WIN32
+#define _POSIX_
+#include <limits.h>
+#undef _POSIX_
+#ifndef S_ISDIR
+#define S_ISDIR(m) (((m) & _S_IFDIR) == _S_IFDIR)
+#endif
+#ifndef S_ISLNK
+#define S_ISLNK(m) (0)
+#endif
+#endif
+
+#include "php.h"
+#include <sys/stat.h>
+
+#include <ctype.h>
+#ifndef PHP_WIN32
+#include <sys/param.h>
+#include <dirent.h>
+#include <pwd.h>
+#include <unistd.h>
+#endif
+#include <errno.h>
+#include "glob.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define DOLLAR '$'
+#define DOT '.'
+#define EOS '\0'
+#define LBRACKET '['
+#define NOT '!'
+#define QUESTION '?'
+#define QUOTE '\\'
+#define RANGE '-'
+#define RBRACKET ']'
+#define SEP DEFAULT_SLASH
+#define STAR '*'
+#define TILDE '~'
+#define UNDERSCORE '_'
+#define LBRACE '{'
+#define RBRACE '}'
+#define SLASH '/'
+#define COMMA ','
+
+#ifndef DEBUG
+
+#define M_QUOTE 0x8000
+#define M_PROTECT 0x4000
+#define M_MASK 0xffff
+#define M_ASCII 0x00ff
+
+typedef u_short Char;
+
+#else
+
+#define M_QUOTE 0x80
+#define M_PROTECT 0x40
+#define M_MASK 0xff
+#define M_ASCII 0x7f
+
+typedef char Char;
+
+#endif
+
+
+#define CHAR(c) ((Char)((c)&M_ASCII))
+#define META(c) ((Char)((c)|M_QUOTE))
+#define M_ALL META('*')
+#define M_END META(']')
+#define M_NOT META('!')
+#define M_ONE META('?')
+#define M_RNG META('-')
+#define M_SET META('[')
+#define ismeta(c) (((c)&M_QUOTE) != 0)
+
+static int compare(const void *, const void *);
+static int g_Ctoc(const Char *, char *, u_int);
+static int g_lstat(Char *, struct stat *, glob_t *);
+static DIR *g_opendir(Char *, glob_t *);
+static Char *g_strchr(Char *, int);
+static int g_stat(Char *, struct stat *, glob_t *);
+static int glob0(const Char *, glob_t *);
+static int glob1(Char *, Char *, glob_t *, size_t *);
+static int glob2(Char *, Char *, Char *, Char *, Char *, Char *,
+ glob_t *, size_t *);
+static int glob3(Char *, Char *, Char *, Char *, Char *, Char *,
+ Char *, Char *, glob_t *, size_t *);
+static int globextend(const Char *, glob_t *, size_t *);
+static const Char *globtilde(const Char *, Char *, size_t, glob_t *);
+static int globexp1(const Char *, glob_t *);
+static int globexp2(const Char *, const Char *, glob_t *, int *);
+static int match(Char *, Char *, Char *);
+#ifdef DEBUG
+static void qprintf(const char *, Char *);
+#endif
+
+PHPAPI int
+glob(pattern, flags, errfunc, pglob)
+ const char *pattern;
+ int flags, (*errfunc)(const char *, int);
+ glob_t *pglob;
+{
+ const u_char *patnext;
+ int c;
+ Char *bufnext, *bufend, patbuf[MAXPATHLEN];
+
+#ifdef PHP_WIN32
+ /* Force skipping escape sequences on windows
+ * due to the ambiguity with path backslashes
+ */
+ flags |= GLOB_NOESCAPE;
+#endif
+
+ patnext = (u_char *) pattern;
+ if (!(flags & GLOB_APPEND)) {
+ pglob->gl_pathc = 0;
+ pglob->gl_pathv = NULL;
+ if (!(flags & GLOB_DOOFFS))
+ pglob->gl_offs = 0;
+ }
+ pglob->gl_flags = flags & ~GLOB_MAGCHAR;
+ pglob->gl_errfunc = errfunc;
+ pglob->gl_matchc = 0;
+
+ bufnext = patbuf;
+ bufend = bufnext + MAXPATHLEN - 1;
+ if (flags & GLOB_NOESCAPE)
+ while (bufnext < bufend && (c = *patnext++) != EOS)
+ *bufnext++ = c;
+ else {
+ /* Protect the quoted characters. */
+ while (bufnext < bufend && (c = *patnext++) != EOS)
+ if (c == QUOTE) {
+ if ((c = *patnext++) == EOS) {
+ c = QUOTE;
+ --patnext;
+ }
+ *bufnext++ = c | M_PROTECT;
+ } else
+ *bufnext++ = c;
+ }
+ *bufnext = EOS;
+
+ if (flags & GLOB_BRACE)
+ return globexp1(patbuf, pglob);
+ else
+ return glob0(patbuf, pglob);
+}
+
+/*
+ * Expand recursively a glob {} pattern. When there is no more expansion
+ * invoke the standard globbing routine to glob the rest of the magic
+ * characters
+ */
+static int
+globexp1(pattern, pglob)
+ const Char *pattern;
+ glob_t *pglob;
+{
+ const Char* ptr = pattern;
+ int rv;
+
+ /* Protect a single {}, for find(1), like csh */
+ if (pattern[0] == LBRACE && pattern[1] == RBRACE && pattern[2] == EOS)
+ return glob0(pattern, pglob);
+
+ while ((ptr = (const Char *) g_strchr((Char *) ptr, LBRACE)) != NULL)
+ if (!globexp2(ptr, pattern, pglob, &rv))
+ return rv;
+
+ return glob0(pattern, pglob);
+}
+
+
+/*
+ * Recursive brace globbing helper. Tries to expand a single brace.
+ * If it succeeds then it invokes globexp1 with the new pattern.
+ * If it fails then it tries to glob the rest of the pattern and returns.
+ */
+static int
+globexp2(ptr, pattern, pglob, rv)
+ const Char *ptr, *pattern;
+ glob_t *pglob;
+ int *rv;
+{
+ int i;
+ Char *lm, *ls;
+ const Char *pe, *pm, *pl;
+ Char patbuf[MAXPATHLEN];
+
+ /* copy part up to the brace */
+ for (lm = patbuf, pm = pattern; pm != ptr; *lm++ = *pm++)
+ ;
+ *lm = EOS;
+ ls = lm;
+
+ /* Find the balanced brace */
+ for (i = 0, pe = ++ptr; *pe; pe++)
+ if (*pe == LBRACKET) {
+ /* Ignore everything between [] */
+ for (pm = pe++; *pe != RBRACKET && *pe != EOS; pe++)
+ ;
+ if (*pe == EOS) {
+ /*
+ * We could not find a matching RBRACKET.
+ * Ignore and just look for RBRACE
+ */
+ pe = pm;
+ }
+ } else if (*pe == LBRACE)
+ i++;
+ else if (*pe == RBRACE) {
+ if (i == 0)
+ break;
+ i--;
+ }
+
+ /* Non matching braces; just glob the pattern */
+ if (i != 0 || *pe == EOS) {
+ *rv = glob0(patbuf, pglob);
+ return 0;
+ }
+
+ for (i = 0, pl = pm = ptr; pm <= pe; pm++) {
+ switch (*pm) {
+ case LBRACKET:
+ /* Ignore everything between [] */
+ for (pl = pm++; *pm != RBRACKET && *pm != EOS; pm++)
+ ;
+ if (*pm == EOS) {
+ /*
+ * We could not find a matching RBRACKET.
+ * Ignore and just look for RBRACE
+ */
+ pm = pl;
+ }
+ break;
+
+ case LBRACE:
+ i++;
+ break;
+
+ case RBRACE:
+ if (i) {
+ i--;
+ break;
+ }
+ /* FALLTHROUGH */
+ case COMMA:
+ if (i && *pm == COMMA)
+ break;
+ else {
+ /* Append the current string */
+ for (lm = ls; (pl < pm); *lm++ = *pl++)
+ ;
+
+ /*
+ * Append the rest of the pattern after the
+ * closing brace
+ */
+ for (pl = pe + 1; (*lm++ = *pl++) != EOS; )
+ ;
+
+ /* Expand the current pattern */
+#ifdef DEBUG
+ qprintf("globexp2:", patbuf);
+#endif
+ *rv = globexp1(patbuf, pglob);
+
+ /* move after the comma, to the next string */
+ pl = pm + 1;
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+ *rv = 0;
+ return 0;
+}
+
+
+
+/*
+ * expand tilde from the passwd file.
+ */
+static const Char *
+globtilde(pattern, patbuf, patbuf_len, pglob)
+ const Char *pattern;
+ Char *patbuf;
+ size_t patbuf_len;
+ glob_t *pglob;
+{
+#ifndef PHP_WIN32
+ struct passwd *pwd;
+#endif
+ char *h;
+ const Char *p;
+ Char *b, *eb;
+
+ if (*pattern != TILDE || !(pglob->gl_flags & GLOB_TILDE))
+ return pattern;
+
+ /* Copy up to the end of the string or / */
+ eb = &patbuf[patbuf_len - 1];
+ for (p = pattern + 1, h = (char *) patbuf;
+ h < (char *)eb && *p && *p != SLASH; *h++ = (char) *p++)
+ ;
+
+ *h = EOS;
+
+#if 0
+ if (h == (char *)eb)
+ return what;
+#endif
+
+ if (((char *) patbuf)[0] == EOS) {
+ /*
+ * handle a plain ~ or ~/ by expanding $HOME
+ * first and then trying the password file
+ */
+ if ((h = getenv("HOME")) == NULL) {
+#ifndef PHP_WIN32
+ if ((pwd = getpwuid(getuid())) == NULL)
+ return pattern;
+ else
+ h = pwd->pw_dir;
+#else
+ return pattern;
+#endif
+ }
+ } else {
+ /*
+ * Expand a ~user
+ */
+#ifndef PHP_WIN32
+ if ((pwd = getpwnam((char*) patbuf)) == NULL)
+ return pattern;
+ else
+ h = pwd->pw_dir;
+#else
+ return pattern;
+#endif
+ }
+
+ /* Copy the home directory */
+ for (b = patbuf; b < eb && *h; *b++ = *h++)
+ ;
+
+ /* Append the rest of the pattern */
+ while (b < eb && (*b++ = *p++) != EOS)
+ ;
+ *b = EOS;
+
+ return patbuf;
+}
+
+
+/*
+ * The main glob() routine: compiles the pattern (optionally processing
+ * quotes), calls glob1() to do the real pattern matching, and finally
+ * sorts the list (unless unsorted operation is requested). Returns 0
+ * if things went well, nonzero if errors occurred. It is not an error
+ * to find no matches.
+ */
+static int
+glob0(pattern, pglob)
+ const Char *pattern;
+ glob_t *pglob;
+{
+ const Char *qpatnext;
+ int c, err, oldpathc;
+ Char *bufnext, patbuf[MAXPATHLEN];
+ size_t limit = 0;
+
+ qpatnext = globtilde(pattern, patbuf, MAXPATHLEN, pglob);
+ oldpathc = pglob->gl_pathc;
+ bufnext = patbuf;
+
+ /* We don't need to check for buffer overflow any more. */
+ while ((c = *qpatnext++) != EOS) {
+ switch (c) {
+ case LBRACKET:
+ c = *qpatnext;
+ if (c == NOT)
+ ++qpatnext;
+ if (*qpatnext == EOS ||
+ g_strchr((Char *) qpatnext+1, RBRACKET) == NULL) {
+ *bufnext++ = LBRACKET;
+ if (c == NOT)
+ --qpatnext;
+ break;
+ }
+ *bufnext++ = M_SET;
+ if (c == NOT)
+ *bufnext++ = M_NOT;
+ c = *qpatnext++;
+ do {
+ *bufnext++ = CHAR(c);
+ if (*qpatnext == RANGE &&
+ (c = qpatnext[1]) != RBRACKET) {
+ *bufnext++ = M_RNG;
+ *bufnext++ = CHAR(c);
+ qpatnext += 2;
+ }
+ } while ((c = *qpatnext++) != RBRACKET);
+ pglob->gl_flags |= GLOB_MAGCHAR;
+ *bufnext++ = M_END;
+ break;
+ case QUESTION:
+ pglob->gl_flags |= GLOB_MAGCHAR;
+ *bufnext++ = M_ONE;
+ break;
+ case STAR:
+ pglob->gl_flags |= GLOB_MAGCHAR;
+ /* collapse adjacent stars to one,
+ * to avoid exponential behavior
+ */
+ if (bufnext == patbuf || bufnext[-1] != M_ALL)
+ *bufnext++ = M_ALL;
+ break;
+ default:
+ *bufnext++ = CHAR(c);
+ break;
+ }
+ }
+ *bufnext = EOS;
+#ifdef DEBUG
+ qprintf("glob0:", patbuf);
+#endif
+
+ if ((err = glob1(patbuf, patbuf+MAXPATHLEN-1, pglob, &limit)) != 0)
+ return(err);
+
+ /*
+ * If there was no match we are going to append the pattern
+ * if GLOB_NOCHECK was specified or if GLOB_NOMAGIC was specified
+ * and the pattern did not contain any magic characters
+ * GLOB_NOMAGIC is there just for compatibility with csh.
+ */
+ if (pglob->gl_pathc == oldpathc) {
+ if ((pglob->gl_flags & GLOB_NOCHECK) ||
+ ((pglob->gl_flags & GLOB_NOMAGIC) &&
+ !(pglob->gl_flags & GLOB_MAGCHAR)))
+ return(globextend(pattern, pglob, &limit));
+ else
+ return(GLOB_NOMATCH);
+ }
+ if (!(pglob->gl_flags & GLOB_NOSORT))
+ qsort(pglob->gl_pathv + pglob->gl_offs + oldpathc,
+ pglob->gl_pathc - oldpathc, sizeof(char *), compare);
+ return(0);
+}
+
+static int
+compare(const void *p, const void *q)
+{
+ return(strcmp(*(char **)p, *(char **)q));
+}
+
+static int
+glob1(pattern, pattern_last, pglob, limitp)
+ Char *pattern, *pattern_last;
+ glob_t *pglob;
+ size_t *limitp;
+{
+ Char pathbuf[MAXPATHLEN];
+
+ /* A null pathname is invalid -- POSIX 1003.1 sect. 2.4. */
+ if (*pattern == EOS)
+ return(0);
+ return(glob2(pathbuf, pathbuf+MAXPATHLEN-1,
+ pathbuf, pathbuf+MAXPATHLEN-1,
+ pattern, pattern_last, pglob, limitp));
+}
+
+/*
+ * The functions glob2 and glob3 are mutually recursive; there is one level
+ * of recursion for each segment in the pattern that contains one or more
+ * meta characters.
+ */
+static int
+glob2(pathbuf, pathbuf_last, pathend, pathend_last, pattern,
+ pattern_last, pglob, limitp)
+ Char *pathbuf, *pathbuf_last, *pathend, *pathend_last;
+ Char *pattern, *pattern_last;
+ glob_t *pglob;
+ size_t *limitp;
+{
+ struct stat sb;
+ Char *p, *q;
+ int anymeta;
+
+ /*
+ * Loop over pattern segments until end of pattern or until
+ * segment with meta character found.
+ */
+ for (anymeta = 0;;) {
+ if (*pattern == EOS) { /* End of pattern? */
+ *pathend = EOS;
+ if (g_lstat(pathbuf, &sb, pglob))
+ return(0);
+
+ if (((pglob->gl_flags & GLOB_MARK) &&
+ !IS_SLASH(pathend[-1])) && (S_ISDIR(sb.st_mode) ||
+ (S_ISLNK(sb.st_mode) &&
+ (g_stat(pathbuf, &sb, pglob) == 0) &&
+ S_ISDIR(sb.st_mode)))) {
+ if (pathend+1 > pathend_last)
+ return (1);
+ *pathend++ = SEP;
+ *pathend = EOS;
+ }
+ ++pglob->gl_matchc;
+ return(globextend(pathbuf, pglob, limitp));
+ }
+
+ /* Find end of next segment, copy tentatively to pathend. */
+ q = pathend;
+ p = pattern;
+ while (*p != EOS && !IS_SLASH(*p)) {
+ if (ismeta(*p))
+ anymeta = 1;
+ if (q+1 > pathend_last)
+ return (1);
+ *q++ = *p++;
+ }
+
+ if (!anymeta) { /* No expansion, do next segment. */
+ pathend = q;
+ pattern = p;
+ while (IS_SLASH(*pattern)) {
+ if (pathend+1 > pathend_last)
+ return (1);
+ *pathend++ = *pattern++;
+ }
+ } else
+ /* Need expansion, recurse. */
+ return(glob3(pathbuf, pathbuf_last, pathend,
+ pathend_last, pattern, pattern_last,
+ p, pattern_last, pglob, limitp));
+ }
+ /* NOTREACHED */
+}
+
+static int
+glob3(pathbuf, pathbuf_last, pathend, pathend_last, pattern, pattern_last,
+ restpattern, restpattern_last, pglob, limitp)
+ Char *pathbuf, *pathbuf_last, *pathend, *pathend_last;
+ Char *pattern, *pattern_last, *restpattern, *restpattern_last;
+ glob_t *pglob;
+ size_t *limitp;
+{
+ register struct dirent *dp;
+ DIR *dirp;
+ int err;
+ char buf[MAXPATHLEN];
+
+ /*
+ * The readdirfunc declaration can't be prototyped, because it is
+ * assigned, below, to two functions which are prototyped in glob.h
+ * and dirent.h as taking pointers to differently typed opaque
+ * structures.
+ */
+ struct dirent *(*readdirfunc)();
+
+ if (pathend > pathend_last)
+ return (1);
+ *pathend = EOS;
+ errno = 0;
+
+ if ((dirp = g_opendir(pathbuf, pglob)) == NULL) {
+ /* TODO: don't call for ENOENT or ENOTDIR? */
+ if (pglob->gl_errfunc) {
+ if (g_Ctoc(pathbuf, buf, sizeof(buf)))
+ return(GLOB_ABORTED);
+ if (pglob->gl_errfunc(buf, errno) ||
+ pglob->gl_flags & GLOB_ERR)
+ return(GLOB_ABORTED);
+ }
+ return(0);
+ }
+
+ err = 0;
+
+ /* Search directory for matching names. */
+ if (pglob->gl_flags & GLOB_ALTDIRFUNC)
+ readdirfunc = pglob->gl_readdir;
+ else
+ readdirfunc = readdir;
+ while ((dp = (*readdirfunc)(dirp))) {
+ register u_char *sc;
+ register Char *dc;
+
+ /* Initial DOT must be matched literally. */
+ if (dp->d_name[0] == DOT && *pattern != DOT)
+ continue;
+ dc = pathend;
+ sc = (u_char *) dp->d_name;
+ while (dc < pathend_last && (*dc++ = *sc++) != EOS)
+ ;
+ if (dc >= pathend_last) {
+ *dc = EOS;
+ err = 1;
+ break;
+ }
+
+ if (!match(pathend, pattern, restpattern)) {
+ *pathend = EOS;
+ continue;
+ }
+ err = glob2(pathbuf, pathbuf_last, --dc, pathend_last,
+ restpattern, restpattern_last, pglob, limitp);
+ if (err)
+ break;
+ }
+
+ if (pglob->gl_flags & GLOB_ALTDIRFUNC)
+ (*pglob->gl_closedir)(dirp);
+ else
+ closedir(dirp);
+ return(err);
+}
+
+
+/*
+ * Extend the gl_pathv member of a glob_t structure to accomodate a new item,
+ * add the new item, and update gl_pathc.
+ *
+ * This assumes the BSD realloc, which only copies the block when its size
+ * crosses a power-of-two boundary; for v7 realloc, this would cause quadratic
+ * behavior.
+ *
+ * Return 0 if new item added, error code if memory couldn't be allocated.
+ *
+ * Invariant of the glob_t structure:
+ * Either gl_pathc is zero and gl_pathv is NULL; or gl_pathc > 0 and
+ * gl_pathv points to (gl_offs + gl_pathc + 1) items.
+ */
+static int
+globextend(path, pglob, limitp)
+ const Char *path;
+ glob_t *pglob;
+ size_t *limitp;
+{
+ register char **pathv;
+ register int i;
+ u_int newsize, len;
+ char *copy;
+ const Char *p;
+
+ newsize = sizeof(*pathv) * (2 + pglob->gl_pathc + pglob->gl_offs);
+ pathv = pglob->gl_pathv ? realloc((char *)pglob->gl_pathv, newsize) :
+ malloc(newsize);
+ if (pathv == NULL) {
+ if (pglob->gl_pathv) {
+ free(pglob->gl_pathv);
+ pglob->gl_pathv = NULL;
+ }
+ return(GLOB_NOSPACE);
+ }
+
+ if (pglob->gl_pathv == NULL && pglob->gl_offs > 0) {
+ /* first time around -- clear initial gl_offs items */
+ pathv += pglob->gl_offs;
+ for (i = pglob->gl_offs; --i >= 0; )
+ *--pathv = NULL;
+ }
+ pglob->gl_pathv = pathv;
+
+ for (p = path; *p++;)
+ ;
+ len = (size_t)(p - path);
+ *limitp += len;
+ if ((copy = malloc(len)) != NULL) {
+ if (g_Ctoc(path, copy, len)) {
+ free(copy);
+ return(GLOB_NOSPACE);
+ }
+ pathv[pglob->gl_offs + pglob->gl_pathc++] = copy;
+ }
+ pathv[pglob->gl_offs + pglob->gl_pathc] = NULL;
+
+ if ((pglob->gl_flags & GLOB_LIMIT) &&
+ newsize + *limitp >= ARG_MAX) {
+ errno = 0;
+ return(GLOB_NOSPACE);
+ }
+
+ return(copy == NULL ? GLOB_NOSPACE : 0);
+}
+
+
+/*
+ * pattern matching function for filenames. Each occurrence of the *
+ * pattern causes a recursion level.
+ */
+static int
+match(name, pat, patend)
+ register Char *name, *pat, *patend;
+{
+ int ok, negate_range;
+ Char c, k;
+
+ while (pat < patend) {
+ c = *pat++;
+ switch (c & M_MASK) {
+ case M_ALL:
+ if (pat == patend)
+ return(1);
+ do
+ if (match(name, pat, patend))
+ return(1);
+ while (*name++ != EOS)
+ ;
+ return(0);
+ case M_ONE:
+ if (*name++ == EOS)
+ return(0);
+ break;
+ case M_SET:
+ ok = 0;
+ if ((k = *name++) == EOS)
+ return(0);
+ if ((negate_range = ((*pat & M_MASK) == M_NOT)) != EOS)
+ ++pat;
+ while (((c = *pat++) & M_MASK) != M_END)
+ if ((*pat & M_MASK) == M_RNG) {
+ if (c <= k && k <= pat[1])
+ ok = 1;
+ pat += 2;
+ } else if (c == k)
+ ok = 1;
+ if (ok == negate_range)
+ return(0);
+ break;
+ default:
+ if (*name++ != c)
+ return(0);
+ break;
+ }
+ }
+ return(*name == EOS);
+}
+
+/* Free allocated data belonging to a glob_t structure. */
+PHPAPI void
+globfree(pglob)
+ glob_t *pglob;
+{
+ register int i;
+ register char **pp;
+
+ if (pglob->gl_pathv != NULL) {
+ pp = pglob->gl_pathv + pglob->gl_offs;
+ for (i = pglob->gl_pathc; i--; ++pp)
+ if (*pp)
+ free(*pp);
+ free(pglob->gl_pathv);
+ pglob->gl_pathv = NULL;
+ }
+}
+
+static DIR *
+g_opendir(str, pglob)
+ register Char *str;
+ glob_t *pglob;
+{
+ char buf[MAXPATHLEN];
+
+ if (!*str)
+ strlcpy(buf, ".", sizeof buf);
+ else {
+ if (g_Ctoc(str, buf, sizeof(buf)))
+ return(NULL);
+ }
+
+ if (pglob->gl_flags & GLOB_ALTDIRFUNC)
+ return((*pglob->gl_opendir)(buf));
+
+ return(opendir(buf));
+}
+
+static int
+g_lstat(fn, sb, pglob)
+ register Char *fn;
+ struct stat *sb;
+ glob_t *pglob;
+{
+ char buf[MAXPATHLEN];
+
+ if (g_Ctoc(fn, buf, sizeof(buf)))
+ return(-1);
+ if (pglob->gl_flags & GLOB_ALTDIRFUNC)
+ return((*pglob->gl_lstat)(buf, sb));
+ return(php_sys_lstat(buf, sb));
+}
+
+static int
+g_stat(fn, sb, pglob)
+ register Char *fn;
+ struct stat *sb;
+ glob_t *pglob;
+{
+ char buf[MAXPATHLEN];
+
+ if (g_Ctoc(fn, buf, sizeof(buf)))
+ return(-1);
+ if (pglob->gl_flags & GLOB_ALTDIRFUNC)
+ return((*pglob->gl_stat)(buf, sb));
+ return(php_sys_stat(buf, sb));
+}
+
+static Char *
+g_strchr(str, ch)
+ Char *str;
+ int ch;
+{
+ do {
+ if (*str == ch)
+ return (str);
+ } while (*str++);
+ return (NULL);
+}
+
+static int
+g_Ctoc(str, buf, len)
+ register const Char *str;
+ char *buf;
+ u_int len;
+{
+
+ while (len--) {
+ if ((*buf++ = (char) *str++) == EOS)
+ return (0);
+ }
+ return (1);
+}
+
+#ifdef DEBUG
+static void
+qprintf(str, s)
+ const char *str;
+ register Char *s;
+{
+ register Char *p;
+
+ (void)printf("%s:\n", str);
+ for (p = s; *p; p++)
+ (void)printf("%c", CHAR(*p));
+ (void)printf("\n");
+ for (p = s; *p; p++)
+ (void)printf("%c", *p & M_PROTECT ? '"' : ' ');
+ (void)printf("\n");
+ for (p = s; *p; p++)
+ (void)printf("%c", ismeta(*p) ? '_' : ' ');
+ (void)printf("\n");
+}
+#endif
diff --git a/win32/glob.h b/win32/glob.h
new file mode 100644
index 0000000..3f7a57a
--- /dev/null
+++ b/win32/glob.h
@@ -0,0 +1,102 @@
+/* $Id$ */
+/* OpenBSD: glob.h,v 1.7 2002/02/17 19:42:21 millert Exp */
+/* NetBSD: glob.h,v 1.5 1994/10/26 00:55:56 cgd Exp */
+
+/*
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Guido van Rossum.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)glob.h 8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _GLOB_H_
+#define _GLOB_H_
+
+#ifndef PHP_WIN32
+# include <sys/cdefs.h>
+#endif
+
+struct stat;
+typedef struct {
+ int gl_pathc; /* Count of total paths so far. */
+ int gl_matchc; /* Count of paths matching pattern. */
+ int gl_offs; /* Reserved at beginning of gl_pathv. */
+ int gl_flags; /* Copy of flags parameter to glob. */
+ char **gl_pathv; /* List of paths matching pattern. */
+ /* Copy of errfunc parameter to glob. */
+ int (*gl_errfunc)(const char *, int);
+
+ /*
+ * Alternate filesystem access methods for glob; replacement
+ * versions of closedir(3), readdir(3), opendir(3), stat(2)
+ * and lstat(2).
+ */
+ void (*gl_closedir)(void *);
+ struct dirent *(*gl_readdir)(void *);
+ void *(*gl_opendir)(const char *);
+ int (*gl_lstat)(const char *, struct stat *);
+ int (*gl_stat)(const char *, struct stat *);
+} glob_t;
+
+/* Flags */
+#define GLOB_APPEND 0x0001 /* Append to output from previous call. */
+#define GLOB_DOOFFS 0x0002 /* Use gl_offs. */
+#define GLOB_ERR 0x0004 /* Return on error. */
+#define GLOB_MARK 0x0008 /* Append / to matching directories. */
+#define GLOB_NOCHECK 0x0010 /* Return pattern itself if nothing matches. */
+#define GLOB_NOSORT 0x0020 /* Don't sort. */
+
+#ifndef _POSIX_SOURCE
+#define GLOB_ALTDIRFUNC 0x0040 /* Use alternately specified directory funcs. */
+#define GLOB_BRACE 0x0080 /* Expand braces ala csh. */
+#define GLOB_MAGCHAR 0x0100 /* Pattern had globbing characters. */
+#define GLOB_NOMAGIC 0x0200 /* GLOB_NOCHECK without magic chars (csh). */
+#define GLOB_QUOTE 0x0400 /* Quote special chars with \. */
+#define GLOB_TILDE 0x0800 /* Expand tilde names from the passwd file. */
+#define GLOB_NOESCAPE 0x1000 /* Disable backslash escaping. */
+#define GLOB_LIMIT 0x2000 /* Limit pattern match output to ARG_MAX */
+#endif
+
+/* Error values returned by glob(3) */
+#define GLOB_NOSPACE (-1) /* Malloc call failed. */
+#define GLOB_ABORTED (-2) /* Unignored error. */
+#define GLOB_NOMATCH (-3) /* No match and GLOB_NOCHECK not set. */
+#define GLOB_NOSYS (-4) /* Function not supported. */
+#define GLOB_ABEND GLOB_ABORTED
+
+BEGIN_EXTERN_C()
+PHPAPI int glob(const char *, int, int (*)(const char *, int), glob_t *);
+PHPAPI void globfree(glob_t *);
+END_EXTERN_C()
+#endif /* !_GLOB_H_ */
diff --git a/win32/globals.c b/win32/globals.c
new file mode 100644
index 0000000..1bbb3b4
--- /dev/null
+++ b/win32/globals.c
@@ -0,0 +1,73 @@
+/*
+ +----------------------------------------------------------------------+
+ | PHP Version 5 |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1997-2013 The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Author: Wez Furlong <wez@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id$ */
+
+#include "php.h"
+#include "php_win32_globals.h"
+#include "syslog.h"
+
+#ifdef ZTS
+PHPAPI int php_win32_core_globals_id;
+#else
+php_win32_core_globals the_php_win32_core_globals;
+#endif
+
+void php_win32_core_globals_ctor(void *vg TSRMLS_DC)
+{
+ php_win32_core_globals *wg = (php_win32_core_globals*)vg;
+ memset(wg, 0, sizeof(*wg));
+}
+
+void php_win32_core_globals_dtor(void *vg TSRMLS_DC)
+{
+ php_win32_core_globals *wg = (php_win32_core_globals*)vg;
+
+ if (wg->registry_key) {
+ RegCloseKey(wg->registry_key);
+ wg->registry_key = NULL;
+ }
+ if (wg->registry_event) {
+ CloseHandle(wg->registry_event);
+ wg->registry_event = NULL;
+ }
+ if (wg->registry_directories) {
+ zend_hash_destroy(wg->registry_directories);
+ free(wg->registry_directories);
+ wg->registry_directories = NULL;
+ }
+}
+
+
+PHP_RSHUTDOWN_FUNCTION(win32_core_globals)
+{
+ php_win32_core_globals *wg =
+#ifdef ZTS
+ ts_resource(php_win32_core_globals_id)
+#else
+ &the_php_win32_core_globals
+#endif
+ ;
+
+ closelog();
+ wg->starttime.tv_sec = 0;
+ wg->lasttime = 0;
+
+ return SUCCESS;
+}
+
diff --git a/win32/grp.h b/win32/grp.h
new file mode 100644
index 0000000..a3fb97b
--- /dev/null
+++ b/win32/grp.h
@@ -0,0 +1,26 @@
+/*
+ +----------------------------------------------------------------------+
+ | PHP Version 5 |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1997-2013 The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Author: Sterling Hughes <sterling@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id$ */
+
+struct group {
+ char *gr_name;
+ char *gr_passwd;
+ int gr_gid;
+ char **gr_mem;
+};
diff --git a/win32/inet.c b/win32/inet.c
new file mode 100644
index 0000000..b794bca
--- /dev/null
+++ b/win32/inet.c
@@ -0,0 +1,88 @@
+#include "config.w32.h"
+#if (_WIN32_WINNT < 0x0600) /* Vista/2k8 have these functions */
+#include "php.h"
+#include <winsock2.h>
+#include <windows.h>
+#include <Ws2tcpip.h>
+
+#include "inet.h"
+
+PHPAPI int inet_pton(int af, const char* src, void* dst)
+{
+ int address_length;
+ struct sockaddr_storage sa;
+ struct sockaddr_in *sin = (struct sockaddr_in *)&sa;
+ struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)&sa;
+
+ switch (af) {
+ case AF_INET:
+ address_length = sizeof (struct sockaddr_in);
+ break;
+
+ case AF_INET6:
+ address_length = sizeof (struct sockaddr_in6);
+ break;
+
+ default:
+ return -1;
+ }
+
+ if (WSAStringToAddress ((LPTSTR) src, af, NULL, (LPSOCKADDR) &sa, &address_length) == 0) {
+ switch (af) {
+ case AF_INET:
+ memcpy (dst, &sin->sin_addr, sizeof (struct in_addr));
+ break;
+
+ case AF_INET6:
+ memcpy (dst, &sin6->sin6_addr, sizeof (struct in6_addr));
+ break;
+ }
+ return 1;
+ }
+
+ return 0;
+}
+
+PHPAPI const char* inet_ntop(int af, const void* src, char* dst, size_t size)
+{
+ int address_length;
+ DWORD string_length = size;
+ struct sockaddr_storage sa;
+ struct sockaddr_in *sin = (struct sockaddr_in *)&sa;
+ struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)&sa;
+
+ memset (&sa, 0, sizeof (sa));
+ switch (af) {
+ case AF_INET:
+ address_length = sizeof (struct sockaddr_in);
+ sin->sin_family = af;
+ memcpy (&sin->sin_addr, src, sizeof (struct in_addr));
+ break;
+
+ case AF_INET6:
+ address_length = sizeof (struct sockaddr_in6);
+ sin6->sin6_family = af;
+ memcpy (&sin6->sin6_addr, src, sizeof (struct in6_addr));
+ break;
+
+ default:
+ return NULL;
+ }
+
+ if (WSAAddressToString ((LPSOCKADDR) &sa, address_length, NULL, dst, &string_length) == 0) {
+ return dst;
+ }
+
+ return NULL;
+}
+
+int inet_aton(const char *cp, struct in_addr *inp) {
+ inp->s_addr = inet_addr(cp);
+
+ if (inp->s_addr == INADDR_NONE) {
+ return 0;
+ }
+
+ return 1;
+}
+#endif
diff --git a/win32/inet.h b/win32/inet.h
new file mode 100644
index 0000000..e580838
--- /dev/null
+++ b/win32/inet.h
@@ -0,0 +1,10 @@
+#if _MSC_VER >= 1500
+# include <In6addr.h>
+#endif
+#include <Ws2tcpip.h>
+
+#if (_WIN32_WINNT < 0x0600)
+PHPAPI int inet_pton(int af, const char* src, void* dst);
+PHPAPI const char* inet_ntop(int af, const void* src, char* dst, size_t size);
+PHPAPI int inet_aton(const char *cp, struct in_addr *inp);
+#endif
diff --git a/win32/install.txt b/win32/install.txt
new file mode 100644
index 0000000..b1d4ee5
--- /dev/null
+++ b/win32/install.txt
@@ -0,0 +1,1939 @@
+Installing PHP
+ __________________________________________________________________
+
+ Table of Contents
+ Preface
+ 1. General Installation Considerations
+ 2. Installation on Windows systems
+
+ Windows Installer
+ Manual Installation Steps
+ ActiveScript
+ Microsoft IIS / PWS
+ Apache 1.3.x on Microsoft Windows
+ Apache 2.0.x on Microsoft Windows
+ Sun, iPlanet and Netscape servers on Microsoft Windows
+ OmniHTTPd Server
+ Sambar Server on Microsoft Windows
+ Xitami on Microsoft Windows
+ Installation of extensions on Windows
+
+ 3. Installation of PECL extensions
+
+ Introduction to PECL Installations
+ Downloading PECL extensions
+ PECL for Windows users
+ Compiling shared PECL extensions with the pecl command
+ Compiling shared PECL extensions with phpize
+ Compiling PECL extensions statically into PHP
+
+ 4. Problems?
+
+ Read the FAQ
+ Other problems
+ Bug reports
+
+ 5. Runtime Configuration
+
+ The configuration file
+ How to change configuration settings
+
+ 6. Installation FAQ
+ __________________________________________________________________
+
+Preface
+
+ These installation instructions were generated from the HTML version of
+ the PHP Manual so formatting and linking have been altered. See the
+ online and updated version at: http://php.net/install.windows
+ __________________________________________________________________
+
+Chapter 1. General Installation Considerations
+
+ Before starting the installation, first you need to know what do you
+ want to use PHP for. There are three main fields you can use PHP, as
+ described in the What can PHP do? section:
+
+ * Websites and web applications (server-side scripting)
+ * Command line scripting
+ * Desktop (GUI) applications
+
+ For the first and most common form, you need three things: PHP itself,
+ a web server and a web browser. You probably already have a web
+ browser, and depending on your operating system setup, you may also
+ have a web server (e.g. Apache on Linux and MacOS X; IIS on Windows).
+ You may also rent webspace at a company. This way, you don't need to
+ set up anything on your own, only write your PHP scripts, upload it to
+ the server you rent, and see the results in your browser.
+
+ In case of setting up the server and PHP on your own, you have two
+ choices for the method of connecting PHP to the server. For many
+ servers PHP has a direct module interface (also called SAPI). These
+ servers include Apache, Microsoft Internet Information Server, Netscape
+ and iPlanet servers. Many other servers have support for ISAPI, the
+ Microsoft module interface (OmniHTTPd for example). If PHP has no
+ module support for your web server, you can always use it as a CGI or
+ FastCGI processor. This means you set up your server to use the CGI
+ executable of PHP to process all PHP file requests on the server.
+
+ If you are also interested to use PHP for command line scripting (e.g.
+ write scripts autogenerating some images for you offline, or processing
+ text files depending on some arguments you pass to them), you always
+ need the command line executable. For more information, read the
+ section about writing command line PHP applications. In this case, you
+ need no server and no browser.
+
+ With PHP you can also write desktop GUI applications using the PHP-GTK
+ extension. This is a completely different approach than writing web
+ pages, as you do not output any HTML, but manage Windows and objects
+ within them. For more information about PHP-GTK, please visit the site
+ dedicated to this extension. PHP-GTK is not included in the official
+ PHP distribution.
+
+ From now on, this section deals with setting up PHP for web servers on
+ Unix and Windows with server module interfaces and CGI executables. You
+ will also find information on the command line executable in the
+ following sections.
+
+ PHP source code and binary distributions for Windows can be found at
+ http://www.php.net/downloads.php. We recommend you to choose a mirror
+ nearest to you for downloading the distributions.
+ __________________________________________________________________
+
+Chapter 2. Installation on Windows systems
+
+ This section applies to Windows 98/Me and Windows NT/2000/XP/2003. PHP
+ will not work on 16 bit platforms such as Windows 3.1 and sometimes we
+ refer to the supported Windows platforms as Win32. Windows 95 is no
+ longer supported as of PHP 4.3.0.
+
+ There are two main ways to install PHP for Windows: either manually or
+ by using the installer.
+
+ If you have Microsoft Visual Studio, you can also build PHP from the
+ original source code.
+
+ Once you have PHP installed on your Windows system, you may also want
+ to load various extensions for added functionality.
+
+ Warning
+
+ There are several all-in-one installers over the Internet, but none of
+ those are endorsed by PHP.net, as we believe that the manual
+ installation is the best choice to have your system secure and
+ optimised.
+ __________________________________________________________________
+
+Windows Installer (PHP 5.2 and later)
+
+ The Windows PHP installer for later versions of PHP is built using MSI
+ technology using the Wix Toolkit (http://wix.sourceforge.net/). It will
+ install and configure PHP and all the built-in and PECL extensions, as
+ well as configure many of the popular web servers such as IIS, Apache,
+ and Xitami.
+
+ First, install your selected HTTP (web) server on your system, and make
+ sure that it works. Then proceed with one of the following install
+ types.
+ __________________________________________________________________
+
+Normal Install
+
+ Run the MSI installer and follow the instructions provided by the
+ installation wizard. You will be prompted to select the Web Server you
+ wish to configure first, along with any configuration details needed.
+
+ You will then be prompted to select which features and extensions you
+ wish to install and enable. By selecting "Will be installed on local
+ hard drive" in the drop-down menu for each item you can trigger whether
+ to install the feature or not. By selecting "Entire feature will be
+ installed on local hard drive", you will be able to install all
+ sub-features of the included feature ( for example by selecting this
+ options for the feature "PDO" you will install all PDO Drivers ).
+
+ Warning
+
+ It is not recommended to install all extensions by default, since many
+ other them require dependencies from outside PHP in order to function
+ properly. Instead, use the Installation Repair Mode that can be
+ triggered thru the 'Add/Remove Programs' control panel to enable or
+ disable extensions and features after installation.
+
+ The installer then sets up PHP to be used in Windows and the php.ini
+ file, and configures certain web servers to use PHP. The installer will
+ currently configure IIS (CGI mode only), Apache, Xitami, and Sambar
+ Server; if you are using a different web server you'll need to
+ configure it manually.
+ __________________________________________________________________
+
+Silent Install
+
+ The installer also supports a silent mode, which is helpful for Systems
+ Administrators to deploy PHP easily. To use silent mode:
+ msiexec.exe /i php-VERSION-win32-install.msi /q
+
+ You can control the install directory by passing it as a parameter to
+ the install. For example, to install to e:\php:
+ msiexec.exe /i php-VERSION-win32-install.msi /q INSTALLDIR=e:\php
+
+ You can also use the same syntax to specify the Apache Configuration
+ Directory (APACHEDIR), the Sambar Server directory (SAMBARDIR), and the
+ Xitami Server directory (XITAMIDIR).
+
+ You can also specify what features to install. For example, to install
+ the mysqli extension and the CGI executable:
+ msiexec.exe /i php-VERSION-win32-install.msi /q ADDLOCAL=cgi,ext_php_mysqli
+
+ The current list of Features to install is as follows:
+MainExecutable - php.exe executable
+ScriptExecutable - php-win.exe executable
+ext_php_* - the various extensions ( for example: ext_php_mysql for MySQL )
+apache13 - Apache 1.3 module
+apache20 - Apache 2.0 module
+apache22 - Apache 2,2 module
+apacheCGI - Apache CGI executable
+iis4ISAPI - IIS ISAPI module
+iis4CGI - IIS CGI executable
+NSAPI - Sun/iPlanet/Netscape server module
+Xitami - Xitami CGI executable
+Sambar - Sambar Server ISAPI module
+CGI - php-cgi.exe executable
+PEAR - PEAR installer
+Manual - PHP Manual in CHM Format
+
+ For more information on installing MSI installers from the command
+ line, visit
+ http://msdn.microsoft.com/library/en-us/msi/setup/command_line_options.
+ asp
+ __________________________________________________________________
+
+Windows Installer (PHP 5.1.0 and earlier)
+
+ The Windows PHP installer is available from the downloads page at
+ http://www.php.net/downloads.php. This installs the CGI version of PHP
+ and for IIS, PWS, and Xitami, it configures the web server as well. The
+ installer does not include any extra external PHP extensions
+ (php_*.dll) as you'll only find those in the Windows Zip Package and
+ PECL downloads.
+
+ Note: While the Windows installer is an easy way to make PHP work,
+ it is restricted in many aspects as, for example, the automatic
+ setup of extensions is not supported. Use of the installer isn't the
+ preferred method for installing PHP.
+
+ First, install your selected HTTP (web) server on your system, and make
+ sure that it works.
+
+ Run the executable installer and follow the instructions provided by
+ the installation wizard. Two types of installation are supported -
+ standard, which provides sensible defaults for all the settings it can,
+ and advanced, which asks questions as it goes along.
+
+ The installation wizard gathers enough information to set up the
+ php.ini file, and configure certain web servers to use PHP. One of the
+ web servers the PHP installer does not configure for is Apache, so
+ you'll need to configure it manually.
+
+ Once the installation has completed, the installer will inform you if
+ you need to restart your system, restart the server, or just start
+ using PHP.
+
+ Warning
+
+ Be aware, that this setup of PHP is not secure. If you would like to
+ have a secure PHP setup, you'd better go on the manual way, and set
+ every option carefully. This automatically working setup gives you an
+ instantly working PHP installation, but it is not meant to be used on
+ online servers.
+ __________________________________________________________________
+
+Manual Installation Steps
+
+ This install guide will help you manually install and configure PHP
+ with a web server on Microsoft Windows. To get started you'll need to
+ download the zip binary distribution from the downloads page at
+ http://www.php.net/downloads.php.
+
+ Although there are many all-in-one installation kits, and we also
+ distribute a PHP installer for Microsoft Windows, we recommend you take
+ the time to setup PHP yourself as this will provide you with a better
+ understanding of the system, and enables you to install PHP extensions
+ easily when needed.
+
+ Upgrading from a previous PHP version: Previous editions of the
+ manual suggest moving various ini and DLL files into your SYSTEM
+ (i.e. C:\WINDOWS) folder and while this simplifies the installation
+ procedure it makes upgrading difficult. We advise you remove all of
+ these files (like php.ini and PHP related DLLs from the Windows
+ SYSTEM folder) before moving on with a new PHP installation. Be sure
+ to backup these files as you might break the entire system. The old
+ php.ini might be useful in setting up the new PHP as well. And as
+ you'll soon learn, the preferred method for installing PHP is to
+ keep all PHP related files in one directory and have this directory
+ available to your systems PATH.
+
+ MDAC requirements: If you use Microsoft Windows 98/NT4 download the
+ latest version of the Microsoft Data Access Components (MDAC) for
+ your platform. MDAC is available at http://msdn.microsoft.com/data/.
+ This requirement exists because ODBC is built into the distributed
+ Windows binaries.
+
+ The following steps should be completed on all installations before any
+ server specific instructions are performed:
+
+ Extract the distribution file into a directory of your choice. If you
+ are installing PHP 4, extract to C:\, as the zip file expands to a
+ foldername like php-4.3.7-Win32. If you are installing PHP 5, extract
+ to C:\php as the zip file doesn't expand as in PHP 4. You may choose a
+ different location but do not have spaces in the path (like C:\Program
+ Files\PHP) as some web servers will crash if you do.
+
+ The directory structure extracted from the zip is different for PHP
+ versions 4 and 5 and look like as follows:
+
+ Example 2-2. PHP 5 package structure
+c:\php
+ |
+ +--dev
+ | |
+ | |-php5ts.lib
+ |
+ +--ext -- extension DLLs for PHP
+ | |
+ | |-php_bz2.dll
+ | |
+ | |-php_cpdf.dll
+ | |
+ | |-..
+ |
+ +--extras
+ | |
+ | +--mibs -- support files for SNMP
+ | |
+ | +--openssl -- support files for Openssl
+ | |
+ | +--pdf-related -- support files for PDF
+ | |
+ | |-mime.magic
+ |
+ +--pear -- initial copy of PEAR
+ |
+ |
+ |-go-pear.bat -- PEAR setup script
+ |
+ |-fdftk.dll
+ |
+ |-..
+ |
+ |-php-cgi.exe -- CGI executable
+ |
+ |-php-win.exe -- executes scripts without an opened command prompt
+ |
+ |-php.exe -- CLI executable - ONLY for command line scripting
+ |
+ |-..
+ |
+ |-php.ini-development -- development php.ini settings
+ |
+ |-php.ini-production -- recommended php.ini settings for production
+ |
+ |-php5activescript.dll
+ |
+ |-php5apache.dll
+ |
+ |-php5apache2.dll
+ |
+ |-..
+ |
+ |-php5ts.dll -- core PHP DLL
+ |
+ |-...
+
+ Notice the differences and similarities. Both PHP 4 and PHP 5 have a
+ CGI executable, a CLI executable, and server modules, but they are
+ located in different folders and/or have different names. While PHP 4
+ packages have the server modules in the sapi folder, PHP 5
+ distributions have no such directory and instead they're in the PHP
+ folder root. The supporting DLLs for the PHP 5 extensions are also not
+ in a seperate directory.
+
+ Note: In PHP 4, you should move all files located in the dll and
+ sapi folders to the main folder (e.g. C:\php).
+
+ Here is a list of server modules shipped with PHP 5:
+
+ * sapi/php5apache2_2.dll - Apache 2.2.x module.
+ * sapi/php5apache.dll (php5apache.dll) - Apache 1.x module
+ * sapi/php5apache2.dll (php5apache2.dll) - - Apache 2.0.x module.
+ * sapi/php5isapi.dll - ISAPI Module for ISAPI compliant web servers
+ like IIS 5.0 or newer. However the FCGI SAPI is recommended with
+ IIS
+ * sapi/php5nsapi.dll (php5nsapi.dll) - Sun/iPlanet/Netscape server
+ module.
+
+ Server modules provide significantly better performance and additional
+ functionality compared to the CGI binary. The FastCGI is significantly
+ more stable and can be faster than the ISAPI module with IIS.
+ The CLI version is designed to let you use PHP for command line
+ scripting. More information about CLI is available in the chapter
+ about using PHP from the command line.
+
+ Warning
+
+ The SAPI modules have been significantly improved as of the 4.1
+ release, however, in older systems you may encounter server errors or
+ other server modules failing, such as ASP.
+
+ The CGI and CLI binaries, and the web server modules all require the
+ php5ts.dll file to be available to them. You have to make
+ sure that this file can be found by your PHP installation. The search
+ order for this DLL is as follows:
+
+ * The same directory from where php.exe is called, or in case you use
+ a SAPI module, the web server's directory (e.g. C:\Program
+ Files\Apache Group\Apache2\bin).
+ * Any directory in your Windows PATH environment variable.
+
+ To make php5ts.dll available you have three options: copy
+ the file to the Windows system directory, copy the file to the web
+ server's directory, or add your PHP directory, C:\php to the PATH. For
+ better maintenance, we advise you to follow the last option, add C:\php
+ to the PATH, because it will be simpler to upgrade PHP in the future.
+ Read more about how to add your PHP directory to PATH in the
+ corresponding FAQ entry (and then don't forget to restart the computer
+ - logoff isn't enough).
+
+ The next step is to set up a valid configuration file for PHP, php.ini.
+ There are two ini files distributed in the zip file, php.ini-development
+ and php.ini-production. We advise you to use php.ini-production,
+ because we optimized the default settings in this file for performance,
+ and security. Read this well documented file carefully because it has
+ changes from php.ini-production that will drastically affect your setup.
+ Some examples are display_errors being off and magic_quotes_gpc being off.
+ In addition to reading these, study the ini settings and set every
+ element manually yourself. If you would like to achieve the best
+ security, then this is the way for you, although PHP works fine with
+ these default ini files. Copy your chosen ini-file to a directory that
+ PHP is able to find and rename it to php.ini. PHP searches for php.ini
+ in the locations described in the Section called The configuration file
+ in Chapter 5 section.
+
+ If you are running Apache 2, the simpler option is to use the PHPIniDir
+ directive (read the installation on Apache 2 page), otherwise your best
+ option is to set the PHPRC environment variable. This process is
+ explained in the following FAQ entry.
+
+ Note: If you're using NTFS on Windows NT, 2000, XP or 2003, make
+ sure that the user running the web server has read permissions to
+ your php.ini (e.g. make it readable by Everyone).
+
+ The following steps are optional:
+
+ * Edit your new php.ini file. If you plan to use OmniHTTPd, do not
+ follow the next step. Set the doc_root to point to your web servers
+ document_root. For example:
+
+doc_root = c:\inetpub\wwwroot // for IIS/PWS
+
+doc_root = c:\apache\htdocs // for Apache
+
+ * Choose the extensions you would like to load when PHP starts. See
+ the section about Windows extensions, about how to set up one, and
+ what is already built in. Note that on a new installation it is
+ advisable to first get PHP working and tested without any
+ extensions before enabling them in php.ini.
+ * On PWS and IIS, you can set the browscap configuration setting to
+ point to: c:\windows\system\inetsrv\browscap.ini on Windows 9x/Me,
+ c:\winnt\system32\inetsrv\browscap.ini on NT/2000, and
+ c:\windows\system32\inetsrv\browscap.ini on XP. For an up-to-date
+ browscap.ini, read the following FAQ.
+
+ PHP is now setup on your system. The next step is to choose a web
+ server, and enable it to run PHP. Choose a web server from the table of
+ contents.
+ __________________________________________________________________
+
+ActiveScript
+
+ This section contains notes specific to the ActiveScript installation.
+
+ ActiveScript is a Windows only SAPI that enables you to use PHP script
+ in any ActiveScript compliant host, like Windows Script Host,
+ ASP/ASP.NET, Windows Script Components or Microsoft Scriptlet control.
+
+ As of PHP 5.0.1, ActiveScript has been moved to the PECL repository.
+ The DLL for this PECL extension may be downloaded from either the PHP
+ Downloads page or from http://pecl4win.php.net/
+
+ Note: You should read the manual installation steps first!
+
+ After installing PHP, you should download the ActiveScript DLL
+ (php5activescript.dll) and place it in the main PHP folder (e.g.
+ C:\php).
+
+ After having all the files needed, you must register the DLL on your
+ system. To achieve this, open a Command Prompt window (located in the
+ Start Menu). Then go to your PHP directory by typing something like cd
+ C:\php. To register the DLL just type regsvr32 php5activescript.dll.
+
+ To test if ActiveScript is working, create a new file, named test.wsf
+ (the extension is very important) and type:
+<job id="test">
+
+ <script language="PHPScript">
+ $WScript->Echo("Hello World!");
+ </script>
+
+</job>
+
+ Save and double-click on the file. If you receive a little window
+ saying "Hello World!" you're done.
+
+ Note: In PHP 4, the engine was named 'ActivePHP', so if you are
+ using PHP 4, you should replace 'PHPScript' with 'ActivePHP' in the
+ above example.
+
+ Note: ActiveScript doesn't use the default php.ini file. Instead, it
+ will look only in the same directory as the .exe that caused it to
+ load. You should create php-activescript.ini and place it in that
+ folder, if you wish to load extensions, etc.
+ __________________________________________________________________
+
+Microsoft IIS / PWS
+
+ This section contains notes and hints specific to IIS (Microsoft
+ Internet Information Server).
+
+ Warning
+
+ By using the CGI setup, your server is open to several possible
+ attacks. Please read our CGI security section to learn how to defend
+ yourself from those attacks.
+ __________________________________________________________________
+
+General considerations for all installations of PHP with IIS or PWS
+
+ * First, read the Manual Installation Instructions. Do not skip this
+ step as it provides crucial information for installing PHP on
+ Windows.
+ * CGI users must set the cgi.force_redirect PHP directive to 0 inside
+ php.ini. Read the faq on cgi.force_redirect for important details.
+ Also, CGI users may want to set the cgi.redirect_status_env
+ directive. When using directives, be sure these directives aren't
+ commented out inside php.ini.
+ * The PHP 4 CGI is named php.exe while in PHP 5 it's php-cgi.exe. In
+ PHP 5, php.exe is the CLI, and not the CGI.
+ * Modify the Windows PATH environment variable to include the PHP
+ directory. This way the PHP DLL files and PHP executables can all
+ remain in the PHP directory without cluttering up the Windows
+ system directory. For more details, see the FAQ on Setting the
+ PATH.
+ * The IIS user (usually IUSR_MACHINENAME) needs permission to read
+ various files and directories, such as php.ini, docroot, and the
+ session tmp directory.
+ * Be sure the extension_dir and doc_root PHP directives are
+ appropriately set in php.ini. These directives depend on the system
+ that PHP is being installed on. In PHP 4, the extension_dir is
+ extensions while with PHP 5 it's ext. So, an example PHP 5
+ extensions_dir value is "c:\php\ext" and an example IIS doc_root
+ value is "c:\Inetpub\wwwroot".
+ * PHP extension DLL files, such as php_mysql.dll and php_curl.dll,
+ are found in the zip package of the PHP download (not the PHP
+ installer). In PHP 5, many extensions are part of PECL and can be
+ downloaded in the "Collection of PECL modules" package. Files such
+ as php_zip.dll and php_ssh2.dll. Download PHP files here.
+ * When defining the executable, the 'check that file exists' box may
+ also be checked. For a small performance penalty, the IIS (or PWS)
+ will check that the script file exists and sort out authentication
+ before firing up PHP. This means that the web server will provide
+ sensible 404 style error messages instead of CGI errors complaining
+ that PHP did not output any data.
+ __________________________________________________________________
+
+Windows NT/200x/XP and IIS 4 or newer
+
+ PHP may be installed as a CGI binary, or with the ISAPI module. In
+ either case, you need to start the Microsoft Management Console (may
+ appear as 'Internet Services Manager', either in your Windows NT 4.0
+ Option Pack branch or the Control Panel=>Administrative Tools under
+ Windows 2000/XP). Then right click on your Web server node (this will
+ most probably appear as 'Default Web Server'), and select 'Properties'.
+
+ If you want to use the CGI binary, do the following:
+
+ * Under 'Home Directory', 'Virtual Directory', or 'Directory', do the
+ following:
+ * Change the Execute Permissions to 'Scripts only'
+ * Click on the 'Configuration' button, and choose the Application
+ Mappings tab. Click Add and set the Executable path to the
+ appropriate CGI file. An example PHP 5 value is: C:\php\php-cgi.exe
+ Supply .php as the extension. Leave 'Method exclusions' blank, and
+ check the 'Script engine' checkbox. Now, click OK a few times.
+ * Set up the appropriate security. (This is done in Internet Service
+ Manager), and if your NT Server uses NTFS file system, add execute
+ rights for I_USR_ to the directory that contains php.exe /
+ php-cgi.exe.
+
+ To use the ISAPI module, do the following:
+
+ * If you don't want to perform HTTP Authentication using PHP, you can
+ (and should) skip this step. Under ISAPI Filters, add a new ISAPI
+ filter. Use PHP as the filter name, and supply a path to the
+ php5isapi.dll.
+ * Under 'Home Directory', 'Virtual Directory', or 'Directory', do the
+ following:
+ * Change the Execute Permissions to 'Scripts only'
+ * Click on the 'Configuration' button, and choose the Application
+ Mappings tab. Click Add and set the Executable path to the
+ appropriate ISAPI DLL. An example PHP 5 value is:
+ C:\php\php5isapi.dll Supply .php as the extension. Leave 'Method
+ exclusions' blank, and check the 'Script engine' checkbox. Now,
+ click OK a few times.
+ * Stop IIS completely (NET STOP iisadmin)
+ * Start IIS again (NET START w3svc)
+
+ With IIS 6 (2003 Server), open up the IIS Manager, go to Web Service
+ Extensions, choose "Add a new Web service extension", enter in a name
+ such as PHP, choose the Add button and for the value browse to either
+ the ISAPI file (php5isapi.dll) or CGI (php.exe or
+ php-cgi.exe) then check "Set extension status to Allowed" and click OK.
+
+ In order to use index.php as a default content page, do the following:
+ From within the Documents tab, choose Add. Type in index.php and click
+ OK. Adjust the order by choosing Move Up or Move Down. This is similar
+ to setting DirectoryIndex with Apache.
+
+ The steps above must be repeated for each extension that is to be
+ associated with PHP scripts. .php is the most common although .php3 may
+ be required for legacy applications.
+
+ If you experience 100% CPU usage after some time, turn off the IIS
+ setting Cache ISAPI Application.
+ __________________________________________________________________
+
+Windows and IIS
+
+See http://www.php.net/install.windows
+ __________________________________________________________________
+
+Apache 1.3.x on Microsoft Windows
+
+ This section contains notes and hints specific to Apache 1.3.x installs
+ of PHP on Microsoft Windows systems. There are also instructions and
+ notes for Apache 2 on a separate page.
+
+ Note: Please read the manual installation steps first!
+
+ There are two ways to set up PHP to work with Apache 1.3.x on Windows.
+ One is to use the CGI binary (php.exe for PHP 4 and php-cgi.exe for PHP
+ 5), the other is to use the Apache Module DLL. In either case you need
+ to edit your httpd.conf to configure Apache to work with PHP, and then
+ restart the server.
+
+ It is worth noting here that now the SAPI module has been made more
+ stable under Windows, we recommend it's use above the CGI binary, since
+ it is more transparent and secure.
+
+ Although there can be a few variations of configuring PHP under Apache,
+ these are simple enough to be used by the newcomer. Please consult the
+ Apache Documentation for further configuration directives.
+
+ After changing the configuration file, remember to restart the server,
+ for example, NET STOP APACHE followed by NET START APACHE, if you run
+ Apache as a Windows Service, or use your regular shortcuts.
+
+ Note: Remember that when adding path values in the Apache
+ configuration files on Windows, all backslashes such as
+ c:\directory\file.ext must be converted to forward slashes, as
+ c:/directory/file.ext. A trailing slash may also be necessary for
+ directories.
+ __________________________________________________________________
+
+Installing as an Apache module
+
+ You should add the following lines to your Apache httpd.conf file:
+
+ Example 2-3. PHP as an Apache 1.3.x module
+
+ This assumes PHP is installed to c:\php. Adjust the path if this is not
+ the case.
+
+ For PHP 5:
+# Add to the end of the LoadModule section
+LoadModule php5_module "C:/php/php5apache.dll"
+
+# Add to the end of the AddModule section
+AddModule mod_php5.c
+
+ For both:
+# Add this line inside the <IfModule mod_mime.c> conditional brace
+AddType application/x-httpd-php .php
+
+# For syntax highlighted .phps files, also add
+AddType application/x-httpd-php-source .phps
+ __________________________________________________________________
+
+Installing as a CGI binary
+
+ If you unzipped the PHP package to C:\php\ as described in the Manual
+ Installation Steps section, you need to insert these lines to your
+ Apache configuration file to set up the CGI binary:
+
+ Example 2-4. PHP and Apache 1.3.x as CGI
+ScriptAlias /php/ "c:/php/"
+AddType application/x-httpd-php .php
+
+# For PHP 4
+Action application/x-httpd-php "/php/php.exe"
+
+# For PHP 5
+Action application/x-httpd-php "/php/php-cgi.exe"
+
+# specify the directory where php.ini is
+SetEnv PHPRC C:/php
+
+ Note that the second line in the list above can be found in the actual
+ versions of httpd.conf, but it is commented out. Remember also to
+ substitute the c:/php/ for your actual path to PHP.
+
+ Warning
+
+ By using the CGI setup, your server is open to several possible
+ attacks. Please read our CGI security section to learn how to defend
+ yourself from those attacks.
+
+ If you would like to present PHP source files syntax highlighted, there
+ is no such convenient option as with the module version of PHP. If you
+ chose to configure Apache to use PHP as a CGI binary, you will need to
+ use the highlight_file() function. To do this simply create a PHP
+ script file and add this code: <?php
+ highlight_file('some_php_script.php'); ?>.
+ __________________________________________________________________
+
+Apache 2.0.x on Microsoft Windows
+
+ This section contains notes and hints specific to Apache 2.0.x installs
+ of PHP on Microsoft Windows systems. We also have instructions and
+ notes for Apache 1.3.x users on a separate page.
+
+ Note: You should read the manual installation steps first!
+
+ Apache 2.2.x Support: Users of Apache 2.2.x may use the
+ documentation below except the appropriate DLL file is named
+ php5apache2_2.dll and it only exists as of PHP 5.2.0. See also
+ http://snaps.php.net/
+
+ Warning
+
+ We do not recommend using a threaded MPM in production with Apache2.
+ Use the prefork MPM instead, or use Apache1. For information on why,
+ read the related FAQ entry on using Apache2 with a threaded MPM
+
+ You are highly encouraged to take a look at the Apache Documentation to
+ get a basic understanding of the Apache 2.0.x Server. Also consider to
+ read the Windows specific notes for Apache 2.0.x before reading on
+ here.
+
+ PHP and Apache 2.0.x compatibility notes: The following versions of
+ PHP are known to work with the most recent version of Apache 2.0.x:
+
+ * PHP 4.3.0 or later available at http://www.php.net/downloads.php.
+ * the latest stable development version. Get the source code
+ http://snaps.php.net/php5-latest.tar.gz or download binaries for
+ Windows http://snaps.php.net/win32/php5-win32-latest.zip.
+ * a prerelease version downloadable from http://qa.php.net/.
+ * you have always the option to obtain PHP through SVN.
+
+ These versions of PHP are compatible to Apache 2.0.40 and later.
+
+ Apache 2.0 SAPI-support started with PHP 4.2.0. PHP 4.2.3 works with
+ Apache 2.0.39, don't use any other version of Apache with PHP 4.2.3.
+ However, the recommended setup is to use PHP 4.3.0 or later with the
+ most recent version of Apache2.
+
+ All mentioned versions of PHP will work still with Apache 1.3.x.
+
+ Warning
+
+ Apache 2.0.x is designed to run on Windows NT 4.0, Windows 2000 or
+ Windows XP. At this time, support for Windows 9x is incomplete. Apache
+ 2.0.x is not expected to work on those platforms at this time.
+
+ Download the most recent version of Apache 2.0.x and a fitting PHP
+ version. Follow the Manual Installation Steps and come back to go on
+ with the integration of PHP and Apache.
+
+ There are two ways to set up PHP to work with Apache 2.0.x on Windows.
+ One is to use the CGI binary the other is to use the Apache module DLL.
+ In either case you need to edit your httpd.conf to configure Apache to
+ work with PHP and then restart the server.
+
+ Note: Remember that when adding path values in the Apache
+ configuration files on Windows, all backslashes such as
+ c:\directory\file.ext must be converted to forward slashes, as
+ c:/directory/file.ext. A trailing slash may also be necessary for
+ directories.
+ __________________________________________________________________
+
+Installing as a CGI binary
+
+ You need to insert these three lines to your Apache httpd.conf
+ configuration file to set up the CGI binary:
+
+ Example 2-5. PHP and Apache 2.0 as CGI
+ScriptAlias /php/ "c:/php/"
+AddType application/x-httpd-php .php
+
+# For PHP 4
+Action application/x-httpd-php "/php/php.exe"
+
+# For PHP 5
+Action application/x-httpd-php "/php/php-cgi.exe"
+
+ Warning
+
+ By using the CGI setup, your server is open to several possible
+ attacks. Please read our CGI security section to learn how to defend
+ yourself from those attacks.
+ __________________________________________________________________
+
+Installing as an Apache module
+
+ You need to insert these two lines to your Apache httpd.conf
+ configuration file to set up the PHP module for Apache 2.0:
+
+ Example 2-6. PHP and Apache 2.0 as Module
+
+# For PHP 5 do something like this:
+LoadModule php5_module "c:/php/php5apache2.dll"
+AddType application/x-httpd-php .php
+
+# configure the path to php.ini
+PHPIniDir "C:/php"
+
+ Note: Remember to substitute your actual path to PHP for the c:/php/
+ in the above examples. Take care to use either
+ php5apache2.dll in your LoadModule directive and not php5apache.dll
+ as the latter ones are designed to run with Apache 1.3.x.
+
+ Note: If you want to use content negotiation, read related FAQ.
+
+ Warning
+
+ Don't mix up your installation with DLL files from different PHP
+ versions. You have the only choice to use the DLL's and extensions that
+ ship with your downloaded PHP version.
+ __________________________________________________________________
+
+Sun, iPlanet and Netscape servers on Microsoft Windows
+
+ This section contains notes and hints specific to Sun Java System Web
+ Server, Sun ONE Web Server, iPlanet and Netscape server installs of PHP
+ on Windows.
+
+ From PHP 4.3.3 on you can use PHP scripts with the NSAPI module to
+ generate custom directory listings and error pages. Additional
+ functions for Apache compatibility are also available. For support in
+ current web servers read the note about subrequests.
+ __________________________________________________________________
+
+CGI setup on Sun, iPlanet and Netscape servers
+
+ To install PHP as a CGI handler, do the following:
+
+ * Copy php5ts.dll to your systemroot (the directory where you
+ installed Windows)
+ * Make a file association from the command line. Type the following
+ two lines:
+
+assoc .php=PHPScript
+ftype PHPScript=c:\php\php.exe %1 %*
+
+ * In the Netscape Enterprise Administration Server create a dummy
+ shellcgi directory and remove it just after (this step creates 5
+ important lines in obj.conf and allow the web server to handle
+ shellcgi scripts).
+ * In the Netscape Enterprise Administration Server create a new mime
+ type (Category: type, Content-Type: magnus-internal/shellcgi, File
+ Suffix:php).
+ * Do it for each web server instance you want PHP to run
+
+ More details about setting up PHP as a CGI executable can be found
+ here: http://benoit.noss.free.fr/php/install-php.html
+ __________________________________________________________________
+
+NSAPI setup on Sun, iPlanet and Netscape servers
+
+ To install PHP with NSAPI, do the following:
+
+ * Copy php5ts.dll to your systemroot (the directory where you
+ installed Windows)
+ * Make a file association from the command line. Type the following
+ two lines:
+
+assoc .php=PHPScript
+ftype PHPScript=c:\php\php.exe %1 %*
+
+ * In the Netscape Enterprise Administration Server create a new mime
+ type (Category: type, Content-Type: magnus-internal/x-httpd-php,
+ File Suffix: php).
+ * Edit magnus.conf (for servers >= 6) or obj.conf (for servers < 6)
+ and add the following: You should place the lines after mime types
+ init.
+
+Init fn="load-modules" funcs="php5_init,php5_execute,php5_auth_trans" shlib="c:/
+php/sapi/php5nsapi.dll"
+Init fn="php5_init" LateInit="yes" errorString="Failed to initialise PHP!" [php_
+ini="c:/path/to/php.ini"]
+
+ The php_ini parameter is optional but with it you
+ can place your php.ini in your web server configuration directory.
+ * Configure the default object in obj.conf (for virtual server
+ classes [Sun Web Server 6.0+] in their vserver.obj.conf): In the
+ <Object name="default"> section, place this line necessarily after
+ all 'ObjectType' and before all 'AddLog' lines:
+
+Service fn="php5_execute" type="magnus-internal/x-httpd-php" [inikey=value inike
+y=value ...]
+
+ As additional parameters you can add some special
+ php.ini-values, for example you can set a
+ docroot="/path/to/docroot" specific to the context php5_execute is
+ called. For boolean ini-keys please use 0/1 as value, not
+ "On","Off",... (this will not work correctly), e.g.
+ zlib.output_compression=1 instead of zlib.output_compression="On"
+ * This is only needed if you want to configure a directory that only
+ consists of PHP scripts (same like a cgi-bin directory):
+
+<Object name="x-httpd-php">
+ObjectType fn="force-type" type="magnus-internal/x-httpd-php"
+Service fn=php5_execute [inikey=value inikey=value ...]
+</Object>
+
+ After that you can configure a directory in the Administration
+ server and assign it the style x-httpd-php. All files in it will
+ get executed as PHP. This is nice to hide PHP usage by renaming
+ files to .html.
+ * Restart your web service and apply changes
+ * Do it for each web server instance you want PHP to run
+
+ Note: More details about setting up PHP as an NSAPI filter can be
+ found here: http://benoit.noss.free.fr/php/install-php4.html
+
+ Note: The stacksize that PHP uses depends on the configuration of
+ the web server. If you get crashes with very large PHP scripts, it
+ is recommended to raise it with the Admin Server (in the section
+ "MAGNUS EDITOR").
+ __________________________________________________________________
+
+CGI environment and recommended modifications in php.ini
+
+ Important when writing PHP scripts is the fact that Sun JSWS/Sun ONE
+ WS/iPlanet/Netscape is a multithreaded web server. Because of that all
+ requests are running in the same process space (the space of the web
+ server itself) and this space has only one environment. If you want to
+ get CGI variables like PATH_INFO, HTTP_HOST etc. it is not the correct
+ way to try this in the old PHP 3.x way with getenv() or a similar way
+ (register globals to environment, $_ENV). You would only get the
+ environment of the running web server without any valid CGI variables!
+
+ Note: Why are there (invalid) CGI variables in the environment?
+
+ Answer: This is because you started the web server process from the
+ admin server which runs the startup script of the web server, you
+ wanted to start, as a CGI script (a CGI script inside of the admin
+ server!). This is why the environment of the started web server has
+ some CGI environment variables in it. You can test this by starting
+ the web server not from the administration server. Use the command
+ line as root user and start it manually - you will see there are no
+ CGI-like environment variables.
+ __________________________________________________________________
+
+Special use for error pages or self-made directory listings (PHP >= 4.3.3)
+
+ You can use PHP to generate the error pages for "404 Not Found" or
+ similar. Add the following line to the object in obj.conf for every
+ error page you want to overwrite:
+Error fn="php5_execute" code=XXX script="/path/to/script.php" [inikey=value inik
+ey=value...]
+
+ where XXX is the HTTP error code. Please delete any other Error
+ directives which could interfere with yours. If you want to place a
+ page for all errors that could exist, leave the code parameter out.
+ Your script can get the HTTP status code with $_SERVER['ERROR_TYPE'].
+
+ Another possibility is to generate self-made directory listings. Just
+ create a PHP script which displays a directory listing and replace the
+ corresponding default Service line for type="magnus-internal/directory"
+ in obj.conf with the following:
+Service fn="php5_execute" type="magnus-internal/directory" script="/path/to/scri
+pt.php" [inikey=value inikey=value...]
+
+ For both error and directory listing pages the original URI and
+ translated URI are in the variables $_SERVER['PATH_INFO'] and
+ $_SERVER['PATH_TRANSLATED'].
+ __________________________________________________________________
+
+Note about nsapi_virtual() and subrequests (PHP >= 4.3.3)
+
+ The NSAPI module now supports the nsapi_virtual() function (alias:
+ virtual()) to make subrequests on the web server and insert the result
+ in the web page. The problem is, that this function uses some
+ undocumented features from the NSAPI library.
+
+ Under Unix this is not a problem, because the module automatically
+ looks for the needed functions and uses them if available. If not,
+ nsapi_virtual() is disabled.
+
+ Under Windows limitations in the DLL handling need the use of a
+ automatic detection of the most recent ns-httpdXX.dll file. This is
+ tested for servers till version 6.1. If a newer version of the Sun
+ server is used, the detection fails and nsapi_virtual() is disabled.
+
+ If this is the case, try the following: Add the following parameter to
+ php5_init in magnus.conf/obj.conf:
+ Init fn=php5_init ... server_lib="ns-httpdXX.dll"
+
+ where XX is the correct DLL version number. To get it, look in the
+ server-root for the correct DLL name. The DLL with the biggest filesize
+ is the right one.
+
+ You can check the status by using the phpinfo() function.
+
+ Note: But be warned: Support for nsapi_virtual() is EXPERIMENTAL!!!
+ __________________________________________________________________
+
+OmniHTTPd Server
+
+ This section contains notes and hints specific to OmniHTTPd on Windows.
+
+ Note: You should read the manual installation steps first!
+
+ Warning
+
+ By using the CGI setup, your server is open to several possible
+ attacks. Please read our CGI security section to learn how to defend
+ yourself from those attacks.
+
+ You need to complete the following steps to make PHP work with
+ OmniHTTPd. This is a CGI executable setup. SAPI is supported by
+ OmniHTTPd, but some tests have shown that it is not so stable to use
+ PHP as an ISAPI module.
+
+ Important for CGI users: Read the faq on cgi.force_redirect for
+ important details. This directive needs to be set to 0.
+
+ 1. Install OmniHTTPd server.
+ 2. Right click on the blue OmniHTTPd icon in the system tray and
+ select Properties
+ 3. Click on Web Server Global Settings
+ 4. On the 'External' tab, enter: virtual = .php | actual =
+ c:\php\php.exe (use php-cgi.exe if installing PHP 5), and use the
+ Add button.
+ 5. On the Mime tab, enter: virtual = wwwserver/stdcgi | actual = .php,
+ and use the Add button.
+ 6. Click OK
+
+ Repeat steps 2 - 6 for each extension you want to associate with PHP.
+
+ __________________________________________________________________
+
+Xitami on Microsoft Windows
+
+ This section contains notes and hints specific to Xitami on Windows.
+
+ Note: You should read the manual installation steps first!
+
+ This list describes how to set up the PHP CGI binary to work with
+ Xitami on Windows.
+
+ Important for CGI users: Read the faq on cgi.force_redirect for
+ important details. This directive needs to be set to 0. If you want
+ to use $_SERVER['PHP_SELF'] you have to enable the cgi.fix_pathinfo
+ directive.
+
+ Warning
+
+ By using the CGI setup, your server is open to several possible
+ attacks. Please read our CGI security section to learn how to defend
+ yourself from those attacks.
+
+ * Make sure the web server is running, and point your browser to
+ xitamis admin console (usually http://127.0.0.1/admin), and click
+ on Configuration.
+ * Navigate to the Filters, and put the extension which PHP should
+ parse (i.e. .php) into the field File extensions (.xxx).
+ * In Filter command or script put the path and name of your PHP CGI
+ executable i.e. C:\php\php-cgi.exe.
+ * Press the 'Save' icon.
+ * Restart the server to reflect changes.
+ __________________________________________________________________
+
+Installation of extensions on Windows
+
+ After installing PHP and a web server on Windows, you will probably
+ want to install some extensions for added functionality. You can choose
+ which extensions you would like to load when PHP starts by modifying
+ your php.ini. You can also load a module dynamically in your script
+ using dl().
+
+ The DLLs for PHP extensions are prefixed with php_.
+
+ Many extensions are built into the Windows version of PHP. This means
+ additional DLL files, and the extension directive, are not used to load
+ these extensions. The Windows PHP Extensions table lists extensions
+ that require, or used to require, additional PHP DLL files. Here's a
+ list of built in extensions:
+
+ In PHP 5 (updated PHP 5.0.4), the following changes exist. Built in:
+ DOM, LibXML, Iconv, SimpleXML, SPL and SQLite. And the following are no
+ longer built in: MySQL and Overload.
+
+ The default location PHP searches for extensions is C:\php5 in PHP 5.
+ To change this setting to reflect your setup of PHP edit your php.ini
+ file:
+
+ * You will need to change the extension_dir setting to point to the
+ directory where your extensions lives, or where you have placed
+ your php_*.dll files. For example:
+
+extension_dir = C:\php\extensions
+
+ * Enable the extension(s) in php.ini you want to use by uncommenting
+ the extension=php_*.dll lines in php.ini. This is done by deleting
+ the leading ; from the extension you want to load.
+
+ Example 2-8. Enable Bzip2 extension for PHP-Windows
+// change the following line from ...
+;extension=php_bz2.dll
+
+// ... to
+extension=php_bz2.dll
+
+ * Some of the extensions need extra DLLs to work. Couple of them can
+ be found in the distribution package, in in the main folder in PHP 5,
+ but some, for example Oracle (php_oci8.dll) require DLLs which are
+ not bundled with the distribution package.
+ * Some of these DLLs are not bundled with the PHP distribution. See
+ each extensions documentation page for details. Also, read the
+ manual section titled Installation of PECL extensions for details
+ on PECL. An increasingly large number of PHP extensions are found
+ in PECL, and these extensions require a separate download.
+
+ Note: If you are running a server module version of PHP remember to
+ restart your web server to reflect your changes to php.ini.
+
+ The following table describes some of the extensions available and
+ required additional dlls.
+
+ Table 2-1. PHP Extensions
+ Extension Description Notes
+ php_bz2.dll bzip2 compression functions None
+ php_calendar.dll Calendar conversion functions
+ php_cpdf.dll ClibPDF functions None
+ php_crack.dll Crack functions None
+ php_ctype.dll ctype family functions
+ php_curl.dll CURL, Client URL library functions Requires: libeay32.dll,
+ ssleay32.dll (bundled)
+ php_db.dll DBM functions Deprecated. Use DBA instead (php_dba.dll)
+ php_dba.dll DBA: DataBase (dbm-style) Abstraction layer functions None
+ php_dbase.dll dBase functions None
+ php_dbx.dll dbx functions
+ php_exif.dll EXIF functions php_mbstring.dll. And, php_exif.dll must be
+ loaded after php_mbstring.dll in php.ini.
+ php_fdf.dll FDF: Forms Data Format functions. Requires: fdftk.dll
+ (bundled)
+ php_filepro.dll filePro functions Read-only access
+ php_ftp.dll FTP functions
+ php_gd2.dll GD library image functions GD2
+ php_gettext.dll Gettext functions, requires libintl-1.dll,
+ iconv.dll (bundled).
+ php_iconv.dll ICONV characterset conversion Requires: iconv.dll
+ php_imap.dll IMAP POP3 and NNTP functions None
+ php_interbase.dll InterBase functions Requires: gds32.dll (bundled)
+ php_ldap.dll LDAP functions requires libeay32.dll, ssleay32.dll (bundled)
+ php_mbstring.dll Multi-Byte String functions None
+ php_mcrypt.dll Mcrypt Encryption functions Requires: libmcrypt.dll
+ php_mime_magic.dll Mimetype functions Requires: magic.mime (bundled)
+ php_ming.dll Ming functions for Flash None
+ php_msql.dll mSQL functions Requires: msql.dll (bundled)
+ php_mssql.dll MSSQL functions Requires: ntwdblib.dll (bundled)
+ php_mysql.dll MySQL functions PHP >= 5.0.0, requires libmysql.dll
+ (bundled)
+ php_mysqli.dll MySQLi functions PHP >= 5.0.0, requires libmysql.dll
+ (libmysqli.dll in PHP <= 5.0.2) (bundled)
+ php_oci8.dll Oracle 8 functions Requires: Oracle 8.1+ client libraries
+ php_openssl.dll OpenSSL functions Requires: libeay32.dll (bundled)
+ php_oracle.dll Oracle functions Requires: Oracle 7 client libraries
+ php_pgsql.dll PostgreSQL functions None
+ php_printer.dll Printer functions None
+ php_shmop.dll Shared Memory functions None
+ php_snmp.dll SNMP get and walk functions NT only!
+ php_soap.dll SOAP functions PHP >= 5.0.0
+ php_sockets.dll Socket functions None
+ php_sybase_ct.dll Sybase functions Requires: Sybase client libraries
+ php_tidy.dll Tidy functions PHP >= 5.0.0
+ php_tokenizer.dll Tokenizer functions Built in since PHP 4.3.0
+ php_xmlrpc.dll XML-RPC functions PHP >= 4.2.1 requires: iconv.dll
+ (bundled)
+ php_xslt.dll XSLT requires libxslt.dll, iconv.dll (bundled).
+ php_zip.dll Zip File functions
+ php_zlib.dll ZLib compression functions
+ __________________________________________________________________
+
+Chapter 3. Installation of PECL extensions
+
+Introduction to PECL Installations
+
+ PECL is a repository of PHP extensions that are made available to you
+ via the PEAR packaging system. This section of the manual is intended
+ to demonstrate how to obtain and install PECL extensions.
+
+ These instructions assume /your/phpsrcdir/ is the path to the PHP
+ source distribution, and that extname is the name of the PECL
+ extension. Adjust accordingly. These instructions also assume a
+ familiarity with the pear command. The information in the PEAR manual
+ for the pear command also applies to the pecl command.
+
+ To be useful, a shared extension must be built, installed, and loaded.
+ The methods described below provide you with various instructions on
+ how to build and install the extensions, but they do not automatically
+ load them. Extensions can be loaded by adding an extension directive.
+ To this php.ini file, or through the use of the dl() function.
+
+ When building PHP modules, it's important to have known-good versions
+ of the required tools (autoconf, automake, libtool, etc.) See the
+ SVN Instructions for details on the required tools, and required
+ versions.
+ __________________________________________________________________
+
+Downloading PECL extensions
+
+ There are several options for downloading PECL extensions, such as:
+
+ * http://pecl.php.net
+ The PECL web site contains information about the different
+ extensions that are offered by the PHP Development Team. The
+ information available here includes: ChangeLog, release notes,
+ requirements and other similar details.
+ * pecl download extname
+ PECL extensions that have releases listed on the PECL web site are
+ available for download and installation using the pecl command.
+ Specific revisions may also be specified.
+ * SVN
+ Most PECL extensions also reside in SVN. A web-based view may be
+ seen at http://svn.php.net/pecl/. To download straight from SVN,
+ the following sequence of commands may be used.
+
+$ svn co http://svn.php.net/repository/pecl/<extname>/trunk
+
+ * Windows downloads
+ Windows users may find compiled PECL binaries by downloading the
+ Collection of PECL modules from the PHP Downloads page, or by
+ retrieving a PECL Snapshot or an extension DLL on PECL4WIN. To
+ compile PHP under Windows, read the appropriate chapter.
+ __________________________________________________________________
+
+PECL for Windows users
+
+ As with any other PHP extension DLL, installation is as simple as
+ copying the PECL extension DLLs into the extension_dir folder and
+ loading them from php.ini. For example, add the following line to your
+ php.ini:
+
+ extension=php_extname.dll
+
+ After doing this, restart the web server.
+ __________________________________________________________________
+
+Compiling shared PECL extensions with the pecl command
+
+ PECL makes it easy to create shared PHP extensions. Using the pecl
+ command, do the following:
+
+ $ pecl install extname
+
+ This will download the source for extname, compile, and install
+ extname.so into your extension_dir. extname.so may then be loaded via
+ php.ini
+
+ By default, the pecl command will not install packages that are marked
+ with the alpha or beta state. If no stable packages are available, you
+ may install a beta package using the following command:
+
+ $ pecl install extname-beta
+
+ You may also install a specific version using this variant:
+
+ $ pecl install extname-0.1
+ __________________________________________________________________
+
+Compiling shared PECL extensions with phpize
+
+ Sometimes, using the pecl installer is not an option. This could be
+ because you're behind a firewall, or it could be because the extension
+ you want to install is not available as a PECL compatible package, such
+ as unreleased extensions from SVN. If you need to build such an
+ extension, you can use the lower-level build tools to perform the build
+ manually.
+
+ The phpize command is used to prepare the build environment for a PHP
+ extension. In the following sample, the sources for an extension are in
+ a directory named extname:
+
+$ cd extname
+$ phpize
+$ ./configure
+$ make
+# make install
+
+ A successful install will have created extname.so and put it into the
+ PHP extensions directory. You'll need to and adjust php.ini and add an
+ extension=extname.so line before you can use the extension.
+
+ If the system is missing the phpize command, and precompiled packages
+ (like RPM's) are used, be sure to also install the appropriate devel
+ version of the PHP package as they often include the phpize command
+ along with the appropriate header files to build PHP and its
+ extensions.
+
+ Execute phpize --help to display additional usage information.
+ __________________________________________________________________
+
+Compiling PECL extensions statically into PHP
+
+ You might find that you need to build a PECL extension statically into
+ your PHP binary. To do this, you'll need to place the extension source
+ under the php-src/ext/ directory and tell the PHP build system to
+ regenerate its configure script.
+
+$ cd /your/phpsrcdir/ext
+$ pecl download extname
+$ gzip -d < extname.tgz | tar -xvf -
+$ mv extname-x.x.x extname
+
+ This will result in the following directory:
+
+ /your/phpsrcdir/ext/extname
+
+ From here, force PHP to rebuild the configure script, and then build
+ PHP as normal:
+
+$ cd /your/phpsrcdir
+$ rm configure
+$ ./buildconf --force
+$ ./configure --help
+$ ./configure --with-extname --enable-someotherext --with-foobar
+$ make
+$ make install
+
+ Note: To run the 'buildconf' script you need autoconf 2.13 and
+ automake 1.4+ (newer versions of autoconf may work, but are not
+ supported).
+
+ Whether --enable-extname or --with-extname is used depends on the
+ extension. Typically an extension that does not require external
+ libraries uses --enable. To be sure, run the following after buildconf:
+
+ $ ./configure --help | grep extname
+ __________________________________________________________________
+
+Chapter 4. Problems?
+
+Read the FAQ
+
+ Some problems are more common than others. The most common ones are
+ listed in the PHP FAQ, part of this manual.
+ __________________________________________________________________
+
+Other problems
+
+ If you are still stuck, someone on the PHP installation mailing list
+ may be able to help you. You should check out the archive first, in
+ case someone already answered someone else who had the same problem as
+ you. The archives are available from the support page on
+ http://www.php.net/support.php. To subscribe to the PHP installation
+ mailing list, send an empty mail to
+ php-install-subscribe@lists.php.net. The mailing list address is
+ php-install@lists.php.net.
+
+ If you want to get help on the mailing list, please try to be precise
+ and give the necessary details about your environment (which operating
+ system, what PHP version, what web server, if you are running PHP as
+ CGI or a server module, safe mode, etc...), and preferably enough code
+ to make others able to reproduce and test your problem.
+ __________________________________________________________________
+
+Bug reports
+
+ If you think you have found a bug in PHP, please report it. The PHP
+ developers probably don't know about it, and unless you report it,
+ chances are it won't be fixed. You can report bugs using the
+ bug-tracking system at http://bugs.php.net/. Please do not send bug
+ reports in mailing list or personal letters. The bug system is also
+ suitable to submit feature requests.
+
+ Read the How to report a bug document before submitting any bug
+ reports!
+ __________________________________________________________________
+
+Chapter 5. Runtime Configuration
+
+The configuration file
+
+ The configuration file (called php3.ini in PHP 3, and simply php.ini as
+ of PHP 4) is read when PHP starts up. For the server module versions of
+ PHP, this happens only once when the web server is started. For the CGI
+ and CLI version, it happens on every invocation.
+
+ php.ini is searched in these locations (in order):
+
+ * SAPI module specific location (PHPIniDir directive in Apache 2, -c
+ command line option in CGI and CLI, php_ini parameter in NSAPI,
+ PHP_INI_PATH environment variable in THTTPD)
+ * The PHPRC environment variable. Before PHP 5.2.0 this was checked
+ after the registry key mentioned below.
+ * As of PHP 5.2.0, the following registry locations are searched in
+ order: HKEY_LOCAL_MACHINE\SOFTWARE\PHP\x.y.z\IniFilePath,
+ HKEY_LOCAL_MACHINE\SOFTWARE\PHP\x.y\IniFilePath and
+ HKEY_LOCAL_MACHINE\SOFTWARE\PHP\x\IniFilePath, where x, y and z
+ mean the PHP major, minor and release versions.
+ * HKEY_LOCAL_MACHINE\SOFTWARE\PHP\IniFilePath (Windows Registry
+ location)
+ * Current working directory (except CLI)
+ * The web server's directory (for SAPI modules), or directory of PHP
+ (otherwise in Windows)
+ * Windows directory (C:\windows or C:\winnt) (for Windows), or
+ --with-config-file-path compile time option
+
+ If php-SAPI.ini exists (where SAPI is used SAPI, so the filename is
+ e.g. php-cli.ini or php-apache.ini), it's used instead of php.ini. SAPI
+ name can be determined by php_sapi_name().
+
+ Note: The Apache web server changes the directory to root at startup
+ causing PHP to attempt to read php.ini from the root filesystem if
+ it exists.
+
+ The php.ini directives handled by extensions are documented
+ respectively on the pages of the extensions themselves. The list of the
+ core directives is available in the appendix. Probably not all PHP
+ directives are documented in the manual though. For a complete list of
+ directives available in your PHP version, please read your well
+ commented php.ini file. Alternatively, you may find the latest
+ php.ini from SVN helpful too.
+
+ Example 5-1. php.ini example
+; any text on a line after an unquoted semicolon (;) is ignored
+[php] ; section markers (text within square brackets) are also ignored
+; Boolean values can be set to either:
+; true, on, yes
+; or false, off, no, none
+html_errors = off
+track_errors = yes
+
+; you can enclose strings in double-quotes
+include_path = ".:/usr/local/lib/php"
+
+; backslashes are treated the same as any other character
+include_path = ".;c:\php\lib"
+
+ Since PHP 5.1.0, it is possible to refer to existing .ini variables
+ from within .ini files. Example: open_basedir = ${open_basedir}
+ ":/new/dir".
+ __________________________________________________________________
+
+How to change configuration settings
+
+Running PHP as an Apache module
+
+ When using PHP as an Apache module, you can also change the
+ configuration settings using directives in Apache configuration files
+ (e.g. httpd.conf) and .htaccess files. You will need "AllowOverride
+ Options" or "AllowOverride All" privileges to do so.
+
+ With PHP 4 and PHP 5, there are several Apache directives that allow
+ you to change the PHP configuration from within the Apache
+ configuration files. For a listing of which directives are PHP_INI_ALL,
+ PHP_INI_PERDIR, or PHP_INI_SYSTEM, have a look at the List of php.ini
+ directives appendix.
+
+ Note: With PHP 3, there are Apache directives that correspond to
+ each configuration setting in the php3.ini name, except the name is
+ prefixed by "php3_".
+
+ php_value name value
+ Sets the value of the specified directive. Can be used only with
+ PHP_INI_ALL and PHP_INI_PERDIR type directives. To clear a
+ previously set value use none as the value.
+
+ Note: Don't use php_value to set boolean values. php_flag (see
+ below) should be used instead.
+
+ php_flag name on|off
+ Used to set a boolean configuration directive. Can be used only
+ with PHP_INI_ALL and PHP_INI_PERDIR type directives.
+
+ php_admin_value name value
+ Sets the value of the specified directive. This can not be used
+ in .htaccess files. Any directive type set with php_admin_value
+ can not be overridden by .htaccess or virtualhost directives. To
+ clear a previously set value use none as the value.
+
+ php_admin_flag name on|off
+ Used to set a boolean configuration directive. This can not be
+ used in .htaccess files. Any directive type set with
+ php_admin_flag can not be overridden by .htaccess or virtualhost
+ directives.
+
+ Example 5-2. Apache configuration example
+<IfModule mod_php5.c>
+ php_value include_path ".:/usr/local/lib/php"
+ php_admin_flag engine on
+</IfModule>
+
+ Caution
+
+ PHP constants do not exist outside of PHP. For example, in httpd.conf
+ you can not use PHP constants such as E_ALL or E_NOTICE to set the
+ error_reporting directive as they will have no meaning and will
+ evaluate to 0. Use the associated bitmask values instead. These
+ constants can be used in php.ini
+ __________________________________________________________________
+
+Changing PHP configuration via the Windows registry
+
+ When running PHP on Windows, the configuration values can be modified
+ on a per-directory basis using the Windows registry. The configuration
+ values are stored in the registry key HKLM\SOFTWARE\PHP\Per Directory
+ Values, in the sub-keys corresponding to the path names. For example,
+ configuration values for the directory c:\inetpub\wwwroot would be
+ stored in the key HKLM\SOFTWARE\PHP\Per Directory
+ Values\c\inetpub\wwwroot. The settings for the directory would be
+ active for any script running from this directory or any subdirectory
+ of it. The values under the key should have the name of the PHP
+ configuration directive and the string value. PHP constants in the
+ values are not parsed. However, only configuration values changeable in
+ PHP_INI_USER can be set this way, PHP_INI_PERDIR values can not.
+ __________________________________________________________________
+
+Other interfaces to PHP
+
+ Regardless of how you run PHP, you can change certain values at runtime
+ of your scripts through ini_set(). See the documentation on the
+ ini_set() page for more information.
+
+ If you are interested in a complete list of configuration settings on
+ your system with their current values, you can execute the phpinfo()
+ function, and review the resulting page. You can also access the values
+ of individual configuration directives at runtime using ini_get() or
+ get_cfg_var().
+ __________________________________________________________________
+
+Chapter 6. Installation FAQ
+
+ This section holds common questions about the way to install PHP. PHP
+ is available for almost any OS (except maybe for MacOS before OSX), and
+ almost any web server.
+
+ To install PHP, follow the instructions in Installing PHP.
+
+ 1. Why shouldn't I use Apache2 with a threaded MPM in a production
+ environment?
+
+ 2. Unix/Windows: Where should my php.ini file be located?
+ 3. Unix: I installed PHP, but every time I load a document, I get the
+ message 'Document Contains No Data'! What's going on here?
+
+ 4. Unix: I installed PHP using RPMS, but Apache isn't processing the
+ PHP pages! What's going on here?
+
+ 5. Unix: I installed PHP 3 using RPMS, but it doesn't compile with the
+ database support I need! What's going on here?
+
+ 6. Unix: I patched Apache with the FrontPage extensions patch, and
+ suddenly PHP stopped working. Is PHP incompatible with the
+ Apache FrontPage extensions?
+
+ 7. Unix/Windows: I have installed PHP, but when I try to access a PHP
+ script file via my browser, I get a blank screen.
+
+ 8. Unix/Windows: I have installed PHP, but when try to access a PHP
+ script file via my browser, I get a server 500 error.
+
+ 9. Some operating systems: I have installed PHP without errors, but
+ when I try to start apache I get undefined symbol errors:
+
+[mybox:user /src/php5] root# apachectl configtest
+ apachectl: /usr/local/apache/bin/httpd Undefined symbols:
+ _compress
+ _uncompress
+
+ 10. Windows: I have installed PHP, but when I to access a PHP script
+ file via my browser, I get the error:
+
+cgi error:
+ The specified CGI application misbehaved by not
+ returning a complete set of HTTP headers.
+ The headers it did return are:
+
+ 11. Windows: I've followed all the instructions, but still can't get
+ PHP and IIS to work together!
+
+ 12. When running PHP as CGI with IIS, PWS, OmniHTTPD or Xitami, I get
+ the following error: Security Alert! PHP CGI cannot be accessed
+ directly..
+
+ 13. How do I know if my php.ini is being found and read? It seems like
+ it isn't as my changes aren't being implemented.
+
+ 14. How do I add my PHP directory to the PATH on Windows?
+ 15. How do I make the php.ini file available to PHP on windows?
+ 16. Is it possible to use Apache content negotiation (MultiViews
+ option) with PHP?
+
+ 17. Is PHP limited to process GET and POST request methods only?
+
+ 1. Why shouldn't I use Apache2 with a threaded MPM in a production
+ environment?
+
+ PHP is glue. It is the glue used to build cool web applications by
+ sticking dozens of 3rd-party libraries together and making it all
+ appear as one coherent entity through an intuitive and easy to learn
+ language interface. The flexibility and power of PHP relies on the
+ stability and robustness of the underlying platform. It needs a working
+ OS, a working web server and working 3rd-party libraries to glue
+ together. When any of these stop working PHP needs ways to identify the
+ problems and fix them quickly. When you make the underlying framework
+ more complex by not having completely separate execution threads,
+ completely separate memory segments and a strong sandbox for each
+ request to play in, feet of clay are introduced into PHP's system.
+
+ If you feel you have to use a threaded MPM, look at a FastCGI
+ configuration where PHP is running in its own memory space.
+
+ And finally, this warning against using a threaded MPM is not as strong
+ for Windows systems because most libraries on that platform tend to be
+ threadsafe.
+
+ 2. Unix/Windows: Where should my php.ini file be located?
+
+ By default on Unix it should be in /usr/local/lib which is
+ <install-path>/lib. Most people will want to change this at
+ compile-time with the --with-config-file-path flag. You would, for
+ example, set it with something like:
+ --with-config-file-path=/etc
+
+ And then you would copy php.ini-production from the distribution to
+ /etc/php.ini and edit it to make any local changes you want.
+ --with-config-file-scan-dir=PATH
+
+ On Windows the default path for the php.ini file is the Windows
+ directory. If you're using the Apache webserver, php.ini is first
+ searched in the Apaches install directory, e.g. c:\program files\apache
+ group\apache. This way you can have different php.ini files for
+ different versions of Apache on the same machine.
+
+ See also the chapter about the configuration file.
+
+ 3. Unix: I installed PHP, but every time I load a document, I get the
+ message 'Document Contains No Data'! What's going on here?
+
+ This probably means that PHP is having some sort of problem and is
+ core-dumping. Look in your server error log to see if this is the case,
+ and then try to reproduce the problem with a small test case. If you
+ know how to use 'gdb', it is very helpful when you can provide a
+ backtrace with your bug report to help the developers pinpoint the
+ problem. If you are using PHP as an Apache module try something like:
+
+ * Stop your httpd processes
+ * gdb httpd
+ * Stop your httpd processes
+ * > run -X -f /path/to/httpd.conf
+ * Then fetch the URL causing the problem with your browser
+ * > run -X -f /path/to/httpd.conf
+ * If you are getting a core dump, gdb should inform you of this now
+ * type: bt
+ * You should include your backtrace in your bug report. This should
+ be submitted to http://bugs.php.net/
+
+ If your script uses the regular expression functions (ereg() and
+ friends), you should make sure that you compiled PHP and Apache with
+ the same regular expression package. This should happen automatically
+ with PHP and Apache 1.3.x
+
+ 4. Unix: I installed PHP using RPMS, but Apache isn't processing the
+ PHP pages! What's going on here?
+
+ Assuming you installed both Apache and PHP from RPM packages, you need
+ to uncomment or add some or all of the following lines in your
+ httpd.conf file:
+# Extra Modules
+AddModule mod_php.c
+AddModule mod_php3.c
+AddModule mod_perl.c
+
+# Extra Modules
+LoadModule php_module modules/mod_php.so
+LoadModule perl_module modules/libperl.so
+
+ And add:
+AddType application/x-httpd-php3 .php3 # for PHP 3
+AddType application/x-httpd-php .php # for PHP 4
+
+ ... to the global properties, or to the properties of the VirtualDomain
+ you want to have PHP support added to.
+
+ 5. Unix: I installed PHP 3 using RPMS, but it doesn't compile with the
+ database support I need! What's going on here?
+
+ Due to the way PHP 3 built, it is not easy to build a complete flexible
+ PHP RPM. This issue is addressed in PHP 4. For PHP 3, we currently
+ suggest you use the mechanism described in the INSTALL.REDHAT file in
+ the PHP distribution. If you insist on using an RPM version of PHP 3,
+ read on...
+
+ The RPM packagers are setting up the RPMS to install without database
+ support to simplify installations and because RPMS use /usr/ instead of
+ the standard /usr/local/ directory for files. You need to tell the RPM
+ spec file which databases to support and the location of the top-level
+ of your database server.
+
+ This example will explain the process of adding support for the popular
+ MySQL database server, using the mod installation for Apache.
+
+ Of course all of this information can be adjusted for any database
+ server that PHP supports. We will assume you installed MySQL and Apache
+ completely with RPMS for this example as well.
+
+ * First remove mod_php3 :
+
+rpm -e mod_php3
+
+ * Then get the source rpm and INSTALL it, NOT --rebuild
+
+rpm -Uvh mod_php3-3.0.5-2.src.rpm
+
+ * Then edit the /usr/src/redhat/SPECS/mod_php3.spec file
+ In the %build section add the database support you want, and the
+ path.
+ For MySQL you would add --with-mysql=/usr The %build section will
+ look something like this:
+
+./configure --prefix=/usr \
+--with-apxs=/usr/sbin/apxs \
+--with-config-file-path=/usr/lib \
+--enable-debug=no \
+--enable-safe-mode \
+--with-exec-dir=/usr/bin \
+--with-mysql=/usr \
+--with-system-regex
+
+ * Once this modification is made then build the binary rpm as
+ follows:
+
+rpm -bb /usr/src/redhat/SPECS/mod_php3.spec
+
+ * Then install the rpm
+
+rpm -ivh /usr/src/redhat/RPMS/i386/mod_php3-3.0.5-2.i386.rpm
+
+ Make sure you restart Apache, and you now have PHP 3 with MySQL support
+ using RPM's. Note that it is probably much easier to just build from
+ the distribution tarball of PHP 3 and follow the instructions in
+ INSTALL.REDHAT found in that distribution.
+
+ 6. Unix: I patched Apache with the FrontPage extensions patch, and
+ suddenly PHP stopped working. Is PHP incompatible with the Apache
+ FrontPage extensions?
+
+ No, PHP works fine with the FrontPage extensions. The problem is that
+ the FrontPage patch modifies several Apache structures, that PHP relies
+ on. Recompiling PHP (using 'make clean ; make') after the FP patch is
+ applied would solve the problem.
+
+ 7. Unix/Windows: I have installed PHP, but when I try to access a PHP
+ script file via my browser, I get a blank screen.
+
+ Do a 'view source' in the web browser and you will probably find that
+ you can see the source code of your PHP script. This means that the web
+ server did not send the script to PHP for interpretation. Something is
+ wrong with the server configuration - double check the server
+ configuration against the PHP installation instructions.
+
+ 8. Unix/Windows: I have installed PHP, but when try to access a PHP
+ script file via my browser, I get a server 500 error.
+
+ Something went wrong when the server tried to run PHP. To get to see a
+ sensible error message, from the command line, change to the directory
+ containing the PHP executable (php.exe on Windows) and run php -i. If
+ PHP has any problems running, then a suitable error message will be
+ displayed which will give you a clue as to what needs to be done next.
+ If you get a screen full of HTML codes (the output of the phpinfo()
+ function) then PHP is working, and your problem may be related to your
+ server configuration which you should double check.
+
+ 9. Some operating systems: I have installed PHP without errors, but
+ when I try to start apache I get undefined symbol errors:
+[mybox:user /src/php5] root# apachectl configtest
+ apachectl: /usr/local/apache/bin/httpd Undefined symbols:
+ _compress
+ _uncompress
+
+ This has actually nothing to do with PHP, but with the MySQL client
+ libraries. Some need --with-zlib, others do not. This is also covered
+ in the MySQL FAQ.
+
+ 10. Windows: I have installed PHP, but when I to access a PHP script
+ file via my browser, I get the error:
+cgi error:
+ The specified CGI application misbehaved by not
+ returning a complete set of HTTP headers.
+ The headers it did return are:
+
+ This error message means that PHP failed to output anything at all. To
+ get to see a sensible error message, from the command line, change to
+ the directory containing the PHP executable (php.exe on Windows) and
+ run php -i. If PHP has any problems running, then a suitable error
+ message will be displayed which will give you a clue as to what needs
+ to be done next. If you get a screen full of HTML codes (the output of
+ the phpinfo() function) then PHP is working.
+
+ Once PHP is working at the command line, try accessing the script via
+ the browser again. If it still fails then it could be one of the
+ following:
+
+ * File permissions on your PHP script, php.exe, php5ts.dll, php.ini
+ or any PHP extensions you are trying to load are such that the
+ anonymous internet user ISUR_<machinename> cannot access them.
+ * The script file does not exist (or possibly isn't where you think
+ it is relative to your web root directory). Note that for IIS you
+ can trap this error by ticking the 'check file exists' box when
+ setting up the script mappings in the Internet Services Manager. If
+ a script file does not exist then the server will return a 404
+ error instead. There is also the additional benefit that IIS will
+ do any authentication required for you based on the NTLanMan
+ permissions on your script file.
+
+ 11. Windows: I've followed all the instructions, but still can't get
+ PHP and IIS to work together!
+
+ Make sure any user who needs to run a PHP script has the rights to run
+ php.exe! IIS uses an anonymous user which is added at the time IIS is
+ installed. This user needs rights to php.exe. Also, any authenticated
+ user will also need rights to execute php.exe. And for IIS4 you need to
+ tell it that PHP is a script engine. Also, you will want to read this
+ faq.
+
+ 12. When running PHP as CGI with IIS, PWS, OmniHTTPD or Xitami, I get
+ the following error: Security Alert! PHP CGI cannot be accessed
+ directly..
+
+ You must set the cgi.force_redirect directive to 0. It defaults to 1 so
+ be sure the directive isn't commented out (with a ;). Like all
+ directives, this is set in php.ini
+
+ Because the default is 1, it's critical that you're 100% sure that the
+ correct php.ini file is being read. Read this faq for details.
+
+ 13. How do I know if my php.ini is being found and read? It seems like
+ it isn't as my changes aren't being implemented.
+
+ To be sure your php.ini is being read by PHP, make a call to phpinfo()
+ and near the top will be a listing called Configuration File (php.ini).
+ This will tell you where PHP is looking for php.ini and whether or not
+ it's being read. If just a directory PATH exists than it's not being
+ read and you should put your php.ini in that directory. If php.ini is
+ included within the PATH than it is being read.
+
+ If php.ini is being read and you're running PHP as a module, then be
+ sure to restart your web server after making changes to php.ini
+
+ 14. How do I add my PHP directory to the PATH on Windows?
+
+ On Windows NT, 2000, XP and 2003:
+
+ * Go to Control Panel and open the System icon (Start -> Settings ->
+ Control Panel -> System, or just Start -> Control Panel -> System
+ for Windows XP/2003)
+ * Go to the Advanced tab
+ * Click on the 'Environment Variables' button
+ * Look into the 'System Variables' pane
+ * Find the Path entry (you may need to scroll to find it)
+ * Double click on the Path entry
+ * Enter your PHP directory at the end, including ';' before (e.g.
+ ;C:\php)
+ * Press OK and restart your computer
+
+ On Windows 98/Me you need to edit the autoexec.bat file:
+
+ * Open the Notepad (Start -> Run and enter notepad)
+ * Open the C:\autoexec.bat file
+ * Locate the line with PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;..... and
+ add: ;C:\php to the end of the line
+ * Save the file and restart your computer
+
+ Note: Be sure to reboot after following the steps above to ensure
+ that the PATH changes are applied.
+
+ The PHP manual used to promote the copying of files into the Windows
+ system directory, this is because this directory (C:\Windows, C:\WINNT,
+ etc.) is by default in the systems PATH. Copying files into the Windows
+ system directory has long since been deprecated and may cause problems.
+
+ 15. How do I make the php.ini file available to PHP on windows?
+
+ There are several ways of doing this. If you are using Apache, read
+ their installation specific instructions (Apache 1, Apache 2),
+ otherwise you must set the PHPRC environment variable:
+
+ On Windows NT, 2000, XP and 2003:
+
+ * Go to Control Panel and open the System icon (Start -> Settings ->
+ Control Panel -> System, or just Start -> Control Panel -> System
+ for Windows XP/2003)
+ * Go to the Advanced tab
+ * Click on the 'Environment Variables' button
+ * Look into the 'System variables' pane
+ * Click on 'New' and enter 'PHPRC' as the variable name and the
+ directory where php.ini is located as the variable value (e.g.
+ C:\php)
+ * Press OK and restart your computer
+
+ On Windows 98/Me you need to edit the autoexec.bat file:
+
+ * Open the Notepad (Start -> Run and enter notepad)
+ * Open the C:\autoexec.bat file
+ * Add a new line to the end of the file: set PHPRC=C:\php (replace
+ C:\php with the directory where php.ini is located). Please note
+ that the path cannot contain spaces. For instance, if you have
+ installed PHP in C:\Program Files\PHP, you would enter
+ C:\PROGRA~1\PHP instead.
+ * Save the file and restart your computer
+
+ 16. Is it possible to use Apache content negotiation (MultiViews
+ option) with PHP?
+
+ If links to PHP files include extension, everything works perfect. This
+ FAQ is only for the case when links to PHP files don't include
+ extension and you want to use content negotiation to choose PHP files
+ from URL with no extension. In this case, replace the line AddType
+ application/x-httpd-php .php with:
+# PHP 4
+AddHandler php-script php
+AddType text/html php
+
+# PHP 5
+AddHandler php5-script php
+AddType text/html php
+
+ This solution doesn't work for Apache 1 as PHP module doesn't catch
+ php-script.
+
+ 17. Is PHP limited to process GET and POST request methods only?
+
+ No, it is possible to handle any request method, e.g. CONNECT. Proper
+ response status can be sent with header(). If only GET and POST methods
+ should be handled, it can be achieved with this Apache configuration:
+<LimitExcept GET POST>
+Deny from all
+</LimitExcept>
diff --git a/win32/param.h b/win32/param.h
new file mode 100644
index 0000000..3d0da1e
--- /dev/null
+++ b/win32/param.h
@@ -0,0 +1,16 @@
+
+/*****************************************************************************
+ * *
+ * sys/param.c *
+ * *
+ * Freely redistributable and modifiable. Use at your own risk. *
+ * *
+ * Copyright 1994 The Downhill Project *
+ * *
+ *****************************************************************************/
+#ifndef MAXPATHLEN
+#define MAXPATHLEN _MAX_PATH
+#endif
+#define MAXHOSTNAMELEN 64
+#define howmany(x,y) (((x)+((y)-1))/(y))
+#define roundup(x,y) ((((x)+((y)-1))/(y))*(y))
diff --git a/win32/php5.dsp b/win32/php5.dsp
new file mode 100644
index 0000000..0b5b9a6
--- /dev/null
+++ b/win32/php5.dsp
@@ -0,0 +1,134 @@
+# Microsoft Developer Studio Project File - Name="php5" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=php5 - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "php5.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "php5.mak" CFG="php5 - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "php5 - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "php5 - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE "php5 - Win32 Release_inline" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "php5 - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "..\Release"
+# PROP Intermediate_Dir "..\Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\Zend" /I "..\regex\\" /I "..\..\bindlib_w32" /I "..\TSRM" /D "NDEBUG" /D "_CONSOLE" /D ZEND_DEBUG=0 /D "MSVC5" /D "WIN32" /D "_MBCS" /D "ZEND_WIN32" /D "PHP_WIN32" /Fr /FD /c
+# SUBTRACT CPP /YX /Yc /Yu
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 php5nts.lib winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:3.0 /subsystem:console /machine:I386 /nodefaultlib:"libc.lib" /out:"..\Release\php.exe" /libpath:"..\Release"
+
+!ELSEIF "$(CFG)" == "php5 - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "c:\php-fcgi"
+# PROP Intermediate_Dir "..\Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "..\main" /I "..\Zend" /I "..\regex\\" /I "..\..\bindlib_w32" /I "..\TSRM" /D "DEBUG" /D "_DEBUG" /D "_CONSOLE" /D "MSVC5" /D "PHP_WIN32" /D ZEND_DEBUG=1 /D "ZEND_WIN32" /D "WIN32" /D "_MBCS" /FR /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /i "c:\include" /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5nts_debug.lib /nologo /version:4.0 /subsystem:console /debug /machine:I386 /nodefaultlib:"libcd" /nodefaultlib:"libcmt" /out:"c:\php-fcgi\php.exe" /pdbtype:sept /libpath:"..\Debug"
+# SUBTRACT LINK32 /pdb:none
+
+!ELSEIF "$(CFG)" == "php5 - Win32 Release_inline"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "php5___Win32_Release_inline"
+# PROP BASE Intermediate_Dir "php5___Win32_Release_inline"
+# PROP BASE Ignore_Export_Lib 0
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "..\Release_inline"
+# PROP Intermediate_Dir "..\Release_inline"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "Zend" /I "." /I "regex\\" /I "..\bindlib_w32" /D "NDEBUG" /D "MSVC5" /D "_CONSOLE" /D "WIN32" /D "_MBCS" /D ZEND_DEBUG=0 /Fr /FD /c
+# SUBTRACT BASE CPP /YX /Yc /Yu
+# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\Zend" /I "..\regex\\" /I "..\..\bindlib_w32" /I "..\TSRM" /D "NDEBUG" /D "_CONSOLE" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "MSVC5" /D "WIN32" /D "_MBCS" /D "ZEND_WIN32" /D "PHP_WIN32" /Fr /FD /c
+# SUBTRACT CPP /YX /Yc /Yu
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 php5nts.lib winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:3.0 /subsystem:console /machine:I386 /nodefaultlib:"libc.lib" /out:"Release\php.exe" /libpath:"Release"
+# ADD LINK32 php5nts.lib winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:3.0 /subsystem:console /machine:I386 /nodefaultlib:"libc.lib" /out:"..\Release\php.exe" /libpath:"..\Release_inline"
+
+!ENDIF
+
+# Begin Target
+
+# Name "php5 - Win32 Release"
+# Name "php5 - Win32 Debug"
+# Name "php5 - Win32 Release_inline"
+# Begin Group "Source Files"
+
+# PROP Default_Filter ".c"
+# Begin Source File
+
+SOURCE=..\sapi\cgi\cgi_main.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\sapi\cgi\getopt.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter ".h"
+# End Group
+# End Target
+# End Project
diff --git a/win32/php5.dsw b/win32/php5.dsw
new file mode 100644
index 0000000..d6efc98
--- /dev/null
+++ b/win32/php5.dsw
@@ -0,0 +1,107 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "TSRM"=..\TSRM\TSRM.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "Zend"=..\Zend\Zend.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name TSRM
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "fastcgi"=..\sapi\fastcgi\fastcgi.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name php5dll
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name TSRM
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name Zend
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "php5"=.\php5.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name php5dll
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name Zend
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name TSRM
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "php5dll"=.\php5dll.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name Zend
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libmysql
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name TSRM
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/win32/php5dll.dsp b/win32/php5dll.dsp
new file mode 100644
index 0000000..2216d7d
--- /dev/null
+++ b/win32/php5dll.dsp
@@ -0,0 +1,1651 @@
+# Microsoft Developer Studio Project File - Name="php5dll" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=php5dll - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "php5dll.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "php5dll.mak" CFG="php5dll - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "php5dll - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "php5dll - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "php5dll - Win32 Release_inline" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "php5dll - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "c:\php-fcgi\"
+# PROP Intermediate_Dir "..\Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP5DLLTS_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "PHP5DLLTS_EXPORTS" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "SAPI_EXPORTS" /D "TSRM_EXPORTS" /D "MSVC5" /D "PHP_WIN32" /D ZEND_DEBUG=1 /D "ZEND_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x40d /d "_DEBUG"
+# ADD RSC /l 0x40d /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Zend.lib resolv.lib TSRM.lib /nologo /dll /debug /machine:I386 /nodefaultlib:"libcmt" /nodefaultlib:"libc" /nodefaultlib:"libcmtd" /out:"c:\php-fcgi\php5nts_debug.dll" /pdbtype:sept /libpath:"..\TSRM\Debug" /libpath:"..\Zend\Debug" /libpath:"..\..\bindlib_w32\Debug"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "..\Release"
+# PROP Intermediate_Dir "..\Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP5DLLTS_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\Zend" /I "..\regex" /I "..\..\bindlib_w32" /I "..\TSRM" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "PHP5DLL_EXPORTS" /D "PHP_EXPORTS" /D "SAPI_EXPORTS" /D "LIBZEND_EXPORTS" /D ZEND_DEBUG=0 /D "MSVC5" /D "WIN32" /D "_MBCS" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x40d /d "NDEBUG"
+# ADD RSC /l 0x40d /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Zend.lib resolv.lib tsrm.lib /nologo /dll /machine:I386 /nodefaultlib:"libc.lib" /out:"..\Release\php5nts.dll" /libpath:"..\Zend\Release" /libpath:"..\TSRM\Release_TS" /libpath:"..\..\bindlib_w32\Release"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "php5dll___Win32_Release_inline"
+# PROP BASE Intermediate_Dir "php5dll___Win32_Release_inline"
+# PROP BASE Ignore_Export_Lib 0
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "..\Release_inline"
+# PROP Intermediate_Dir "..\Release_inline"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "Zend" /I "." /I "regex" /I "..\bindlib_w32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "PHP5DLLTS_EXPORTS" /D "MSVC5" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "SAPI_EXPORTS" /D ZEND_DEBUG=0 /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "PHP5DLLTS_EXPORTS" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "SAPI_EXPORTS" /D "TSRM_EXPORTS" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "MSVC5" /D "WIN32" /D "_MBCS" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x40d /d "NDEBUG"
+# ADD RSC /l 0x40d /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Zend.lib resolv.lib /nologo /dll /machine:I386 /nodefaultlib:"libc.lib" /out:"Release/php5nts.dll" /libpath:"TSRM\Release" /libpath:"Zend\Release" /libpath:"..\bindlib_w32\Release"
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Zend.lib tsrm.lib resolv.lib /nologo /dll /machine:I386 /nodefaultlib:"libc.lib" /out:"..\Release\php5nts.dll" /libpath:"..\Zend\Release_inline" /libpath:"..\TSRM\Release_TS_inline" /libpath:"..\..\bindlib_w32\Release"
+
+!ENDIF
+
+# Begin Target
+
+# Name "php5dll - Win32 Debug"
+# Name "php5dll - Win32 Release"
+# Name "php5dll - Win32 Release_inline"
+# Begin Group "Core"
+
+# PROP Default_Filter ""
+# Begin Group "Source Files"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\ext\standard\css.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\cyr_convert.c
+# End Source File
+# Begin Source File
+
+SOURCE="..\main\fopen_wrappers.c"
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\internal_functions_win32.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\main.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\mergesort.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\network.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\output.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\php_content_types.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\php_ini.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\php_logos.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\php_open_temporary_file.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\php_ticks.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\php_variables.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\proc_open.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\quot_print.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\reentrancy.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\rfc1867.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\safe_mode.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\SAPI.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\snprintf.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\spprintf.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\streams.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\memory_streams.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\user_streams.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\filters.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\user_filters.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\strlcat.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\strlcpy.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\ext\standard\config.w32.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\css.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\cyr_convert.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\getopt.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\logos.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\main.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\output.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\php.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\php_content_types.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\php_globals.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\php_ini.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\php_logos.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\php_open_temporary_file.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\php_realpath.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\php_ticks.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\php_variables.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\quot_print.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\rfc1867.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\safe_mode.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\SAPI.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\snprintf.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\spprintf.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\win95nt.h
+# End Source File
+# End Group
+# End Group
+# Begin Group "Function Modules"
+
+# PROP Default_Filter ""
+# Begin Group "Source Files No. 1"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\ext\standard\array.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\assert.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\base64.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\basic_functions.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\bcmath.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\browscap.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\crc32.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\credits.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\datetime.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\dir.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\dl.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\dns.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\exec.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\file.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\filestat.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\flock_compat.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\formatted_print.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\fsock.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\ftp_fopen_wrapper.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\head.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\html.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\http_fopen_wrapper.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\image.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\incomplete_class.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\info.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\iptc.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\lcg.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\levenshtein.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\link.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\mail.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\math.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\md5.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\metaphone.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\microtime.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\session\mod_files.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\session\mod_user.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\pack.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\pageinfo.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\php_fopen_wrapper.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\odbc\php_odbc.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\pcre\php_pcre.c
+
+!IF "$(CFG)" == "php5dll - Win32 Debug"
+
+# ADD CPP /D "STATIC"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\rand.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\reg.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\scanf.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\session\session.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\soundex.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\string.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\strnatcmp.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\syslog.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\type.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\uniqid.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\url.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\url_scanner_ex.c
+# ADD CPP /W2
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\var.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\var_unserializer.c
+# ADD CPP /W2
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\versioning.c
+# End Source File
+# End Group
+# Begin Group "Header Files No. 1"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\ext\standard\base64.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\basic_functions.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\datetime.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\dl.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\dns.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\exec.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\file.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\flock_compat.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\fsock.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\functions\global.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\head.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\html.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\md5.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\mime.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\session\mod_user.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\pageinfo.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\php_bcmath.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\php_dir.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\php_filestat.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\php_fopen_wrappers.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\ldap\php_ldap.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\php_mail.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\php_metaphone.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\odbc\php_odbc.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\pcre\php_pcre.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\php_string.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\php_syslog.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\functions\phpdir.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\functions\phpmath.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\reg.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\scanf.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\type.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\uniqid.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\url.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\url_scanner_ex.h
+# End Source File
+# End Group
+# Begin Group "Regular Expressions"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\regex\regcomp.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\regex\regerror.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\regex\regexec.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\regex\regfree.c
+# End Source File
+# End Group
+# Begin Group "PCRE"
+
+# PROP Default_Filter ""
+# Begin Group "Source Files No. 3"
+
+# PROP Default_Filter ".c"
+# Begin Source File
+
+SOURCE=..\ext\pcre\pcrelib\chartables.c
+
+!IF "$(CFG)" == "php5dll - Win32 Debug"
+
+# ADD CPP /D "STATIC"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\pcre\pcrelib\get.c
+
+!IF "$(CFG)" == "php5dll - Win32 Debug"
+
+# ADD CPP /D "STATIC"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\pcre\pcrelib\maketables.c
+
+!IF "$(CFG)" == "php5dll - Win32 Debug"
+
+# ADD CPP /D "STATIC"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\pcre\pcrelib\pcre.c
+
+!IF "$(CFG)" == "php5dll - Win32 Debug"
+
+# ADD CPP /D "STATIC"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\pcre\pcrelib\study.c
+
+!IF "$(CFG)" == "php5dll - Win32 Debug"
+
+# ADD CPP /D "STATIC"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
+
+!ENDIF
+
+# End Source File
+# End Group
+# Begin Group "Header Files No. 3"
+
+# PROP Default_Filter ".h"
+# Begin Source File
+
+SOURCE=..\ext\pcre\pcrelib\internal.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\pcre\pcrelib\pcre.h
+# End Source File
+# End Group
+# End Group
+# Begin Group "XML"
+
+# PROP Default_Filter ""
+# Begin Group "Source Files No. 4"
+
+# PROP Default_Filter ".c"
+# Begin Source File
+
+SOURCE=..\ext\ctype\ctype.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\overload\overload.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\tokenizer\tokenizer.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\wddx\wddx.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\xml\compat.c
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\xml\xml.c
+# End Source File
+# End Group
+# Begin Group "Header Files No. 4"
+
+# PROP Default_Filter ".h"
+# Begin Source File
+
+SOURCE=..\ext\xml\php_xml.h
+# End Source File
+# End Group
+# End Group
+# Begin Group "FTP"
+
+# PROP Default_Filter ""
+# Begin Group "Source Files No. 6"
+
+# PROP Default_Filter ".c"
+# Begin Source File
+
+SOURCE=..\ext\ftp\ftp.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\ftp\php_ftp.c
+# End Source File
+# End Group
+# Begin Group "Header Files No. 6"
+
+# PROP Default_Filter ".h"
+# Begin Source File
+
+SOURCE=..\ext\ftp\ftp.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\ftp\php_ftp.h
+# End Source File
+# End Group
+# End Group
+# Begin Group "Calendar"
+
+# PROP Default_Filter ""
+# Begin Group "Source Files No. 7"
+
+# PROP Default_Filter ".c"
+# Begin Source File
+
+SOURCE=..\ext\calendar\cal_unix.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\calendar\calendar.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\calendar\dow.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\calendar\easter.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\calendar\french.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\calendar\gregor.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\calendar\jewish.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\calendar\julian.c
+# End Source File
+# End Group
+# Begin Group "Header Files No. 7"
+
+# PROP Default_Filter ".h"
+# Begin Source File
+
+SOURCE=..\ext\calendar\php_calendar.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\calendar\sdncal.h
+# End Source File
+# End Group
+# End Group
+# Begin Group "bcmath"
+
+# PROP Default_Filter ""
+# Begin Group "Source Files No. 8"
+
+# PROP Default_Filter ".c"
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\add.c
+
+!IF "$(CFG)" == "php5dll - Win32 Debug"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
+
+# PROP Intermediate_Dir "..\Release_inline_bcmath"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\compare.c
+
+!IF "$(CFG)" == "php5dll - Win32 Debug"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
+
+# PROP Intermediate_Dir "..\Release_inline_bcmath"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\debug.c
+
+!IF "$(CFG)" == "php5dll - Win32 Debug"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
+
+# PROP Intermediate_Dir "..\Release_inline_bcmath"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\div.c
+
+!IF "$(CFG)" == "php5dll - Win32 Debug"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
+
+# PROP Intermediate_Dir "..\Release_inline_bcmath"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\divmod.c
+
+!IF "$(CFG)" == "php5dll - Win32 Debug"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
+
+# PROP Intermediate_Dir "..\Release_inline_bcmath"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\doaddsub.c
+
+!IF "$(CFG)" == "php5dll - Win32 Debug"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
+
+# PROP Intermediate_Dir "..\Release_inline_bcmath"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\init.c
+
+!IF "$(CFG)" == "php5dll - Win32 Debug"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
+
+# PROP Intermediate_Dir "..\Release_inline_bcmath"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\int2num.c
+
+!IF "$(CFG)" == "php5dll - Win32 Debug"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
+
+# PROP Intermediate_Dir "..\Release_inline_bcmath"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\nearzero.c
+
+!IF "$(CFG)" == "php5dll - Win32 Debug"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
+
+# PROP Intermediate_Dir "..\Release_inline_bcmath"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\neg.c
+
+!IF "$(CFG)" == "php5dll - Win32 Debug"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
+
+# PROP Intermediate_Dir "..\Release_inline_bcmath"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\num2long.c
+
+!IF "$(CFG)" == "php5dll - Win32 Debug"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
+
+# PROP Intermediate_Dir "..\Release_inline_bcmath"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\num2str.c
+
+!IF "$(CFG)" == "php5dll - Win32 Debug"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
+
+# PROP Intermediate_Dir "..\Release_inline_bcmath"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\outofmem.c
+
+!IF "$(CFG)" == "php5dll - Win32 Debug"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
+
+# PROP Intermediate_Dir "..\Release_inline_bcmath"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\output.c
+
+!IF "$(CFG)" == "php5dll - Win32 Debug"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
+
+# PROP Intermediate_Dir "..\Release_inline_bcmath"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\raise.c
+
+!IF "$(CFG)" == "php5dll - Win32 Debug"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
+
+# PROP Intermediate_Dir "..\Release_inline_bcmath"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\raisemod.c
+
+!IF "$(CFG)" == "php5dll - Win32 Debug"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
+
+# PROP Intermediate_Dir "..\Release_inline_bcmath"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\recmul.c
+
+!IF "$(CFG)" == "php5dll - Win32 Debug"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
+
+# PROP Intermediate_Dir "..\Release_inline_bcmath"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\rmzero.c
+
+!IF "$(CFG)" == "php5dll - Win32 Debug"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
+
+# PROP Intermediate_Dir "..\Release_inline_bcmath"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\rt.c
+
+!IF "$(CFG)" == "php5dll - Win32 Debug"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
+
+# PROP Intermediate_Dir "..\Release_inline_bcmath"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\sqrt.c
+
+!IF "$(CFG)" == "php5dll - Win32 Debug"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
+
+# PROP Intermediate_Dir "..\Release_inline_bcmath"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\str2num.c
+
+!IF "$(CFG)" == "php5dll - Win32 Debug"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
+
+# PROP Intermediate_Dir "..\Release_inline_bcmath"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\sub.c
+
+!IF "$(CFG)" == "php5dll - Win32 Debug"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
+
+# PROP Intermediate_Dir "..\Release_inline_bcmath"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\zero.c
+
+!IF "$(CFG)" == "php5dll - Win32 Debug"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
+
+# PROP Intermediate_Dir "..\Release_inline_bcmath"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# End Group
+# Begin Group "Header Files No. 8"
+
+# PROP Default_Filter ".h"
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\bcmath.h
+
+!IF "$(CFG)" == "php5dll - Win32 Debug"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
+
+# PROP Intermediate_Dir "..\Release_inline_bcmath"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\config.h
+
+!IF "$(CFG)" == "php5dll - Win32 Debug"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
+
+# PROP Intermediate_Dir "..\Release_inline_bcmath"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\private.h
+
+!IF "$(CFG)" == "php5dll - Win32 Debug"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
+
+!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
+
+# PROP Intermediate_Dir "..\Release_inline_bcmath"
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Group
+# End Group
+# Begin Group "Win32"
+
+# PROP Default_Filter ""
+# Begin Group "Source Files No. 2"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\ext\com\COM.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\com\conversion.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\win32\readdir.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\win32\registry.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\win32\sendmail.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\win32\time.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\com\VARIANT.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\win32\winutil.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\win32\wsyslog.c
+# End Source File
+# End Group
+# Begin Group "Header Files No. 2"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\ext\com\com.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\com\conversion.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\win32\grp.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\win32\param.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\com\php_COM.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\win32\php_registry.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\com\php_VARIANT.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\com\php_versioning.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\win32\readdir.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\win32\sendmail.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\win32\syslog.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\win32\time.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\win32\unistd.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\com\variant.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\win32\wfile.h
+# End Source File
+# End Group
+# End Group
+# Begin Group "Text Files"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\ChangeLog
+# End Source File
+# Begin Source File
+
+SOURCE=..\LICENSE
+# End Source File
+# End Group
+# Begin Group "Support"
+
+# PROP Default_Filter ""
+# End Target
+# End Project
diff --git a/win32/php5dllts.dsp b/win32/php5dllts.dsp
new file mode 100644
index 0000000..a8e93ec
--- /dev/null
+++ b/win32/php5dllts.dsp
@@ -0,0 +1,2727 @@
+# Microsoft Developer Studio Project File - Name="php5dllts" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=php5dllts - Win32 Debug_TS
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "php5dllts.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "php5dllts.mak" CFG="php5dllts - Win32 Debug_TS"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "php5dllts - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "php5dllts - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "php5dllts - Win32 Release_TS_inline" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "php5dllts - Win32 Release_TSDbg" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug_TS"
+# PROP BASE Intermediate_Dir "Debug_TS"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "..\Debug_TS"
+# PROP Intermediate_Dir "Debug_TS"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP5DLLTS_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\..\zlib" /I "..\Zend" /I "..\TSRM" /I "..\..\libxml\include" /I "..\ext\sqlite\libsqlite\src" /D "_DEBUG" /D ZEND_DEBUG=1 /D "_WINDOWS" /D "_USRDLL" /D "PHP5DLLTS_EXPORTS" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "SAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /D "LIBXML_THREAD_ENABLED" /D "LIBXML_STATIC" /FR /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x40d /d "_DEBUG"
+# ADD RSC /l 0x40d /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib ws2_32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ZendTS.lib TSRM.lib resolv.lib zlib.lib libxml2_a.lib Urlmon.lib libsqlite.lib iconv_a.lib /nologo /version:4.0 /dll /debug /machine:I386 /nodefaultlib:"libcmt" /nodefaultlib:"msvcrt" /out:"..\Debug_TS\php5ts_debug.dll" /pdbtype:sept /libpath:"..\TSRM\Debug_TS" /libpath:"..\Zend\Debug_TS" /libpath:"..\..\bindlib_w32\Debug" /libpath:"Debug_TS" /libpath:"..\..\zlib\Debug" /libpath:"..\..\libxml\lib\Debug" /libpath:"..\ext\sqlite\Debug_TS" /libpath:"..\..\libiconv\lib"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release_TS"
+# PROP BASE Intermediate_Dir "Release_TS"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "..\Release_TS"
+# PROP Intermediate_Dir "Release_TS"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP5DLLTS_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\..\zlib" /I "..\Zend" /I "..\TSRM" /I "..\..\libxml\include" /I "..\ext\sqlite\libsqlite\src" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP5DLLTS_EXPORTS" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "SAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /D "LIBXML_STATIC" /FR /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x40d /d "NDEBUG"
+# ADD RSC /l 0x40d /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib ws2_32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ZendTS.lib TSRM.lib resolv.lib zlib.lib libxml2_a.lib Urlmon.lib libsqlite.lib iconv_a.lib /nologo /version:4.0 /dll /machine:I386 /nodefaultlib:"libcmt" /out:"..\Release_TS\php5ts.dll" /libpath:"..\TSRM\Release_TS" /libpath:"..\Zend\Release_TS" /libpath:"Release_TS" /libpath:"..\ext\sqlite\Release_TS" /libpath:"..\..\bindlib_w32\Release" /libpath:"..\..\zlib\Release" /libpath:"..\..\libxml\lib\Release" /libpath:"..\..\libiconv\lib"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "php5dllts___Win32_Release_TS_inline"
+# PROP BASE Intermediate_Dir "php5dllts___Win32_Release_TS_inline"
+# PROP BASE Ignore_Export_Lib 0
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "..\Release_TS_inline"
+# PROP Intermediate_Dir "Release_TS_inline"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /I "regex" /I "..\bindlib_w32" /I "Zend" /I "tsrm" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "PHP5DLLTS_EXPORTS" /D "MSVC5" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "SAPI_EXPORTS" /D "ZTS" /D "WIN32" /D "_MBCS" /D ZEND_DEBUG=0 /FR /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\..\zlib" /I "..\Zend" /I "..\TSRM" /I "..\..\libxml\include" /I "..\ext\sqlite\libsqlite\src" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "_WINDOWS" /D "_USRDLL" /D "PHP5DLLTS_EXPORTS" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "SAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /D "LIBXML_THREAD_ENABLED" /D "LIBXML_STATIC" /FR /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x40d /d "NDEBUG"
+# ADD RSC /l 0x40d /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ZendTS.lib TSRM.lib resolv.lib /nologo /dll /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libcmt.lib" /out:"Release_TS/php5ts.dll" /libpath:"TSRM\Release_TS" /libpath:"Zend\Release_TS" /libpath:"..\bindlib_w32\Release"
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib ws2_32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ZendTS.lib TSRM.lib resolv.lib zlib.lib libxml2_a.lib Urlmon.lib libsqlite.lib iconv_a.lib /nologo /version:4.0 /dll /machine:I386 /nodefaultlib:"libcmt" /out:"..\Release_TS_inline\php5ts.dll" /libpath:"..\TSRM\Release_TS_inline" /libpath:"..\Zend\Release_TS_inline" /libpath:"Release_TS_Inline" /libpath:"..\..\bindlib_w32\Release" /libpath:"..\..\zlib\Release" /libpath:"..\..\libxml\lib\Release" /libpath:"..\..\libiconv\lib" /libpath:"..\ext\sqlite\Release_TS"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "php5dllts___Win32_Release_TSDbg"
+# PROP BASE Intermediate_Dir "php5dllts___Win32_Release_TSDbg"
+# PROP BASE Ignore_Export_Lib 0
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "..\Release_TSDbg"
+# PROP Intermediate_Dir "Release_TSDbg"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP5DLLTS_EXPORTS" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "SAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /Zi /Od /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\..\zlib" /I "..\Zend" /I "..\TSRM" /I "..\..\libxml\include" /I "..\ext\sqlite\libsqlite\src" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP5DLLTS_EXPORTS" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "SAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /D "LIBXML_THREAD_ENABLED" /D "LIBXML_STATIC" /FR /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x40d /d "NDEBUG"
+# ADD RSC /l 0x40d /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ZendTS.lib TSRM.lib resolv.lib /nologo /version:4.0 /dll /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libcmt.lib" /out:"..\Release_TS\php5ts.dll" /libpath:"..\TSRM\Release_TS" /libpath:"..\Zend\Release_TS" /libpath:"..\..\bindlib_w32\Release" /libpath:"Release_TS"
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib ws2_32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ZendTS.lib TSRM.lib resolv.lib zlib.lib libxml2_a.lib Urlmon.lib libsqlite.lib iconv_a.lib /nologo /version:4.0 /dll /debug /machine:I386 /nodefaultlib:"libcmt" /out:"..\Release_TSDbg\php5ts.dll" /libpath:"..\TSRM\Release_TSDbg" /libpath:"..\Zend\Release_TSDbg" /libpath:"Release_TSDbg" /libpath:"..\ext\sqlite\Release_TSDbg" /libpath:"..\..\bindlib_w32\Release" /libpath:"..\..\zlib\Release" /libpath:"..\..\libxml\lib\Release" /libpath:"..\..\libiconv\lib"
+
+!ENDIF
+
+# Begin Target
+
+# Name "php5dllts - Win32 Debug_TS"
+# Name "php5dllts - Win32 Release_TS"
+# Name "php5dllts - Win32 Release_TS_inline"
+# Name "php5dllts - Win32 Release_TSDbg"
+# Begin Group "Core"
+
+# PROP Default_Filter ""
+# Begin Group "Source Files"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\ext\standard\css.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\cyr_convert.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\filters.c
+# End Source File
+# Begin Source File
+
+SOURCE="..\main\fopen_wrappers.c"
+# End Source File
+# Begin Source File
+
+SOURCE=.\globals.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\internal_functions_win32.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\main.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\mergesort.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\network.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\output.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\php_content_types.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\php_ini.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\php_logos.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\php_open_temporary_file.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\php_scandir.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\php_sprintf.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\php_ticks.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\php_variables.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\proc_open.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\quot_print.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\reentrancy.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\rfc1867.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\safe_mode.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\SAPI.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\snprintf.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\spprintf.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\strlcat.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\strlcpy.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\main\config.w32.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\css.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\cyr_convert.h
+# End Source File
+# Begin Source File
+
+SOURCE="..\main\fopen_wrappers.h"
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\getopt.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\logos.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\output.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\php.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\php_compat.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\php_content_types.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\php_globals.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\php_ini.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\php_logos.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\php_main.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\php_open_temporary_file.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\php_output.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\php_regex.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\php_scandir.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\php_streams.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\php_variables.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\quot_print.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\rfc1867.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\safe_mode.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\SAPI.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\snprintf.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\spprintf.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\win95nt.h
+# End Source File
+# End Group
+# End Group
+# Begin Group "Function Modules"
+
+# PROP Default_Filter ""
+# Begin Group "PCRE"
+
+# PROP Default_Filter ""
+# Begin Group "Source Files No. 3"
+
+# PROP Default_Filter ".c"
+# Begin Source File
+
+SOURCE=..\ext\pcre\pcrelib\pcre_chartables.c
+# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\pcre\pcrelib\pcre_compile.c
+# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\pcre\pcrelib\pcre_exec.c
+# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\pcre\pcrelib\pcre_fullinfo.c
+# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\pcre\pcrelib\pcre_get.c
+# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\pcre\pcrelib\pcre_globals.c
+# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\pcre\pcrelib\pcre_info.c
+# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\pcre\pcrelib\pcre_maketables.c
+# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\pcre\pcrelib\pcre_ord2utf8.c
+# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\pcre\pcrelib\pcre_study.c
+# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\pcre\pcrelib\pcre_tables.c
+# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\pcre\pcrelib\pcre_try_flipped.c
+# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\pcre\pcrelib\pcre_ucp_searchfuncs.c
+# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\pcre\pcrelib\pcre_valid_utf8.c
+# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\pcre\pcrelib\pcre_version.c
+# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\pcre\pcrelib\pcre_xclass.c
+# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
+# End Source File
+# End Group
+# Begin Group "Header Files No. 3"
+
+# PROP Default_Filter ".h"
+# Begin Source File
+
+SOURCE=..\ext\pcre\pcrelib\internal.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\pcre\pcrelib\pcre.h
+# End Source File
+# End Group
+# End Group
+# Begin Group "DOM"
+
+# PROP Default_Filter ""
+# Begin Group "DOM Source Files"
+
+# PROP Default_Filter ".c"
+# Begin Source File
+
+SOURCE=..\ext\dom\attr.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\dom\cdatasection.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\dom\characterdata.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\dom\comment.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\dom\document.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\dom\documentfragment.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\dom\documenttype.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\dom\dom_iterators.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\dom\domconfiguration.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\dom\domerror.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\dom\domerrorhandler.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\dom\domexception.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\dom\domimplementation.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\dom\domimplementationlist.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\dom\domimplementationsource.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\dom\domlocator.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\dom\domstringlist.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\dom\element.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\dom\entity.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\dom\entityreference.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\dom\namednodemap.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\dom\namelist.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\dom\node.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\dom\nodelist.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\dom\notation.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\dom\php_dom.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\dom\processinginstruction.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\dom\string_extend.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\dom\text.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\dom\typeinfo.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\dom\userdatahandler.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\dom\xpath.c
+# End Source File
+# End Group
+# Begin Group "DOM Header Files"
+
+# PROP Default_Filter ".h"
+# Begin Source File
+
+SOURCE=..\ext\dom\dom_ce.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\dom\dom_fe.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\dom\dom_properties.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\dom\php_dom.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\dom\xml_common.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Group
+# Begin Group "SimpleXML"
+
+# PROP Default_Filter ""
+# Begin Group "SimpleXML Source Files"
+
+# PROP Default_Filter ".c"
+# Begin Source File
+
+SOURCE=..\ext\simplexml\simplexml.c
+# End Source File
+# End Group
+# Begin Group "SimpleXML Header Files"
+
+# PROP Default_Filter ".h"
+# Begin Source File
+
+SOURCE=..\ext\simplexml\php_simplexml.h
+# End Source File
+# End Group
+# Begin Group "Resource Files No. 1"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Group
+# Begin Group "Regular Expressions"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\regex\regcomp.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\regex\regerror.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\regex\regexec.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\regex\regfree.c
+# End Source File
+# End Group
+# Begin Group "XML"
+
+# PROP Default_Filter ""
+# Begin Group "Source Files No. 4"
+
+# PROP Default_Filter ".c"
+# Begin Source File
+
+SOURCE=..\ext\xml\compat.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\ctype\ctype.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\tokenizer\tokenizer.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\wddx\wddx.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\xml\xml.c
+# End Source File
+# End Group
+# Begin Group "Header Files No. 4"
+
+# PROP Default_Filter ".h"
+# Begin Source File
+
+SOURCE=..\ext\wddx\php_wddx.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\wddx\php_wddx_api.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\xml\php_xml.h
+# End Source File
+# End Group
+# End Group
+# Begin Group "FTP"
+
+# PROP Default_Filter ""
+# Begin Group "Source Files No. 6"
+
+# PROP Default_Filter ".c"
+# Begin Source File
+
+SOURCE=..\ext\ftp\ftp.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\ftp\php_ftp.c
+# End Source File
+# End Group
+# Begin Group "Header Files No. 6"
+
+# PROP Default_Filter ".h"
+# Begin Source File
+
+SOURCE=..\ext\ftp\ftp.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\ftp\php_ftp.h
+# End Source File
+# End Group
+# End Group
+# Begin Group "Calendar"
+
+# PROP Default_Filter ""
+# Begin Group "Source Files No. 7"
+
+# PROP Default_Filter ".c"
+# Begin Source File
+
+SOURCE=..\ext\calendar\cal_unix.c
+# PROP Intermediate_Dir "calendar"
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\calendar\calendar.c
+# PROP Intermediate_Dir "calendar"
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\calendar\dow.c
+# PROP Intermediate_Dir "calendar"
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\calendar\easter.c
+# PROP Intermediate_Dir "calendar"
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\calendar\french.c
+# PROP Intermediate_Dir "calendar"
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\calendar\gregor.c
+# PROP Intermediate_Dir "calendar"
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\calendar\jewish.c
+# PROP Intermediate_Dir "calendar"
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\calendar\julian.c
+# PROP Intermediate_Dir "calendar"
+# End Source File
+# End Group
+# Begin Group "Header Files No. 7"
+
+# PROP Default_Filter ".h"
+# Begin Source File
+
+SOURCE=..\ext\calendar\php_calendar.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\calendar\sdncal.h
+# End Source File
+# End Group
+# End Group
+# Begin Group "SPL"
+
+# PROP Default_Filter ""
+# Begin Group "Source Files No. 11"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\ext\spl\php_spl.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\spl\spl_array.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\spl\spl_directory.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\spl\spl_engine.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\spl\spl_exceptions.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\spl\spl_functions.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\spl\spl_iterators.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\spl\spl_observer.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\spl\spl_sxe.c
+# End Source File
+# End Group
+# Begin Group "Header Files No. 12"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\ext\spl\php_spl.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\spl\spl_array.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\spl\spl_directory.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\spl\spl_engine.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\spl\spl_exceptions.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\spl\spl_functions.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\spl\spl_iterators.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\spl\spl_observer.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\spl\spl_sxe.h
+# End Source File
+# End Group
+# End Group
+# Begin Group "Reflection"
+
+# PROP Default_Filter ""
+# Begin Group "Source Files No. 12"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\ext\reflection\php_reflection.c
+# End Source File
+# End Group
+# Begin Group "Header Files No. 13"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\ext\reflection\php_reflection.h
+# End Source File
+# End Group
+# End Group
+# Begin Group "XMLReader"
+
+# PROP Default_Filter ""
+# Begin Group "Source Files No. 13"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\ext\xmlreader\php_xmlreader.c
+# End Source File
+# End Group
+# Begin Group "Header Files No. 14"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\ext\xmlreader\php_xmlreader.h
+# End Source File
+# End Group
+# End Group
+# Begin Group "XMLwriter"
+
+# PROP Default_Filter ""
+# Begin Group "Source Files No. 14"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\ext\xmlwriter\php_xmlwriter.c
+# End Source File
+# End Group
+# Begin Group "Header Files No. 15"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\ext\xmlwriter\php_xmlwriter.h
+# End Source File
+# End Group
+# End Group
+# Begin Group "IConv"
+
+# PROP Default_Filter ""
+# Begin Group "Source Files No. 15"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\ext\iconv\iconv.c
+# ADD CPP /D "PHP_ICONV_EXPORTS"
+# End Source File
+# End Group
+# Begin Group "Header Files No. 16"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\ext\iconv\php_iconv.h
+# End Source File
+# End Group
+# End Group
+# Begin Group "bcmath"
+
+# PROP Default_Filter ""
+# Begin Group "Source Files No. 8"
+
+# PROP Default_Filter ".c"
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\add.c
+
+!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
+
+# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\compare.c
+
+!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
+
+# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\debug.c
+
+!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
+
+# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\div.c
+
+!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
+
+# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\divmod.c
+
+!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
+
+# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\doaddsub.c
+
+!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
+
+# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\init.c
+
+!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
+
+# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\int2num.c
+
+!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
+
+# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\nearzero.c
+
+!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
+
+# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\neg.c
+
+!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
+
+# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\num2long.c
+
+!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
+
+# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\num2str.c
+
+!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
+
+# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\outofmem.c
+
+!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
+
+# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\output.c
+
+!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
+
+# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\raise.c
+
+!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
+
+# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\raisemod.c
+
+!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
+
+# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\recmul.c
+
+!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
+
+# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\rmzero.c
+
+!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
+
+# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\rt.c
+
+!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
+
+# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\sqrt.c
+
+!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
+
+# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\str2num.c
+
+!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
+
+# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\sub.c
+
+!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
+
+# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\zero.c
+
+!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
+
+# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
+# ADD CPP /I "..\ext\bcmath\libbcmath\src"
+
+!ENDIF
+
+# End Source File
+# End Group
+# Begin Group "Header Files No. 8"
+
+# PROP Default_Filter ".h"
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\bcmath.h
+
+!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
+
+# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\config.h
+
+!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
+
+# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\libbcmath\src\private.h
+
+!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
+
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
+
+# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Group
+# Begin Group "zlib"
+
+# PROP Default_Filter ""
+# Begin Group "Source Files No. 10 Nr. 1"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\ext\zlib\zlib.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\zlib\zlib_filter.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\zlib\zlib_fopen_wrapper.c
+# End Source File
+# End Group
+# Begin Group "Header Files No. 10 Nr. 1"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\ext\zlib\php_zlib.h
+# End Source File
+# End Group
+# End Group
+# Begin Group "Standard"
+
+# PROP Default_Filter ""
+# Begin Group "Source Files No. 1"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\ext\standard\array.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\assert.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\base64.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\basic_functions.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\bcmath.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\browscap.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\crc32.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\credits.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\crypt.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\datetime.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\dir.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\dl.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\dns.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\exec.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\file.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\filestat.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\flock_compat.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\formatted_print.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\fsock.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\ftp_fopen_wrapper.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\head.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\html.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\http.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\http_fopen_wrapper.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\image.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\incomplete_class.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\info.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\iptc.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\lcg.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\levenshtein.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\link.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\mail.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\math.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\md5.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\metaphone.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\microtime.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\session\mod_files.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\session\mod_user.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\pack.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\pageinfo.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\php_fopen_wrapper.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\odbc\php_odbc.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\pcre\php_pcre.c
+# ADD CPP /D "STATIC"
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\rand.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\reg.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\scanf.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\session\session.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\sha1.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\soundex.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\streamsfuncs.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\string.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\strnatcmp.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\syslog.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\type.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\uniqid.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\url.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\url_scanner_ex.c
+# ADD CPP /W2
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\uuencode.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\var.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\var_unserializer.c
+# ADD CPP /W2
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\versioning.c
+# End Source File
+# End Group
+# Begin Group "Header Files No. 1"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\ext\standard\base64.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\basic_functions.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\datetime.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\dl.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\dns.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\exec.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\file.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\flock_compat.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\fsock.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\functions\global.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\head.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\html.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\info.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\md5.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\session\mod_user.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\pageinfo.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\php_array.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\bcmath\php_bcmath.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\php_crypt.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\php_dir.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\php_filestat.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\php_fopen_wrappers.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\php_http.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\php_lcg.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\ldap\php_ldap.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\php_mail.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\odbc\php_odbc.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\odbc\php_odbc_includes.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\pcre\php_pcre.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\php_rand.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\session\php_session.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\php_string.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\php_sunfuncs.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\php_syslog.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\functions\phpdir.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\functions\phpmath.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\reg.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\scanf.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\sha1.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\type.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\uniqid.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\url.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\url_scanner_ex.h
+# End Source File
+# End Group
+# End Group
+# Begin Group "SQLite"
+
+# PROP Default_Filter ""
+# Begin Group "Header Files No. 5"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\ext\sqlite\php_sqlite.h
+# End Source File
+# End Group
+# Begin Group "Source Files No. 5"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\ext\sqlite\sess_sqlite.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\sqlite\sqlite.c
+# End Source File
+# End Group
+# End Group
+# Begin Group "LIBXML"
+
+# PROP Default_Filter ""
+# Begin Group "Header Files No. 10"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\ext\libxml\php_libxml.h
+# End Source File
+# End Group
+# Begin Group "Source Files No. 9"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\ext\libxml\libxml.c
+# End Source File
+# End Group
+# End Group
+# Begin Group "Date"
+
+# PROP Default_Filter ""
+# Begin Group "Source Files No. 10"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\ext\date\lib\astro.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\date\lib\dow.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\date\lib\parse_date.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\date\lib\parse_tz.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\date\php_date.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\date\lib\timelib.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\date\lib\timelib_config.h.win32
+
+!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
+
+# Begin Custom Build
+InputDir=\Projects\php-5.2\ext\date\lib
+InputPath=..\ext\date\lib\timelib_config.h.win32
+
+"..\ext\date\lib\timelib_config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ copy $(InputPath) $(InputDir)\timelib_config.h
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
+
+# Begin Custom Build
+InputDir=\Projects\php-5.2\ext\date\lib
+InputPath=..\ext\date\lib\timelib_config.h.win32
+
+"..\ext\date\lib\timelib_config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ copy $(InputPath) $(InputDir)\timelib_config.h
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
+
+# Begin Custom Build
+InputDir=\Projects\php-5.2\ext\date\lib
+InputPath=..\ext\date\lib\timelib_config.h.win32
+
+"..\ext\date\lib\timelib_config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ copy $(InputPath) $(InputDir)\timelib_config.h
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
+
+# Begin Custom Build
+InputDir=\Projects\php-5.2\ext\date\lib
+InputPath=..\ext\date\lib\timelib_config.h.win32
+
+"..\ext\date\lib\timelib_config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ copy $(InputPath) $(InputDir)\timelib_config.h
+
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\date\lib\tm2unixtime.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\date\lib\unixtime2tm.c
+# End Source File
+# End Group
+# Begin Group "Header Files No. 11"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\ext\date\lib\astro.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\date\lib\fallbackmap.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\date\php_date.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\date\lib\timelib.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\date\lib\timezonedb.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\date\lib\timezonemap.h
+# End Source File
+# End Group
+# End Group
+# End Group
+# Begin Group "Win32"
+
+# PROP Default_Filter ""
+# Begin Group "Source Files No. 2"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\crypt_win32.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\glob.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\md5crypt.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\win32\readdir.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\win32\registry.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\select.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\win32\sendmail.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\win32\time.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\win32\winutil.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\win32\wsyslog.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\build\wsyslog.mc
+
+!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
+
+# Begin Custom Build
+InputDir=.\build
+IntDir=.\Release_TSDbg
+InputPath=.\build\wsyslog.mc
+
+"wsyslog.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ mc -h $(InputDir)/.. -r $(InputDir) -x $(IntDir) $(InputPath)
+
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# Begin Group "Header Files No. 2"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\crypt_win32.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\glob.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\win32\grp.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\win32\param.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\win32\php_registry.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\win32\readdir.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\select.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\win32\sendmail.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\win32\syslog.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\win32\time.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\win32\unistd.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\win32\wfile.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\winutil.h
+# End Source File
+# End Group
+# End Group
+# Begin Group "Text Files"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\ChangeLog
+# End Source File
+# Begin Source File
+
+SOURCE=..\LICENSE
+# End Source File
+# Begin Source File
+
+SOURCE=..\NEWS
+# End Source File
+# Begin Source File
+
+SOURCE="..\php.ini-dist"
+# End Source File
+# Begin Source File
+
+SOURCE="..\php.ini-recommended"
+# End Source File
+# Begin Source File
+
+SOURCE="..\README.CVS-RULES"
+# End Source File
+# Begin Source File
+
+SOURCE=..\TODO
+# End Source File
+# End Group
+# Begin Group "Support"
+
+# PROP Default_Filter ""
+# End Group
+# Begin Group "Streams"
+
+# PROP Default_Filter ""
+# Begin Group "streams headers"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\main\streams\php_stream_context.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\streams\php_stream_filter_api.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\streams\php_stream_mmap.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\streams\php_stream_plain_wrapper.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\streams\php_stream_transport.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\streams\php_stream_userspace.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\streams\php_streams_int.h
+# End Source File
+# End Group
+# Begin Source File
+
+SOURCE=..\main\streams\cast.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\streams\filter.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\streams\memory.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\streams\mmap.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\streams\plain_wrapper.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\streams\streams.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\streams\transports.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\standard\user_filters.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\streams\userspace.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\main\streams\xp_socket.c
+# End Source File
+# End Group
+# Begin Group "COM and DotNet"
+
+# PROP Default_Filter ""
+# Begin Group "Header Files No. 9"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\ext\com_dotnet\com_saproxy.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\com_dotnet\com_wrapper.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\com_dotnet\php_com_dotnet.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\com_dotnet\php_com_dotnet_internal.h
+# End Source File
+# End Group
+# Begin Source File
+
+SOURCE=..\ext\com_dotnet\com_com.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\com_dotnet\com_dotnet.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\com_dotnet\com_extension.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\com_dotnet\com_handlers.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\com_dotnet\com_iterator.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\com_dotnet\com_misc.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\com_dotnet\com_olechar.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\com_dotnet\com_persist.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\com_dotnet\com_typeinfo.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\com_dotnet\com_variant.c
+# End Source File
+# End Group
+# Begin Source File
+
+SOURCE=.\php5dllts.rc
+# End Source File
+# Begin Source File
+
+SOURCE=.\php5dllts.rc2
+# End Source File
+# Begin Source File
+
+SOURCE=.\phpts.def
+
+!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
+
+USERDEP__PHPTS="..\ext\sqlite\php_sqlite.def" "..\ext\libxml\php_libxml2.def"
+# Begin Custom Build - Generating $(InputPath)
+InputPath=.\phpts.def
+
+"phpts.def" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ builddef.bat > phpts.def
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
+
+USERDEP__PHPTS="..\ext\sqlite\php_sqlite.def" "..\ext\libxml\php_libxml2.def"
+# Begin Custom Build - Generating $(InputPath)
+InputPath=.\phpts.def
+
+"phpts.def" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ builddef.bat > phpts.def
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
+
+USERDEP__PHPTS="..\ext\sqlite\php_sqlite.def" "..\ext\libxml\php_libxml2.def"
+# Begin Custom Build - Generating $(InputPath)
+InputPath=.\phpts.def
+
+"phpts.def" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ builddef.bat > phpts.def
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
+
+USERDEP__PHPTS="..\ext\sqlite\php_sqlite.def" "..\ext\libxml\php_libxml2.def"
+# Begin Custom Build - Generating $(InputPath)
+InputPath=.\phpts.def
+
+"phpts.def" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ builddef.bat > phpts.def
+
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Target
+# End Project
diff --git a/win32/php5dllts.rc b/win32/php5dllts.rc
new file mode 100644
index 0000000..2e01037
--- /dev/null
+++ b/win32/php5dllts.rc
@@ -0,0 +1,126 @@
+//Microsoft Developer Studio generated resource script.
+
+//
+
+#include "resource.h"
+
+
+
+#define APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+
+//
+
+// Generated from the TEXTINCLUDE 2 resource.
+
+//
+
+#include "winres.h"
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+#undef APSTUDIO_READONLY_SYMBOLS
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+// English (U.S.) resources
+
+
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+
+#ifdef _WIN32
+
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+
+#pragma code_page(1252)
+
+#endif //_WIN32
+
+
+
+#ifdef APSTUDIO_INVOKED
+
+/////////////////////////////////////////////////////////////////////////////
+
+//
+
+// TEXTINCLUDE
+
+//
+
+
+
+1 TEXTINCLUDE DISCARDABLE
+
+BEGIN
+
+ "resource.h\0"
+
+END
+
+
+
+2 TEXTINCLUDE DISCARDABLE
+
+BEGIN
+
+ "#include ""php5dllts.rc2""\r\n"
+
+ "\0"
+
+END
+
+
+
+3 TEXTINCLUDE DISCARDABLE
+
+BEGIN
+
+ "\r\n"
+
+ "\0"
+
+END
+
+
+
+#endif // APSTUDIO_INVOKED
+
+
+
+#endif // English (U.S.) resources
+
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+
+
+
+
+#ifndef APSTUDIO_INVOKED
+
+/////////////////////////////////////////////////////////////////////////////
+
+//
+
+// Generated from the TEXTINCLUDE 3 resource.
+
+//
+
+#include "php5dllts.rc2"
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+#endif // not APSTUDIO_INVOKED
+
+
+
diff --git a/win32/php5dllts.rc2 b/win32/php5dllts.rc2
new file mode 100644
index 0000000..b05f0af
--- /dev/null
+++ b/win32/php5dllts.rc2
@@ -0,0 +1,61 @@
+//
+// php5dllts.RC2 - resources Microsoft Visual C++ does not edit directly
+//
+
+#ifdef APSTUDIO_INVOKED
+ #error this file is not editable by Microsoft Visual C++
+#endif //APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Add manually edited resources here...
+#include "../main/php_version.h"
+
+#define XSTRVER4(maj, min, rel, build) #maj "." #min "." #rel "." #build
+#define XSTRVER3(maj, min, rel) #maj "." #min "." #rel
+#define STRVER4(maj, min, rel, build) XSTRVER4(maj, min, rel, build)
+#define STRVER3(maj, min, rel) XSTRVER3(maj, min, rel)
+
+#ifndef _MAC
+//Version
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION PHP_MAJOR_VERSION,PHP_MINOR_VERSION,PHP_RELEASE_VERSION,PHP_RELEASE_VERSION
+ PRODUCTVERSION PHP_MAJOR_VERSION,PHP_MINOR_VERSION,PHP_RELEASE_VERSION,0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS VS_FF_DEBUG
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS VOS__WINDOWS32
+ FILETYPE VFT_DLL
+ FILESUBTYPE VFT2_UNKNOWN
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "Comments", "\0"
+ VALUE "CompanyName", "The PHP Group\0"
+ VALUE "FileDescription", "PHP Script Interpreter\0"
+ VALUE "FileVersion", STRVER4(PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION, PHP_RELEASE_VERSION)
+ VALUE "InternalName", "php\0"
+ VALUE "LegalCopyright", "Copyright © 1997-2007 The PHP Group\0"
+ VALUE "LegalTrademarks", "php\0"
+ VALUE "OriginalFilename", "php5ts.dll\0"
+ VALUE "PrivateBuild", "\0"
+ VALUE "ProductName", "PHP Thread Safe\0"
+ VALUE "ProductVersion", STRVER3(PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION)
+ VALUE "SpecialBuild", PHP_EXTRA_VERSION "\0"
+ VALUE "URL", "http://www.php.net"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#endif // !_MAC
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/win32/php5ts.dsp b/win32/php5ts.dsp
new file mode 100644
index 0000000..3736815
--- /dev/null
+++ b/win32/php5ts.dsp
@@ -0,0 +1,191 @@
+# Microsoft Developer Studio Project File - Name="php5ts" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=php5ts - Win32 Debug_TS
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "php5ts.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "php5ts.mak" CFG="php5ts - Win32 Debug_TS"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "php5ts - Win32 Release_TS" (based on "Win32 (x86) Console Application")
+!MESSAGE "php5ts - Win32 Debug_TS" (based on "Win32 (x86) Console Application")
+!MESSAGE "php5ts - Win32 Release_TS_inline" (based on "Win32 (x86) Console Application")
+!MESSAGE "php5ts - Win32 Release_TSDbg" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "php5ts - Win32 Release_TS"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release_TS"
+# PROP BASE Intermediate_Dir "Release_TS"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "..\Release_TS"
+# PROP Intermediate_Dir "Release_TS"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /I "..\sapi\cgi\libfcgi\include" /D FCGI_STATIC=1 /D PHP_FASTCGI=1 /D "NDEBUG" /D ZEND_DEBUG=0 /D "_CONSOLE" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /Fr /FD /c
+# SUBTRACT CPP /YX /Yc /Yu
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 php5ts.lib winmm.lib ws2_32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:4.0 /subsystem:console /machine:I386 /nodefaultlib:"libc.lib" /out:"..\Release_TS\php.exe" /libpath:"..\Release_TS"
+
+!ELSEIF "$(CFG)" == "php5ts - Win32 Debug_TS"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug_TS"
+# PROP BASE Intermediate_Dir "Debug_TS"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug_TS"
+# PROP Intermediate_Dir "Debug_TS"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /I "..\sapi\cgi\libfcgi\include" /D FCGI_STATIC=1 /D PHP_FASTCGI=1 /D "DEBUG" /D "_DEBUG" /D ZEND_DEBUG=1 /D "_CONSOLE" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /i "c:\include" /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 winmm.lib netapi32.lib ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts_debug.lib /nologo /version:4.0 /subsystem:console /debug /machine:I386 /nodefaultlib:"libcd" /nodefaultlib:"libcmt" /out:"..\Debug_TS/php.exe" /pdbtype:sept /libpath:"..\Debug_TS"
+# SUBTRACT LINK32 /pdb:none
+
+!ELSEIF "$(CFG)" == "php5ts - Win32 Release_TS_inline"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "php5ts___Win32_Release_TS_inline"
+# PROP BASE Intermediate_Dir "php5ts___Win32_Release_TS_inline"
+# PROP BASE Ignore_Export_Lib 0
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "..\Release_TS_inline"
+# PROP Intermediate_Dir "Release_TS_inline"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /I "regex" /I "..\bindlib_w32" /I "Zend" /I "tsrm" /D "NDEBUG" /D "MSVC5" /D "_CONSOLE" /D "ZTS" /D "WIN32" /D "_MBCS" /D ZEND_DEBUG=0 /Fr /FD /c
+# SUBTRACT BASE CPP /YX /Yc /Yu
+# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /I "..\sapi\cgi\libfcgi\include" /D FCGI_STATIC=1 /D PHP_FASTCGI=1 /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "_CONSOLE" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /Fr /FD /c
+# SUBTRACT CPP /YX /Yc /Yu
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 php5ts.lib winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:3.0 /subsystem:console /machine:I386 /nodefaultlib:"libc.lib" /out:"Release_TS\php.exe" /libpath:"Release_TS"
+# ADD LINK32 php5ts.lib winmm.lib ws2_32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:4.0 /subsystem:console /machine:I386 /nodefaultlib:"libc.lib" /out:"..\Release_TS_inline\php.exe" /libpath:"..\Release_TS_inline"
+
+!ELSEIF "$(CFG)" == "php5ts - Win32 Release_TSDbg"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "php5ts___Win32_Release_TSDbg"
+# PROP BASE Intermediate_Dir "php5ts___Win32_Release_TSDbg"
+# PROP BASE Ignore_Export_Lib 0
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "..\Release_TSDbg"
+# PROP Intermediate_Dir "Release_TSDbg"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_CONSOLE" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /Fr /FD /c
+# SUBTRACT BASE CPP /YX /Yc /Yu
+# ADD CPP /nologo /MD /W3 /GX /Zi /Od /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /I "..\sapi\cgi\libfcgi\include" /D FCGI_STATIC=1 /D PHP_FASTCGI=1 /D "NDEBUG" /D ZEND_DEBUG=0 /D "_CONSOLE" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /Fr /FD /c
+# SUBTRACT CPP /YX /Yc /Yu
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 php5ts.lib winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:4.0 /subsystem:console /machine:I386 /nodefaultlib:"libc.lib" /out:"..\Release_TS\php.exe" /libpath:"..\Release_TS"
+# ADD LINK32 php5ts.lib winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /version:4.0 /subsystem:console /debug /machine:I386 /nodefaultlib:"libc.lib" /out:"..\Release_TSDbg\php.exe" /libpath:"..\Release_TSDbg"
+
+!ENDIF
+
+# Begin Target
+
+# Name "php5ts - Win32 Release_TS"
+# Name "php5ts - Win32 Debug_TS"
+# Name "php5ts - Win32 Release_TS_inline"
+# Name "php5ts - Win32 Release_TSDbg"
+# Begin Group "Source Files"
+
+# PROP Default_Filter ".c"
+# Begin Source File
+
+SOURCE=..\sapi\cgi\cgi_main.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\sapi\cgi\fastcgi.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\sapi\cgi\getopt.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter ".h"
+# Begin Source File
+
+SOURCE=..\sapi\cgi\php_getopt.h
+# End Source File
+# End Group
+# Begin Group "libfcgi"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\sapi\cgi\libfcgi\fcgiapp.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\sapi\cgi\libfcgi\os_win32.c
+# End Source File
+# End Group
+# Begin Source File
+
+SOURCE=.\php5ts.rc
+# End Source File
+# Begin Source File
+
+SOURCE=.\php5ts.rc2
+# End Source File
+# End Target
+# End Project
diff --git a/win32/php5ts.dsw b/win32/php5ts.dsw
new file mode 100644
index 0000000..61ccd1c
--- /dev/null
+++ b/win32/php5ts.dsw
@@ -0,0 +1,227 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "EngineSelect"=.\EngineSelect.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "TSRM"=..\TSRM\TSRM.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "ZendTS"=..\Zend\ZendTS.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name TSRM
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name EngineSelect
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "libsqlite"=..\ext\sqlite\libsqlite\src\libsqlite.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "php5aolserver"=..\sapi\aolserver\php5aolserver.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name php5dllts
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "php5apache"=..\sapi\apache\php5apache.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name php5dllts
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "php5apache2"=..\SAPI\APACHE2HANDLER\php5apache2.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name php5dllts
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "php5dllts"=.\php5dllts.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name ZendTS
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name TSRM
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libsqlite
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "php5isapi"=..\sapi\isapi\php5isapi.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name php5dllts
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "php5nsapi"=..\sapi\nsapi\php5nsapi.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name php5dllts
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "php5pi3web"=..\sapi\pi3web\php5pi3web.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name php5dllts
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "php5ts"=.\php5ts.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name php5dllts
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "php5ts_cli"=.\php5ts_cli.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name php5dllts
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "testsuite"=.\testsuite.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name php5ts
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/win32/php5ts.rc b/win32/php5ts.rc
new file mode 100644
index 0000000..d9a4aa5
--- /dev/null
+++ b/win32/php5ts.rc
@@ -0,0 +1,126 @@
+//Microsoft Developer Studio generated resource script.
+
+//
+
+#include "resource.h"
+
+
+
+#define APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+
+//
+
+// Generated from the TEXTINCLUDE 2 resource.
+
+//
+
+#include "winres.h"
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+#undef APSTUDIO_READONLY_SYMBOLS
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+// English (U.S.) resources
+
+
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+
+#ifdef _WIN32
+
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+
+#pragma code_page(1252)
+
+#endif //_WIN32
+
+
+
+#ifdef APSTUDIO_INVOKED
+
+/////////////////////////////////////////////////////////////////////////////
+
+//
+
+// TEXTINCLUDE
+
+//
+
+
+
+1 TEXTINCLUDE DISCARDABLE
+
+BEGIN
+
+ "resource.h\0"
+
+END
+
+
+
+2 TEXTINCLUDE DISCARDABLE
+
+BEGIN
+
+ "#include ""php5ts.rc2""\r\n"
+
+ "\0"
+
+END
+
+
+
+3 TEXTINCLUDE DISCARDABLE
+
+BEGIN
+
+ "\r\n"
+
+ "\0"
+
+END
+
+
+
+#endif // APSTUDIO_INVOKED
+
+
+
+#endif // English (U.S.) resources
+
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+
+
+
+
+#ifndef APSTUDIO_INVOKED
+
+/////////////////////////////////////////////////////////////////////////////
+
+//
+
+// Generated from the TEXTINCLUDE 3 resource.
+
+//
+
+#include "php5ts.rc2"
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+#endif // not APSTUDIO_INVOKED
+
+
+
diff --git a/win32/php5ts.rc2 b/win32/php5ts.rc2
new file mode 100644
index 0000000..3a53a90
--- /dev/null
+++ b/win32/php5ts.rc2
@@ -0,0 +1,61 @@
+//
+// php5dllts.RC2 - resources Microsoft Visual C++ does not edit directly
+//
+
+#ifdef APSTUDIO_INVOKED
+ #error this file is not editable by Microsoft Visual C++
+#endif //APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Add manually edited resources here...
+#include "../main/php_version.h"
+
+#define XSTRVER4(maj, min, rel, build) #maj "." #min "." #rel "." #build
+#define XSTRVER3(maj, min, rel) #maj "." #min "." #rel
+#define STRVER4(maj, min, rel, build) XSTRVER4(maj, min, rel, build)
+#define STRVER3(maj, min, rel) XSTRVER3(maj, min, rel)
+
+#ifndef _MAC
+//Version
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION PHP_MAJOR_VERSION,PHP_MINOR_VERSION,PHP_RELEASE_VERSION,PHP_RELEASE_VERSION
+ PRODUCTVERSION PHP_MAJOR_VERSION,PHP_MINOR_VERSION,PHP_RELEASE_VERSION,0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS VS_FF_DEBUG
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS VOS__WINDOWS32
+ FILETYPE VFT_APP
+ FILESUBTYPE VFT2_UNKNOWN
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "Comments", "\0"
+ VALUE "CompanyName", "The PHP Group\0"
+ VALUE "FileDescription", "PHP Script Interpreter\0"
+ VALUE "FileVersion", STRVER4(PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION, PHP_RELEASE_VERSION)
+ VALUE "InternalName", "php-cgi\0"
+ VALUE "LegalCopyright", "Copyright © 1997-2007 The PHP Group\0"
+ VALUE "LegalTrademarks", "php\0"
+ VALUE "OriginalFilename", "php.exe\0"
+ VALUE "PrivateBuild", "\0"
+ VALUE "ProductName", "PHP Thread Safe CGI\0"
+ VALUE "ProductVersion", STRVER3(PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION)
+ VALUE "SpecialBuild", PHP_EXTRA_VERSION "\0"
+ VALUE "URL", "http://www.php.net"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#endif // !_MAC
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/win32/php5ts_cli.dsp b/win32/php5ts_cli.dsp
new file mode 100644
index 0000000..37a4113
--- /dev/null
+++ b/win32/php5ts_cli.dsp
@@ -0,0 +1,175 @@
+# Microsoft Developer Studio Project File - Name="php5ts_cli" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=php5ts_cli - Win32 Debug_TS
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "php5ts_cli.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "php5ts_cli.mak" CFG="php5ts_cli - Win32 Debug_TS"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "php5ts_cli - Win32 Release_TS" (based on "Win32 (x86) Console Application")
+!MESSAGE "php5ts_cli - Win32 Debug_TS" (based on "Win32 (x86) Console Application")
+!MESSAGE "php5ts_cli - Win32 Release_TS_inline" (based on "Win32 (x86) Console Application")
+!MESSAGE "php5ts_cli - Win32 Release_TSDbg" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "php5ts_cli - Win32 Release_TS"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release_TS"
+# PROP BASE Intermediate_Dir "Release_TS"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "..\Release_TS"
+# PROP Intermediate_Dir "Release_TS"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_CONSOLE" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /Fr /FD /c
+# SUBTRACT CPP /YX /Yc /Yu
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 php5ts.lib winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:4.0 /subsystem:console /machine:I386 /nodefaultlib:"libc.lib" /out:"..\Release_TS\cli\php.exe" /libpath:"..\Release_TS"
+
+!ELSEIF "$(CFG)" == "php5ts_cli - Win32 Debug_TS"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug_TS"
+# PROP BASE Intermediate_Dir "Debug_TS"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "..\Debug_TS"
+# PROP Intermediate_Dir "Debug_TS"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /D "DEBUG" /D "_DEBUG" /D ZEND_DEBUG=1 /D "_CONSOLE" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /i "c:\include" /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 winmm.lib netapi32.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts_debug.lib /nologo /version:4.0 /subsystem:console /debug /machine:I386 /nodefaultlib:"libcd" /nodefaultlib:"libcmt" /out:"..\Debug_TS\cli\php.exe" /pdbtype:sept /libpath:"..\Debug_TS"
+# SUBTRACT LINK32 /pdb:none
+
+!ELSEIF "$(CFG)" == "php5ts_cli - Win32 Release_TS_inline"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "php5ts___Win32_Release_TS_inline"
+# PROP BASE Intermediate_Dir "php5ts___Win32_Release_TS_inline"
+# PROP BASE Ignore_Export_Lib 0
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "..\Release_TS_inline"
+# PROP Intermediate_Dir "Release_TS_inline"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /I "regex" /I "..\bindlib_w32" /I "Zend" /I "tsrm" /D "NDEBUG" /D "MSVC5" /D "_CONSOLE" /D "ZTS" /D "WIN32" /D "_MBCS" /D ZEND_DEBUG=0 /Fr /FD /c
+# SUBTRACT BASE CPP /YX /Yc /Yu
+# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "_CONSOLE" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /Fr /FD /c
+# SUBTRACT CPP /YX /Yc /Yu
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 php5ts.lib winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:3.0 /subsystem:console /machine:I386 /nodefaultlib:"libc.lib" /out:"Release_TS\php.exe" /libpath:"Release_TS"
+# ADD LINK32 php5ts.lib winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:4.0 /subsystem:console /machine:I386 /nodefaultlib:"libc.lib" /out:"..\Release_TS_inline\cli\php.exe" /libpath:"..\Release_TS_inline"
+
+!ELSEIF "$(CFG)" == "php5ts_cli - Win32 Release_TSDbg"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "php5ts___Win32_Release_TSDbg"
+# PROP BASE Intermediate_Dir "php5ts___Win32_Release_TSDbg"
+# PROP BASE Ignore_Export_Lib 0
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "..\Release_TSDbg"
+# PROP Intermediate_Dir "Release_TSDbg"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_CONSOLE" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /Fr /FD /c
+# SUBTRACT BASE CPP /YX /Yc /Yu
+# ADD CPP /nologo /MD /W3 /GX /Zi /Od /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_CONSOLE" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /Fr /FD /c
+# SUBTRACT CPP /YX /Yc /Yu
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 php5ts.lib winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:4.0 /subsystem:console /machine:I386 /nodefaultlib:"libc.lib" /out:"..\Release_TS\php.exe" /libpath:"..\Release_TS"
+# ADD LINK32 php5ts.lib winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:4.0 /subsystem:console /debug /machine:I386 /nodefaultlib:"libc.lib" /out:"..\Release_TSDbg\php.exe" /libpath:"..\Release_TSDbg"
+
+!ENDIF
+
+# Begin Target
+
+# Name "php5ts_cli - Win32 Release_TS"
+# Name "php5ts_cli - Win32 Debug_TS"
+# Name "php5ts_cli - Win32 Release_TS_inline"
+# Name "php5ts_cli - Win32 Release_TSDbg"
+# Begin Group "Source Files"
+
+# PROP Default_Filter ".c"
+# Begin Source File
+
+SOURCE=..\sapi\cli\getopt.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\sapi\cli\php_cli.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter ".h"
+# Begin Source File
+
+SOURCE=..\sapi\cli\php_getopt.h
+# End Source File
+# End Group
+# Begin Source File
+
+SOURCE=.\php5ts_cli.rc
+# End Source File
+# Begin Source File
+
+SOURCE=.\php5ts_cli.rc2
+# End Source File
+# End Target
+# End Project
diff --git a/win32/php5ts_cli.rc b/win32/php5ts_cli.rc
new file mode 100644
index 0000000..0053e0c
--- /dev/null
+++ b/win32/php5ts_cli.rc
@@ -0,0 +1,126 @@
+//Microsoft Developer Studio generated resource script.
+
+//
+
+#include "resource.h"
+
+
+
+#define APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+
+//
+
+// Generated from the TEXTINCLUDE 2 resource.
+
+//
+
+#include "winres.h"
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+#undef APSTUDIO_READONLY_SYMBOLS
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+// English (U.S.) resources
+
+
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+
+#ifdef _WIN32
+
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+
+#pragma code_page(1252)
+
+#endif //_WIN32
+
+
+
+#ifdef APSTUDIO_INVOKED
+
+/////////////////////////////////////////////////////////////////////////////
+
+//
+
+// TEXTINCLUDE
+
+//
+
+
+
+1 TEXTINCLUDE DISCARDABLE
+
+BEGIN
+
+ "resource.h\0"
+
+END
+
+
+
+2 TEXTINCLUDE DISCARDABLE
+
+BEGIN
+
+ "#include ""php5ts_cli.rc2""\r\n"
+
+ "\0"
+
+END
+
+
+
+3 TEXTINCLUDE DISCARDABLE
+
+BEGIN
+
+ "\r\n"
+
+ "\0"
+
+END
+
+
+
+#endif // APSTUDIO_INVOKED
+
+
+
+#endif // English (U.S.) resources
+
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+
+
+
+
+#ifndef APSTUDIO_INVOKED
+
+/////////////////////////////////////////////////////////////////////////////
+
+//
+
+// Generated from the TEXTINCLUDE 3 resource.
+
+//
+
+#include "php5ts_cli.rc2"
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+#endif // not APSTUDIO_INVOKED
+
+
+
diff --git a/win32/php5ts_cli.rc2 b/win32/php5ts_cli.rc2
new file mode 100644
index 0000000..517bd4a
--- /dev/null
+++ b/win32/php5ts_cli.rc2
@@ -0,0 +1,61 @@
+//
+// php5dllts.RC2 - resources Microsoft Visual C++ does not edit directly
+//
+
+#ifdef APSTUDIO_INVOKED
+ #error this file is not editable by Microsoft Visual C++
+#endif //APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Add manually edited resources here...
+#include "../main/php_version.h"
+
+#define XSTRVER4(maj, min, rel, build) #maj "." #min "." #rel "." #build
+#define XSTRVER3(maj, min, rel) #maj "." #min "." #rel
+#define STRVER4(maj, min, rel, build) XSTRVER4(maj, min, rel, build)
+#define STRVER3(maj, min, rel) XSTRVER3(maj, min, rel)
+
+#ifndef _MAC
+//Version
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION PHP_MAJOR_VERSION,PHP_MINOR_VERSION,PHP_RELEASE_VERSION,PHP_RELEASE_VERSION
+ PRODUCTVERSION PHP_MAJOR_VERSION,PHP_MINOR_VERSION,PHP_RELEASE_VERSION,0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS VS_FF_DEBUG
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS VOS__WINDOWS32
+ FILETYPE VFT_APP
+ FILESUBTYPE VFT2_UNKNOWN
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "Comments", "\0"
+ VALUE "CompanyName", "The PHP Group\0"
+ VALUE "FileDescription", "PHP Script Interpreter\0"
+ VALUE "FileVersion", STRVER4(PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION, PHP_RELEASE_VERSION)
+ VALUE "InternalName", "php-cli\0"
+ VALUE "LegalCopyright", "Copyright © 1997-2006 The PHP Group\0"
+ VALUE "LegalTrademarks", "php\0"
+ VALUE "OriginalFilename", "php.exe\0"
+ VALUE "PrivateBuild", "\0"
+ VALUE "ProductName", "PHP Thread Safe Command Line Interface\0"
+ VALUE "ProductVersion", STRVER3(PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION)
+ VALUE "SpecialBuild", PHP_EXTRA_VERSION "\0"
+ VALUE "URL", "http://www.php.net"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#endif // !_MAC
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/win32/php_modules.dsw b/win32/php_modules.dsw
new file mode 100644
index 0000000..81f22fa
--- /dev/null
+++ b/win32/php_modules.dsw
@@ -0,0 +1,473 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "bz2"=..\ext\bz2\bz2.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "ctype"=..\ext\ctype\ctype.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "curl"=..\ext\curl\curl.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "dba"=..\ext\dba\dba.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "dbase"=..\ext\dbase\dbase.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "dbx"=..\ext\dbx\dbx.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "exif"=..\ext\exif\exif.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "fbsql"=..\ext\fbsql\fbsql.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "fdf"=..\ext\fdf\fdf.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "filepro"=..\ext\filepro\filepro.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "gd"=..\ext\gd\gd.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "gettext"=..\ext\gettext\gettext.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "iconv"=..\ext\iconv\iconv.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "ifx"=..\ext\informix\ifx.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "imap"=..\ext\imap\imap.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "ingres"=..\ext\ingres_ii\ingres.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "interbase"=..\ext\interbase\interbase.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "ldap"=..\ext\ldap\ldap.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "mbstring"=..\ext\mbstring\mbstring.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "mcrypt"=..\ext\mcrypt\mcrypt.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "mcve"=..\ext\mcve\mcve.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "mhash"=..\ext\mhash\mhash.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "mime_magic"=..\ext\mime_magic\mime_magic.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "ming"=..\ext\ming\ming.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "msql"=..\ext\msql\msql.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "mssql"=..\ext\mssql\mssql.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "mysql"=..\ext\mysql\mysql.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "oci8"=..\ext\oci8\oci8.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "openssl"=..\ext\openssl\openssl.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "oracle"=..\ext\oracle\oracle.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "pgsql"=..\ext\pgsql\pgsql.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "shmop"=..\ext\shmop\shmop.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "snmp"=..\ext\snmp\snmp.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "sockets"=..\ext\sockets\sockets.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "sybase_ct"=..\ext\sybase_ct\sybase_ct.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "tokenizer"=..\ext\tokenizer\tokenizer.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "xmlrpc"=..\ext\xmlrpc\xmlrpc.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "xsl"=..\ext\xsl\xsl.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/win32/php_registry.h b/win32/php_registry.h
new file mode 100644
index 0000000..2b111db
--- /dev/null
+++ b/win32/php_registry.h
@@ -0,0 +1,8 @@
+#ifndef PHP_REGISTRY_H
+#define PHP_REGISTRY_H
+
+
+void UpdateIniFromRegistry(char *path TSRMLS_DC);
+char *GetIniPathFromRegistry();
+
+#endif /* PHP_REGISTRY_H */
diff --git a/win32/php_stdbool.h b/win32/php_stdbool.h
new file mode 100644
index 0000000..83c808f
--- /dev/null
+++ b/win32/php_stdbool.h
@@ -0,0 +1,11 @@
+#ifndef _STDBOOL_H
+#define _STDBOOL_H
+#if !defined(__BOOL_DEFINED)
+# define bool short
+
+/* The other macros must be usable in preprocessor directives. */
+# define false 0
+# define true 1
+# define __bool_true_false_are_defined 1
+# endif
+#endif /* _STDBOOL_H */
diff --git a/win32/php_stdint.h b/win32/php_stdint.h
new file mode 100644
index 0000000..5df1df4
--- /dev/null
+++ b/win32/php_stdint.h
@@ -0,0 +1,251 @@
+// ISO C9x compliant stdint.h for Microsoft Visual Studio
+// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
+//
+// Copyright (c) 2006-2009 Alexander Chemeris
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// 3. The name of the author may be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _MSC_VER // [
+#error "Use this header only with Microsoft Visual C++ compilers!"
+#endif // _MSC_VER ]
+
+#ifndef _MSC_STDINT_H_ // [
+#define _MSC_STDINT_H_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif
+
+#include <limits.h>
+
+// For Visual Studio 6 in C++ mode wrap <wchar.h> include with 'extern "C++" {}'
+// or compiler give many errors like this:
+// error C2733: second C linkage of overloaded function 'wmemchr' not allowed
+#if (_MSC_VER < 1300) && defined(__cplusplus)
+ extern "C++" {
+#endif
+# include <wchar.h>
+#if (_MSC_VER < 1300) && defined(__cplusplus)
+ }
+#endif
+
+// Define _W64 macros to mark types changing their size, like intptr_t.
+#ifndef _W64
+# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
+# define _W64 __w64
+# else
+# define _W64
+# endif
+#endif
+
+
+// 7.18.1 Integer types
+
+// 7.18.1.1 Exact-width integer types
+typedef __int8 int8_t;
+typedef __int16 int16_t;
+#ifndef int32_t
+typedef __int32 int32_t;
+#endif
+#ifndef int64_t
+typedef __int64 int64_t;
+#endif
+#ifndef uint8_t
+typedef unsigned __int8 uint8_t;
+#endif
+#ifndef u_char
+typedef unsigned __int8 u_char;
+#endif
+typedef unsigned __int16 uint16_t;
+#ifndef uint32_t
+typedef unsigned __int32 uint32_t;
+#endif
+typedef unsigned __int64 uint64_t;
+
+// 7.18.1.2 Minimum-width integer types
+typedef int8_t int_least8_t;
+typedef int16_t int_least16_t;
+typedef int32_t int_least32_t;
+typedef int64_t int_least64_t;
+typedef uint8_t uint_least8_t;
+typedef uint16_t uint_least16_t;
+typedef uint32_t uint_least32_t;
+typedef uint64_t uint_least64_t;
+
+// 7.18.1.3 Fastest minimum-width integer types
+typedef int8_t int_fast8_t;
+typedef int16_t int_fast16_t;
+typedef int32_t int_fast32_t;
+typedef int64_t int_fast64_t;
+typedef uint8_t uint_fast8_t;
+typedef uint16_t uint_fast16_t;
+typedef uint32_t uint_fast32_t;
+typedef uint32_t u_int32_t;
+typedef uint64_t uint_fast64_t;
+
+// 7.18.1.4 Integer types capable of holding object pointers
+#ifdef _WIN64 // [
+ typedef __int64 intptr_t;
+ typedef unsigned __int64 uintptr_t;
+#else // _WIN64 ][
+ typedef _W64 int intptr_t;
+ typedef _W64 unsigned int uintptr_t;
+#endif // _WIN64 ]
+
+// 7.18.1.5 Greatest-width integer types
+typedef int64_t intmax_t;
+typedef uint64_t uintmax_t;
+
+
+// 7.18.2 Limits of specified-width integer types
+
+#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259
+
+// 7.18.2.1 Limits of exact-width integer types
+#define INT8_MIN ((int8_t)_I8_MIN)
+#define INT8_MAX _I8_MAX
+#define INT16_MIN ((int16_t)_I16_MIN)
+#define INT16_MAX _I16_MAX
+#define INT32_MIN ((int32_t)_I32_MIN)
+#define INT32_MAX _I32_MAX
+#define INT64_MIN ((int64_t)_I64_MIN)
+#define INT64_MAX _I64_MAX
+#define UINT8_MAX _UI8_MAX
+#define UINT16_MAX _UI16_MAX
+#define UINT32_MAX _UI32_MAX
+#define UINT64_MAX _UI64_MAX
+
+// 7.18.2.2 Limits of minimum-width integer types
+#define INT_LEAST8_MIN INT8_MIN
+#define INT_LEAST8_MAX INT8_MAX
+#define INT_LEAST16_MIN INT16_MIN
+#define INT_LEAST16_MAX INT16_MAX
+#define INT_LEAST32_MIN INT32_MIN
+#define INT_LEAST32_MAX INT32_MAX
+#define INT_LEAST64_MIN INT64_MIN
+#define INT_LEAST64_MAX INT64_MAX
+#define UINT_LEAST8_MAX UINT8_MAX
+#define UINT_LEAST16_MAX UINT16_MAX
+#define UINT_LEAST32_MAX UINT32_MAX
+#define UINT_LEAST64_MAX UINT64_MAX
+
+// 7.18.2.3 Limits of fastest minimum-width integer types
+#define INT_FAST8_MIN INT8_MIN
+#define INT_FAST8_MAX INT8_MAX
+#define INT_FAST16_MIN INT16_MIN
+#define INT_FAST16_MAX INT16_MAX
+#define INT_FAST32_MIN INT32_MIN
+#define INT_FAST32_MAX INT32_MAX
+#define INT_FAST64_MIN INT64_MIN
+#define INT_FAST64_MAX INT64_MAX
+#define UINT_FAST8_MAX UINT8_MAX
+#define UINT_FAST16_MAX UINT16_MAX
+#define UINT_FAST32_MAX UINT32_MAX
+#define UINT_FAST64_MAX UINT64_MAX
+
+// 7.18.2.4 Limits of integer types capable of holding object pointers
+#ifdef _WIN64 // [
+# define INTPTR_MIN INT64_MIN
+# define INTPTR_MAX INT64_MAX
+# define UINTPTR_MAX UINT64_MAX
+#else // _WIN64 ][
+# define INTPTR_MIN INT32_MIN
+# define INTPTR_MAX INT32_MAX
+# define UINTPTR_MAX UINT32_MAX
+#endif // _WIN64 ]
+
+// 7.18.2.5 Limits of greatest-width integer types
+#define INTMAX_MIN INT64_MIN
+#define INTMAX_MAX INT64_MAX
+#define UINTMAX_MAX UINT64_MAX
+
+// 7.18.3 Limits of other integer types
+
+#ifdef _WIN64 // [
+# define PTRDIFF_MIN _I64_MIN
+# define PTRDIFF_MAX _I64_MAX
+#else // _WIN64 ][
+# define PTRDIFF_MIN _I32_MIN
+# define PTRDIFF_MAX _I32_MAX
+#endif // _WIN64 ]
+
+#define SIG_ATOMIC_MIN INT_MIN
+#define SIG_ATOMIC_MAX INT_MAX
+
+#ifndef SIZE_MAX // [
+# ifdef _WIN64 // [
+# define SIZE_MAX _UI64_MAX
+# else // _WIN64 ][
+# define SIZE_MAX _UI32_MAX
+# endif // _WIN64 ]
+#endif // SIZE_MAX ]
+
+// WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h>
+#ifndef WCHAR_MIN // [
+# define WCHAR_MIN 0
+#endif // WCHAR_MIN ]
+#ifndef WCHAR_MAX // [
+# define WCHAR_MAX _UI16_MAX
+#endif // WCHAR_MAX ]
+
+#define WINT_MIN 0
+#define WINT_MAX _UI16_MAX
+
+#endif // __STDC_LIMIT_MACROS ]
+
+
+// 7.18.4 Limits of other integer types
+
+#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260
+
+// 7.18.4.1 Macros for minimum-width integer constants
+
+#define INT8_C(val) val##i8
+#define INT16_C(val) val##i16
+#define INT32_C(val) val##i32
+#define INT64_C(val) val##i64
+
+#define UINT8_C(val) val##ui8
+#define UINT16_C(val) val##ui16
+#define UINT32_C(val) val##ui32
+#define UINT64_C(val) val##ui64
+
+// 7.18.4.2 Macros for greatest-width integer constants
+#define INTMAX_C INT64_C
+#define UINTMAX_C UINT64_C
+
+#if _MSC_VER < 1600
+static __inline int64_t llabs(int64_t i)
+{
+ return i >= 0 ? i: -i;
+}
+#endif
+
+#endif // __STDC_CONSTANT_MACROS ]
+
+
+#endif // _MSC_STDINT_H_ ]
diff --git a/win32/php_strtoi64.h b/win32/php_strtoi64.h
new file mode 100644
index 0000000..633ecb1
--- /dev/null
+++ b/win32/php_strtoi64.h
@@ -0,0 +1,7 @@
+#if _MSC_VERS <= 1300
+#include "php.h"
+#include "php_stdint.h"
+
+PHPAPI int64_t _strtoi64(const char *nptr, char **endptr, int base);
+#define _strtoui64 _strtoi64
+#endif
diff --git a/win32/php_win32_globals.h b/win32/php_win32_globals.h
new file mode 100644
index 0000000..1686e5d
--- /dev/null
+++ b/win32/php_win32_globals.h
@@ -0,0 +1,55 @@
+/*
+ +----------------------------------------------------------------------+
+ | PHP Version 5 |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1997-2013 The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Author: Wez Furlong <wez@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id$ */
+
+#ifndef PHP_WIN32_GLOBALS_H
+#define PHP_WIN32_GLOBALS_H
+
+/* misc globals for thread-safety under win32 */
+
+typedef struct _php_win32_core_globals php_win32_core_globals;
+
+#ifdef ZTS
+# define PW32G(v) TSRMG(php_win32_core_globals_id, php_win32_core_globals*, v)
+extern PHPAPI int php_win32_core_globals_id;
+#else
+# define PW32G(v) (the_php_win32_core_globals.v)
+extern PHPAPI struct _php_win32_core_globals the_php_win32_core_globals;
+#endif
+
+struct _php_win32_core_globals {
+ /* syslog */
+ char *log_header;
+ HANDLE log_source;
+
+ /* time */
+ struct timeval starttime;
+ __int64 lasttime, freq;
+
+ HKEY registry_key;
+ HANDLE registry_event;
+ HashTable *registry_directories;
+};
+
+void php_win32_core_globals_ctor(void *vg TSRMLS_DC);
+void php_win32_core_globals_dtor(void *vg TSRMLS_DC);
+PHP_RSHUTDOWN_FUNCTION(win32_core_globals);
+
+#endif
+
diff --git a/win32/pws-php5cgi.reg b/win32/pws-php5cgi.reg
new file mode 100644
index 0000000..46edc77
--- /dev/null
+++ b/win32/pws-php5cgi.reg
@@ -0,0 +1,6 @@
+REGEDIT4
+
+[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\w3svc\parameters\Script Map]
+".php"="[PUT PATH HERE]\\php.exe"
+
+
diff --git a/win32/pws-php5isapi.reg b/win32/pws-php5isapi.reg
new file mode 100644
index 0000000..393604d
--- /dev/null
+++ b/win32/pws-php5isapi.reg
@@ -0,0 +1,5 @@
+REGEDIT4
+
+[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\w3svc\parameters\Script Map]
+".php"="[PUT PATH HERE]\\php5isapi.dll"
+
diff --git a/win32/readdir.c b/win32/readdir.c
new file mode 100644
index 0000000..9525fc0
--- /dev/null
+++ b/win32/readdir.c
@@ -0,0 +1,168 @@
+#include <malloc.h>
+#include <string.h>
+#include <errno.h>
+
+#include "php.h"
+#include "readdir.h"
+#include "TSRM.h"
+/**********************************************************************
+ * Implement dirent-style opendir/readdir/rewinddir/closedir on Win32
+ *
+ * Functions defined are opendir(), readdir(), rewinddir() and
+ * closedir() with the same prototypes as the normal dirent.h
+ * implementation.
+ *
+ * Does not implement telldir(), seekdir(), or scandir(). The dirent
+ * struct is compatible with Unix, except that d_ino is always 1 and
+ * d_off is made up as we go along.
+ *
+ * The DIR typedef is not compatible with Unix.
+ **********************************************************************/
+
+DIR *opendir(const char *dir)
+{
+ DIR *dp;
+ char *filespec;
+ HANDLE handle;
+ int index;
+ char resolved_path_buff[MAXPATHLEN];
+ TSRMLS_FETCH();
+
+ if (!VCWD_REALPATH(dir, resolved_path_buff)) {
+ return NULL;
+ }
+
+ filespec = (char *)malloc(strlen(resolved_path_buff) + 2 + 1);
+ if (filespec == NULL) {
+ return NULL;
+ }
+ strcpy(filespec, resolved_path_buff);
+ index = strlen(filespec) - 1;
+ if (index >= 0 && (filespec[index] == '/' ||
+ (filespec[index] == '\\' && (index == 0 || !IsDBCSLeadByte(filespec[index-1])))))
+ filespec[index] = '\0';
+ strcat(filespec, "\\*");
+
+ dp = (DIR *) malloc(sizeof(DIR));
+ if (dp == NULL) {
+ return NULL;
+ }
+ dp->offset = 0;
+ dp->finished = 0;
+
+ if ((handle = FindFirstFile(filespec, &(dp->fileinfo))) == INVALID_HANDLE_VALUE) {
+ DWORD err = GetLastError();
+ if (err == ERROR_NO_MORE_FILES || err == ERROR_FILE_NOT_FOUND) {
+ dp->finished = 1;
+ } else {
+ free(dp);
+ free(filespec);
+ return NULL;
+ }
+ }
+ dp->dir = strdup(resolved_path_buff);
+ dp->handle = handle;
+ free(filespec);
+
+ return dp;
+}
+
+struct dirent *readdir(DIR *dp)
+{
+ if (!dp || dp->finished)
+ return NULL;
+
+ if (dp->offset != 0) {
+ if (FindNextFile(dp->handle, &(dp->fileinfo)) == 0) {
+ dp->finished = 1;
+ return NULL;
+ }
+ }
+ dp->offset++;
+
+ strlcpy(dp->dent.d_name, dp->fileinfo.cFileName, _MAX_FNAME+1);
+ dp->dent.d_ino = 1;
+ dp->dent.d_reclen = strlen(dp->dent.d_name);
+ dp->dent.d_off = dp->offset;
+
+ return &(dp->dent);
+}
+
+int readdir_r(DIR *dp, struct dirent *entry, struct dirent **result)
+{
+ if (!dp || dp->finished) {
+ *result = NULL;
+ return 0;
+ }
+
+ if (dp->offset != 0) {
+ if (FindNextFile(dp->handle, &(dp->fileinfo)) == 0) {
+ dp->finished = 1;
+ *result = NULL;
+ return 0;
+ }
+ }
+ dp->offset++;
+
+ strlcpy(dp->dent.d_name, dp->fileinfo.cFileName, _MAX_FNAME+1);
+ dp->dent.d_ino = 1;
+ dp->dent.d_reclen = strlen(dp->dent.d_name);
+ dp->dent.d_off = dp->offset;
+
+ memcpy(entry, &dp->dent, sizeof(*entry));
+
+ *result = &dp->dent;
+
+ return 0;
+}
+
+int closedir(DIR *dp)
+{
+ if (!dp)
+ return 0;
+ /* It is valid to scan an empty directory but we have an invalid
+ handle in this case (no first file found). */
+ if (dp->handle != INVALID_HANDLE_VALUE) {
+ FindClose(dp->handle);
+ }
+ if (dp->dir)
+ free(dp->dir);
+ if (dp)
+ free(dp);
+
+ return 0;
+}
+
+int rewinddir(DIR *dp)
+{
+ /* Re-set to the beginning */
+ char *filespec;
+ HANDLE handle;
+ int index;
+
+ FindClose(dp->handle);
+
+ dp->offset = 0;
+ dp->finished = 0;
+
+ filespec = (char *)malloc(strlen(dp->dir) + 2 + 1);
+ if (filespec == NULL) {
+ return -1;
+ }
+
+ strcpy(filespec, dp->dir);
+ index = strlen(filespec) - 1;
+ if (index >= 0 && (filespec[index] == '/' ||
+ (filespec[index] == '\\' && (index == 0 || !IsDBCSLeadByte(filespec[index-1])))))
+ filespec[index] = '\0';
+ strcat(filespec, "/*");
+
+ if ((handle = FindFirstFile(filespec, &(dp->fileinfo))) == INVALID_HANDLE_VALUE) {
+ dp->finished = 1;
+ }
+
+ dp->handle = handle;
+ free(filespec);
+
+ return 0;
+}
diff --git a/win32/readdir.h b/win32/readdir.h
new file mode 100644
index 0000000..f1fb3a7
--- /dev/null
+++ b/win32/readdir.h
@@ -0,0 +1,49 @@
+#ifndef READDIR_H
+#define READDIR_H
+
+
+/*
+ * Structures and types used to implement opendir/readdir/closedir
+ * on Windows 95/NT.
+ */
+
+#include <config.w32.h>
+
+#include <windows.h>
+
+#include <io.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <direct.h>
+
+#define php_readdir_r readdir_r
+
+/* struct dirent - same as Unix */
+
+struct dirent {
+ long d_ino; /* inode (always 1 in WIN32) */
+ off_t d_off; /* offset to this dirent */
+ unsigned short d_reclen; /* length of d_name */
+ char d_name[_MAX_FNAME + 1]; /* filename (null terminated) */
+};
+
+
+/* typedef DIR - not the same as Unix */
+typedef struct {
+ HANDLE handle; /* _findfirst/_findnext handle */
+ short offset; /* offset into directory */
+ short finished; /* 1 if there are not more files */
+ WIN32_FIND_DATA fileinfo; /* from _findfirst/_findnext */
+ char *dir; /* the dir we are reading */
+ struct dirent dent; /* the dirent to return */
+} DIR;
+
+/* Function prototypes */
+DIR *opendir(const char *);
+struct dirent *readdir(DIR *);
+int readdir_r(DIR *, struct dirent *, struct dirent **);
+int closedir(DIR *);
+int rewinddir(DIR *);
+
+#endif /* READDIR_H */
diff --git a/win32/registry.c b/win32/registry.c
new file mode 100644
index 0000000..685a09d
--- /dev/null
+++ b/win32/registry.c
@@ -0,0 +1,297 @@
+#include "php.h"
+#include "php_ini.h"
+#include "php_win32_globals.h"
+
+#define PHP_REGISTRY_KEY "SOFTWARE\\PHP"
+
+#define PHP_VER1(V1) #V1
+#define PHP_VER2(V1,V2) #V1"."#V2
+#define PHP_VER3(V1,V2,V3) #V1"."#V2"."#V3
+
+#define PHP_REGISTRY_KEYV(VER) PHP_REGISTRY_KEY"\\"VER
+#define PHP_REGISTRY_KEY1(V1) PHP_REGISTRY_KEY"\\"PHP_VER1(V1)
+#define PHP_REGISTRY_KEY2(V1,V2) PHP_REGISTRY_KEY"\\"PHP_VER2(V1,V2)
+#define PHP_REGISTRY_KEY3(V1,V2,V3) PHP_REGISTRY_KEY"\\"PHP_VER3(V1,V2,V3)
+
+static const char* registry_keys[] = {
+ PHP_REGISTRY_KEYV(PHP_VERSION),
+ PHP_REGISTRY_KEY3(PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION),
+ PHP_REGISTRY_KEY2(PHP_MAJOR_VERSION, PHP_MINOR_VERSION),
+ PHP_REGISTRY_KEY1(PHP_MAJOR_VERSION),
+ PHP_REGISTRY_KEY,
+ NULL
+};
+
+static int OpenPhpRegistryKey(char* sub_key, HKEY *hKey)
+{
+ const char **key_name = registry_keys;
+
+ if (sub_key) {
+ int main_key_len;
+ int sub_key_len = strlen(sub_key);
+ char *reg_key;
+
+ while (*key_name) {
+ LONG ret;
+
+ main_key_len = strlen(*key_name);
+ reg_key = emalloc(main_key_len + sub_key_len + 1);
+ memcpy(reg_key, *key_name, main_key_len);
+ memcpy(reg_key + main_key_len, sub_key, sub_key_len + 1);
+ ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, reg_key, 0, KEY_READ, hKey);
+ efree(reg_key);
+
+ if (ret == ERROR_SUCCESS) {
+ return 1;
+ }
+ ++key_name;
+ }
+ } else {
+ while (*key_name) {
+ if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, *key_name, 0, KEY_READ, hKey) == ERROR_SUCCESS) {
+ return 1;
+ }
+ ++key_name;
+ }
+ }
+ return 0;
+}
+
+static int LoadDirectory(HashTable *directories, HKEY key, char *path, int path_len, HashTable *parent_ht)
+{
+ DWORD keys, values, max_key, max_name, max_value;
+ int ret = 0;
+ HashTable *ht = NULL;
+
+ if (RegQueryInfoKey(key, NULL, NULL, NULL, &keys, &max_key, NULL, &values, &max_name, &max_value, NULL, NULL) == ERROR_SUCCESS) {
+
+ if (values) {
+ DWORD i;
+ char *name = (char*)emalloc(max_name+1);
+ char *value = (char*)emalloc(max_value+1);
+ DWORD name_len, type, value_len;
+ zval *data;
+
+ for (i = 0; i < values; i++) {
+ name_len = max_name+1;
+ value_len = max_value+1;
+ if (RegEnumValue(key, i, name, &name_len, NULL, &type, value, &value_len) == ERROR_SUCCESS) {
+ if ((type == REG_SZ) || (type == REG_EXPAND_SZ)) {
+ if (!ht) {
+ ht = (HashTable*)malloc(sizeof(HashTable));
+ if (!ht) {
+ return ret;
+ }
+ zend_hash_init(ht, 0, NULL, ZVAL_INTERNAL_PTR_DTOR, 1);
+ }
+ data = (zval*)malloc(sizeof(zval));
+ if (!data) {
+ return ret;
+ }
+ INIT_PZVAL(data);
+ Z_STRVAL_P(data) = zend_strndup(value, value_len-1);
+ Z_STRLEN_P(data) = value_len-1;
+ Z_TYPE_P(data) = IS_STRING;
+ zend_hash_update(ht, name, name_len+1, &data, sizeof(zval*), NULL);
+ }
+ }
+ }
+ if (ht) {
+ if (parent_ht) {
+ HashPosition pos;
+ char *index;
+ uint index_len;
+ ulong num;
+ zval **tmpdata;
+
+ for (zend_hash_internal_pointer_reset_ex(parent_ht, &pos);
+ zend_hash_get_current_data_ex(parent_ht, (void**)&tmpdata, &pos) == SUCCESS &&
+ zend_hash_get_current_key_ex(parent_ht, &index, &index_len, &num, 0, &pos) == HASH_KEY_IS_STRING;
+ zend_hash_move_forward_ex(parent_ht, &pos)) {
+ if (zend_hash_add(ht, index, index_len, tmpdata, sizeof(zval*), NULL) == SUCCESS) {
+ Z_ADDREF_PP(tmpdata);
+ }
+ }
+ }
+ zend_hash_update(directories, path, path_len+1, &ht, sizeof(HashTable*), NULL);
+ ret = 1;
+ }
+
+ efree(name);
+ efree(value);
+ }
+
+ if (ht == NULL) {
+ ht = parent_ht;
+ }
+
+ if (keys) {
+ DWORD i;
+ char *name = (char*)emalloc(max_key+1);
+ char *new_path = (char*)emalloc(path_len+max_key+2);
+ DWORD name_len;
+ FILETIME t;
+ HKEY subkey;
+
+ for (i = 0; i < keys; i++) {
+ name_len = max_key+1;
+ if (RegEnumKeyEx(key, i, name, &name_len, NULL, NULL, NULL, &t) == ERROR_SUCCESS) {
+ if (RegOpenKeyEx(key, name, 0, KEY_READ, &subkey) == ERROR_SUCCESS) {
+ if (path_len) {
+ memcpy(new_path, path, path_len);
+ new_path[path_len] = '/';
+ memcpy(new_path+path_len+1, name, name_len+1);
+ zend_str_tolower(new_path, path_len+name_len+1);
+ name_len += path_len+1;
+ } else {
+ memcpy(new_path, name, name_len+1);
+ zend_str_tolower(new_path, name_len);
+ }
+ if (LoadDirectory(directories, subkey, new_path, name_len, ht)) {
+ ret = 1;
+ }
+ RegCloseKey(subkey);
+ }
+ }
+ }
+ efree(new_path);
+ efree(name);
+ }
+ }
+ return ret;
+}
+
+static void delete_internal_hashtable(void *data)
+{
+ zend_hash_destroy(*(HashTable**)data);
+ free(*(HashTable**)data);
+}
+
+#define RegNotifyFlags (REG_NOTIFY_CHANGE_NAME | REG_NOTIFY_CHANGE_ATTRIBUTES | REG_NOTIFY_CHANGE_LAST_SET)
+
+void UpdateIniFromRegistry(char *path TSRMLS_DC)
+{
+ char *p, *orig_path;
+ int path_len;
+ HashTable **pht;
+
+ if(!path) {
+ return;
+ }
+
+ if (!PW32G(registry_directories)) {
+ PW32G(registry_directories) = (HashTable*)malloc(sizeof(HashTable));
+ if (!PW32G(registry_directories)) {
+ return;
+ }
+ zend_hash_init(PW32G(registry_directories), 0, NULL, delete_internal_hashtable, 1);
+ if (!OpenPhpRegistryKey("\\Per Directory Values", &PW32G(registry_key))) {
+ PW32G(registry_key) = NULL;
+ return;
+ }
+ PW32G(registry_event) = CreateEvent(NULL, TRUE, FALSE, NULL);
+ if (PW32G(registry_event)) {
+ RegNotifyChangeKeyValue(PW32G(registry_key), TRUE, RegNotifyFlags, PW32G(registry_event), TRUE);
+ }
+ if (!LoadDirectory(PW32G(registry_directories), PW32G(registry_key), "", 0, NULL)) {
+ return;
+ }
+ } else if (PW32G(registry_event) && WaitForSingleObject(PW32G(registry_event), 0) == WAIT_OBJECT_0) {
+ RegNotifyChangeKeyValue(PW32G(registry_key), TRUE, RegNotifyFlags, PW32G(registry_event), TRUE);
+ zend_hash_clean(PW32G(registry_directories));
+ if (!LoadDirectory(PW32G(registry_directories), PW32G(registry_key), "", 0, NULL)) {
+ return;
+ }
+ } else if (zend_hash_num_elements(PW32G(registry_directories)) == 0) {
+ return;
+ }
+
+ orig_path = path = estrdup(path);
+
+ /* Get rid of C:, if exists */
+ p = strchr(path, ':');
+ if (p) {
+ *p = path[0]; /* replace the colon with the drive letter */
+ path = p; /* make path point to the drive letter */
+ } else {
+ if (path[0] != '\\' && path[0] != '/') {
+ char tmp_buf[MAXPATHLEN], *cwd;
+ char drive_letter;
+
+ /* get current working directory and prepend it to the path */
+ if (!VCWD_GETCWD(tmp_buf, MAXPATHLEN)) {
+ efree(orig_path);
+ return;
+ }
+ cwd = strchr(tmp_buf, ':');
+ if (!cwd) {
+ drive_letter = 'C';
+ cwd = tmp_buf;
+ } else {
+ drive_letter = tmp_buf[0];
+ cwd++;
+ }
+ while (*cwd == '\\' || *cwd == '/') {
+ cwd++;
+ }
+ spprintf(&path, 0, "%c\\%s\\%s", drive_letter, cwd, orig_path);
+ efree(orig_path);
+ orig_path = path;
+ }
+ }
+
+ path_len = 0;
+ while (path[path_len] != 0) {
+ if (path[path_len] == '\\') {
+ path[path_len] = '/';
+ }
+ path_len++;
+ }
+ zend_str_tolower(path, path_len);
+ while (path_len >= 0) {
+ if (zend_hash_find(PW32G(registry_directories), path, path_len+1, (void**)&pht) == SUCCESS) {
+ HashTable *ht = *pht;
+ HashPosition pos;
+ char *index;
+ uint index_len;
+ ulong num;
+ zval **data;
+
+ for (zend_hash_internal_pointer_reset_ex(ht, &pos);
+ zend_hash_get_current_data_ex(ht, (void**)&data, &pos) == SUCCESS &&
+ zend_hash_get_current_key_ex(ht, &index, &index_len, &num, 0, &pos) == HASH_KEY_IS_STRING;
+ zend_hash_move_forward_ex(ht, &pos)) {
+ zend_alter_ini_entry(index, index_len, Z_STRVAL_PP(data), Z_STRLEN_PP(data), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
+ }
+ break;
+ }
+ if (--path_len > 0) {
+ while (path_len > 0 && path[path_len] != '/') {
+ path_len--;
+ }
+ }
+ path[path_len] = 0;
+ }
+
+ efree(orig_path);
+}
+
+#define PHPRC_REGISTRY_NAME "IniFilePath"
+
+char *GetIniPathFromRegistry()
+{
+ char *reg_location = NULL;
+ HKEY hKey;
+
+ if (OpenPhpRegistryKey(NULL, &hKey)) {
+ DWORD buflen = MAXPATHLEN;
+ reg_location = emalloc(MAXPATHLEN+1);
+ if(RegQueryValueEx(hKey, PHPRC_REGISTRY_NAME, 0, NULL, reg_location, &buflen) != ERROR_SUCCESS) {
+ efree(reg_location);
+ reg_location = NULL;
+ return reg_location;
+ }
+ RegCloseKey(hKey);
+ }
+ return reg_location;
+}
diff --git a/win32/resource.h b/win32/resource.h
new file mode 100644
index 0000000..3e7e4c0
--- /dev/null
+++ b/win32/resource.h
@@ -0,0 +1,15 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Developer Studio generated include file.
+// Used by php5dllts.rc
+//
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1000
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/win32/select.c b/win32/select.c
new file mode 100644
index 0000000..d77ef3d
--- /dev/null
+++ b/win32/select.c
@@ -0,0 +1,176 @@
+/*
+ +----------------------------------------------------------------------+
+ | PHP Version 5 |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1997-2013 The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Author: Wez Furlong <wez@thebrainroom.com> |
+ +----------------------------------------------------------------------+
+*/
+
+#include "php.h"
+#include "php_network.h"
+
+#ifdef PHP_WIN32
+
+/* $Id$ */
+
+/* Win32 select() will only work with sockets, so we roll our own implementation here.
+ * - If you supply only sockets, this simply passes through to winsock select().
+ * - If you supply file handles, there is no way to distinguish between
+ * ready for read/write or OOB, so any set in which the handle is found will
+ * be marked as ready.
+ * - If you supply a mixture of handles and sockets, the system will interleave
+ * calls between select() and WaitForMultipleObjects(). The time slicing may
+ * cause this function call to take up to 100 ms longer than you specified.
+ * - Calling this with NULL sets as a portable way to sleep with sub-second
+ * accuracy is not supported.
+ * */
+PHPAPI int php_select(int max_fd, fd_set *rfds, fd_set *wfds, fd_set *efds, struct timeval *tv)
+{
+ DWORD ms_total, limit;
+ HANDLE handles[MAXIMUM_WAIT_OBJECTS];
+ int handle_slot_to_fd[MAXIMUM_WAIT_OBJECTS];
+ int n_handles = 0, i;
+ fd_set sock_read, sock_write, sock_except;
+ fd_set aread, awrite, aexcept;
+ int sock_max_fd = -1;
+ struct timeval tvslice;
+ int retcode;
+
+#define SAFE_FD_ISSET(fd, set) (set != NULL && FD_ISSET(fd, set))
+
+ /* calculate how long we need to wait in milliseconds */
+ if (tv == NULL) {
+ ms_total = INFINITE;
+ } else {
+ ms_total = tv->tv_sec * 1000;
+ ms_total += tv->tv_usec / 1000;
+ }
+
+ FD_ZERO(&sock_read);
+ FD_ZERO(&sock_write);
+ FD_ZERO(&sock_except);
+
+ /* build an array of handles for non-sockets */
+ for (i = 0; i < max_fd; i++) {
+ if (SAFE_FD_ISSET(i, rfds) || SAFE_FD_ISSET(i, wfds) || SAFE_FD_ISSET(i, efds)) {
+ handles[n_handles] = (HANDLE)(zend_uintptr_t)_get_osfhandle(i);
+ if (handles[n_handles] == INVALID_HANDLE_VALUE) {
+ /* socket */
+ if (SAFE_FD_ISSET(i, rfds)) {
+ FD_SET((uint)i, &sock_read);
+ }
+ if (SAFE_FD_ISSET(i, wfds)) {
+ FD_SET((uint)i, &sock_write);
+ }
+ if (SAFE_FD_ISSET(i, efds)) {
+ FD_SET((uint)i, &sock_except);
+ }
+ if (i > sock_max_fd) {
+ sock_max_fd = i;
+ }
+ } else {
+ handle_slot_to_fd[n_handles] = i;
+ n_handles++;
+ }
+ }
+ }
+
+ if (n_handles == 0) {
+ /* plain sockets only - let winsock handle the whole thing */
+ return select(max_fd, rfds, wfds, efds, tv);
+ }
+
+ /* mixture of handles and sockets; lets multiplex between
+ * winsock and waiting on the handles */
+
+ FD_ZERO(&aread);
+ FD_ZERO(&awrite);
+ FD_ZERO(&aexcept);
+
+ limit = GetTickCount() + ms_total;
+ do {
+ retcode = 0;
+
+ if (sock_max_fd >= 0) {
+ /* overwrite the zero'd sets here; the select call
+ * will clear those that are not active */
+ aread = sock_read;
+ awrite = sock_write;
+ aexcept = sock_except;
+
+ tvslice.tv_sec = 0;
+ tvslice.tv_usec = 100000;
+
+ retcode = select(sock_max_fd+1, &aread, &awrite, &aexcept, &tvslice);
+ }
+ if (n_handles > 0) {
+ /* check handles */
+ DWORD wret;
+
+ wret = MsgWaitForMultipleObjects(n_handles, handles, FALSE, retcode > 0 ? 0 : 100, QS_ALLEVENTS);
+
+ if (wret == WAIT_TIMEOUT) {
+ /* set retcode to 0; this is the default.
+ * select() may have set it to something else,
+ * in which case we leave it alone, so this branch
+ * does nothing */
+ ;
+ } else if (wret == WAIT_FAILED) {
+ if (retcode == 0) {
+ retcode = -1;
+ }
+ } else {
+ if (retcode < 0) {
+ retcode = 0;
+ }
+ for (i = 0; i < n_handles; i++) {
+ if (WAIT_OBJECT_0 == WaitForSingleObject(handles[i], 0)) {
+ if (SAFE_FD_ISSET(handle_slot_to_fd[i], rfds)) {
+ FD_SET((uint)handle_slot_to_fd[i], &aread);
+ }
+ if (SAFE_FD_ISSET(handle_slot_to_fd[i], wfds)) {
+ FD_SET((uint)handle_slot_to_fd[i], &awrite);
+ }
+ if (SAFE_FD_ISSET(handle_slot_to_fd[i], efds)) {
+ FD_SET((uint)handle_slot_to_fd[i], &aexcept);
+ }
+ retcode++;
+ }
+ }
+ }
+ }
+ } while (retcode == 0 && (ms_total == INFINITE || GetTickCount() < limit));
+
+ if (rfds) {
+ *rfds = aread;
+ }
+ if (wfds) {
+ *wfds = awrite;
+ }
+ if (efds) {
+ *efds = aexcept;
+ }
+
+ return retcode;
+}
+
+#endif
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/win32/select.h b/win32/select.h
new file mode 100644
index 0000000..7cff1f3
--- /dev/null
+++ b/win32/select.h
@@ -0,0 +1,22 @@
+/*
+ +----------------------------------------------------------------------+
+ | PHP Version 5 |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1997-2013 The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Author: Wez Furlong <wez@thebrainroom.com> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id$ */
+
+PHPAPI int php_select(int max_fd, fd_set *rfds, fd_set *wfds, fd_set *efds, struct timeval *tv);
+
diff --git a/win32/sendmail.c b/win32/sendmail.c
new file mode 100644
index 0000000..c4969ad
--- /dev/null
+++ b/win32/sendmail.c
@@ -0,0 +1,989 @@
+/*
+ * PHP Sendmail for Windows.
+ *
+ * This file is rewriten specificly for PHPFI. Some functionality
+ * has been removed (MIME and file attachments). This code was
+ * modified from code based on code writen by Jarle Aase.
+ *
+ * This class is based on the original code by Jarle Aase, see bellow:
+ * wSendmail.cpp It has been striped of some functionality to match
+ * the requirements of phpfi.
+ *
+ * Very simple SMTP Send-mail program for sending command-line level
+ * emails and CGI-BIN form response for the Windows platform.
+ *
+ * The complete wSendmail package with source code can be located
+ * from http://www.jgaa.com
+ *
+ */
+
+/* $Id$ */
+
+#include "php.h" /*php specific */
+#include <stdio.h>
+#include <stdlib.h>
+#ifndef NETWARE
+#include <winsock2.h>
+#include "time.h"
+#else /* NETWARE */
+#include <netware/sendmail_nw.h>
+#endif /* NETWARE */
+#include <string.h>
+#include <math.h>
+#ifndef NETWARE
+#include <malloc.h>
+#include <memory.h>
+#include <winbase.h>
+#endif /* NETWARE */
+#include "sendmail.h"
+#include "php_ini.h"
+#include "inet.h"
+
+#if HAVE_PCRE || HAVE_BUNDLED_PCRE
+#include "ext/pcre/php_pcre.h"
+#endif
+
+#include "ext/standard/php_string.h"
+#include "ext/date/php_date.h"
+
+/*enum
+ {
+ DO_CONNECT = WM_USER +1
+ };
+ */
+
+/* '*error_message' has to be passed around from php_mail() */
+#define SMTP_ERROR_RESPONSE_SPEC "SMTP server response: %s"
+/* Convinient way to handle error messages from the SMTP server.
+ response is ecalloc()d in Ack() itself and efree()d here
+ because the content is in *error_message now */
+#define SMTP_ERROR_RESPONSE(response) { \
+ if (response && error_message) { \
+ if (NULL != (*error_message = ecalloc(1, sizeof(SMTP_ERROR_RESPONSE_SPEC) + strlen(response)))) { \
+ snprintf(*error_message, sizeof(SMTP_ERROR_RESPONSE_SPEC) + strlen(response), SMTP_ERROR_RESPONSE_SPEC, response); \
+ } \
+ efree(response); \
+ } \
+ }
+#define SMTP_SKIP_SPACE(str) { while (isspace(*str)) { str++; } }
+
+
+#ifndef THREAD_SAFE
+char Buffer[MAIL_BUFFER_SIZE];
+
+/* socket related data */
+SOCKET sc;
+#ifndef NETWARE
+WSADATA Data;
+struct hostent *adr;
+int WinsockStarted;
+/* values set by the constructor */
+char *AppName;
+#endif /* NETWARE */
+SOCKADDR_IN sock_in;
+char MailHost[HOST_NAME_LEN];
+char LocalHost[HOST_NAME_LEN];
+#endif
+char seps[] = " ,\t\n";
+#ifndef NETWARE
+char *php_mailer = "PHP 5 WIN32";
+#else
+char *php_mailer = "PHP 5 NetWare";
+#endif /* NETWARE */
+
+/* Error messages */
+static char *ErrorMessages[] =
+{
+ {"Success"}, /* 0 */
+ {"Bad arguments from form"}, /* 1 */
+ {"Unable to open temporary mailfile for read"},
+ {"Failed to Start Sockets"},
+ {"Failed to Resolve Host"},
+ {"Failed to obtain socket handle"}, /* 5 */
+ {"Failed to connect to mailserver, verify your \"SMTP\" setting in php.ini"},
+ {"Failed to Send"},
+ {"Failed to Receive"},
+ {"Server Error"},
+ {"Failed to resolve the host IP name"}, /* 10 */
+ {"Out of memory"},
+ {"Unknown error"},
+ {"Bad Message Contents"},
+ {"Bad Message Subject"},
+ {"Bad Message destination"}, /* 15 */
+ {"Bad Message Return Path"},
+ {"Bad Mail Host"},
+ {"Bad Message File"},
+ {"\"sendmail_from\" not set in php.ini or custom \"From:\" header missing"},
+ {"Mailserver rejected our \"sendmail_from\" setting"}, /* 20 */
+ {"Error while trimming mail header with PCRE, please file a bug report at http://bugs.php.net/"} /* 21 */
+};
+
+/* This pattern converts all single occurences of \n (Unix)
+ * withour a leading \r to \r\n and all occurences of \r (Mac)
+ * without a trailing \n to \r\n
+ * Thx to Nibbler from ircnet/#linuxger
+ */
+#define PHP_WIN32_MAIL_UNIFY_PATTERN "/(\r\n?)|\n/"
+#define PHP_WIN32_MAIL_UNIFY_REPLACE "\r\n"
+
+/* This pattern removes \r\n from the start of the string,
+ * \r\n from the end of the string and also makes sure every line
+ * is only wrapped with a single \r\n (thus reduces multiple
+ * occurences of \r\n between lines to a single \r\n) */
+#define PHP_WIN32_MAIL_RMVDBL_PATTERN "/^\r\n|(\r\n)+$/m"
+#define PHP_WIN32_MAIL_RMVDBL_REPLACE ""
+
+/* This pattern escapes \n. inside the message body. It prevents
+ * premature end of message if \n.\n or \r\n.\r\n is encountered
+ * and ensures that \n. sequences are properly displayed in the
+ * message body. */
+#define PHP_WIN32_MAIL_DOT_PATTERN "\n."
+#define PHP_WIN32_MAIL_DOT_REPLACE "\n.."
+
+/* This function is meant to unify the headers passed to to mail()
+ * This means, use PCRE to transform single occurences of \n or \r in \r\n
+ * As a second step we also eleminate all \r\n occurences which are:
+ * 1) At the start of the header
+ * 2) At the end of the header
+ * 3) Two or more occurences in the header are removed so only one is left
+ *
+ * Returns NULL on error, or the new char* buffer on success.
+ * You have to take care and efree() the buffer on your own.
+ */
+static char *php_win32_mail_trim_header(char *header TSRMLS_DC)
+{
+
+#if HAVE_PCRE || HAVE_BUNDLED_PCRE
+
+ char *result, *result2;
+ int result_len;
+ zval *replace;
+
+ if (!header) {
+ return NULL;
+ }
+
+ MAKE_STD_ZVAL(replace);
+ ZVAL_STRING(replace, PHP_WIN32_MAIL_UNIFY_REPLACE, 0);
+
+ result = php_pcre_replace(PHP_WIN32_MAIL_UNIFY_PATTERN, sizeof(PHP_WIN32_MAIL_UNIFY_PATTERN)-1,
+ header, strlen(header),
+ replace,
+ 0,
+ &result_len,
+ -1,
+ NULL TSRMLS_CC);
+ if (NULL == result) {
+ FREE_ZVAL(replace);
+ return NULL;
+ }
+
+ ZVAL_STRING(replace, PHP_WIN32_MAIL_RMVDBL_REPLACE, 0);
+
+ result2 = php_pcre_replace(PHP_WIN32_MAIL_RMVDBL_PATTERN, sizeof(PHP_WIN32_MAIL_RMVDBL_PATTERN)-1,
+ result, result_len,
+ replace,
+ 0,
+ &result_len,
+ -1,
+ NULL TSRMLS_CC);
+ efree(result);
+ FREE_ZVAL(replace);
+ return result2;
+#else
+ /* In case we don't have PCRE support (for whatever reason...) simply do nothing and return the unmodified header */
+ return estrdup(header);
+#endif
+}
+
+/*********************************************************************
+// Name: TSendMail
+// Input: 1) host: Name of the mail host where the SMTP server resides
+// max accepted length of name = 256
+// 2) appname: Name of the application to use in the X-mailer
+// field of the message. if NULL is given the application
+// name is used as given by the GetCommandLine() function
+// max accespted length of name = 100
+// Output: 1) error: Returns the error code if something went wrong or
+// SUCCESS otherwise.
+//
+// See SendText() for additional args!
+//********************************************************************/
+PHPAPI int TSendMail(char *host, int *error, char **error_message,
+ char *headers, char *Subject, char *mailTo, char *data,
+ char *mailCc, char *mailBcc, char *mailRPath TSRMLS_DC)
+{
+ int ret;
+ char *RPath = NULL;
+ char *headers_lc = NULL; /* headers_lc is only created if we've a header at all */
+ char *pos1 = NULL, *pos2 = NULL;
+
+#ifndef NETWARE
+ WinsockStarted = FALSE;
+#endif
+
+ if (host == NULL) {
+ *error = BAD_MAIL_HOST;
+ return FAILURE;
+ } else if (strlen(host) >= HOST_NAME_LEN) {
+ *error = BAD_MAIL_HOST;
+ return FAILURE;
+ } else {
+ strcpy(MailHost, host);
+ }
+
+ if (headers) {
+ char *pos = NULL;
+ size_t i;
+
+ /* Use PCRE to trim the header into the right format */
+ if (NULL == (headers = php_win32_mail_trim_header(headers TSRMLS_CC))) {
+ *error = W32_SM_PCRE_ERROR;
+ return FAILURE;
+ }
+
+ /* Create a lowercased header for all the searches so we're finally case
+ * insensitive when searching for a pattern. */
+ if (NULL == (headers_lc = estrdup(headers))) {
+ efree(headers);
+ *error = OUT_OF_MEMORY;
+ return FAILURE;
+ }
+ for (i = 0; i < strlen(headers_lc); i++) {
+ headers_lc[i] = tolower(headers_lc[i]);
+ }
+ }
+
+ /* Fall back to sendmail_from php.ini setting */
+ if (mailRPath && *mailRPath) {
+ RPath = estrdup(mailRPath);
+ } else if (INI_STR("sendmail_from")) {
+ RPath = estrdup(INI_STR("sendmail_from"));
+ } else if ( headers_lc &&
+ (pos1 = strstr(headers_lc, "from:")) &&
+ ((pos1 == headers_lc) || (*(pos1-1) == '\n'))
+ ) {
+ /* Real offset is memaddress from the original headers + difference of
+ * string found in the lowercase headrs + 5 characters to jump over
+ * the from: */
+ pos1 = headers + (pos1 - headers_lc) + 5;
+ if (NULL == (pos2 = strstr(pos1, "\r\n"))) {
+ RPath = estrndup(pos1, strlen(pos1));
+ } else {
+ RPath = estrndup(pos1, pos2 - pos1);
+ }
+ } else {
+ if (headers) {
+ efree(headers);
+ efree(headers_lc);
+ }
+ *error = W32_SM_SENDMAIL_FROM_NOT_SET;
+ return FAILURE;
+ }
+
+ /* attempt to connect with mail host */
+ *error = MailConnect();
+ if (*error != 0) {
+ if (RPath) {
+ efree(RPath);
+ }
+ if (headers) {
+ efree(headers);
+ efree(headers_lc);
+ }
+ /* 128 is safe here, the specifier in snprintf isn't longer than that */
+ if (NULL == (*error_message = ecalloc(1, HOST_NAME_LEN + 128))) {
+ return FAILURE;
+ }
+ snprintf(*error_message, HOST_NAME_LEN + 128,
+ "Failed to connect to mailserver at \"%s\" port %d, verify your \"SMTP\" "
+ "and \"smtp_port\" setting in php.ini or use ini_set()",
+ MailHost, !INI_INT("smtp_port") ? 25 : INI_INT("smtp_port"));
+ return FAILURE;
+ } else {
+ ret = SendText(RPath, Subject, mailTo, mailCc, mailBcc, data, headers, headers_lc, error_message TSRMLS_CC);
+ TSMClose();
+ if (RPath) {
+ efree(RPath);
+ }
+ if (headers) {
+ efree(headers);
+ efree(headers_lc);
+ }
+ if (ret != SUCCESS) {
+ *error = ret;
+ return FAILURE;
+ }
+ return SUCCESS;
+ }
+}
+
+//********************************************************************
+// Name: TSendMail::~TSendMail
+// Input:
+// Output:
+// Description: DESTRUCTOR
+// Author/Date: jcar 20/9/96
+// History:
+//********************************************************************/
+PHPAPI void TSMClose()
+{
+ Post("QUIT\r\n");
+ Ack(NULL);
+ /* to guarantee that the cleanup is not made twice and
+ compomise the rest of the application if sockets are used
+ elesewhere
+ */
+
+ shutdown(sc, 0);
+ closesocket(sc);
+}
+
+
+/*********************************************************************
+// Name: char *GetSMErrorText
+// Input: Error index returned by the menber functions
+// Output: pointer to a string containing the error description
+// Description:
+// Author/Date: jcar 20/9/96
+// History:
+//*******************************************************************/
+PHPAPI char *GetSMErrorText(int index)
+{
+ if (MIN_ERROR_INDEX <= index && index < MAX_ERROR_INDEX) {
+ return (ErrorMessages[index]);
+
+ } else {
+ return (ErrorMessages[UNKNOWN_ERROR]);
+
+ }
+}
+
+
+/*********************************************************************
+// Name: SendText
+// Input: 1) RPath: return path of the message
+// Is used to fill the "Return-Path" and the
+// "X-Sender" fields of the message.
+// 2) Subject: Subject field of the message. If NULL is given
+// the subject is set to "No Subject"
+// 3) mailTo: Destination address
+// 4) data: Null terminated string containing the data to be send.
+// 5,6) headers of the message. Note that the second
+// parameter, headers_lc, is actually a lowercased version of
+// headers. The should match exactly (in terms of length),
+// only differ in case
+// Output: Error code or SUCCESS
+// Description:
+// Author/Date: jcar 20/9/96
+// History:
+//*******************************************************************/
+static int SendText(char *RPath, char *Subject, char *mailTo, char *mailCc, char *mailBcc, char *data,
+ char *headers, char *headers_lc, char **error_message TSRMLS_DC)
+{
+ int res;
+ char *p;
+ char *tempMailTo, *token, *pos1, *pos2;
+ char *server_response = NULL;
+ char *stripped_header = NULL;
+ char *data_cln;
+ int data_cln_len;
+
+ /* check for NULL parameters */
+ if (data == NULL)
+ return (BAD_MSG_CONTENTS);
+ if (mailTo == NULL)
+ return (BAD_MSG_DESTINATION);
+ if (RPath == NULL)
+ return (BAD_MSG_RPATH);
+
+ /* simple checks for the mailto address */
+ /* have ampersand ? */
+ /* mfischer, 20020514: I commented this out because it really
+ seems bogus. Only a username for example may still be a
+ valid address at the destination system.
+ if (strchr(mailTo, '@') == NULL)
+ return (BAD_MSG_DESTINATION);
+ */
+
+ snprintf(Buffer, sizeof(Buffer), "HELO %s\r\n", LocalHost);
+
+ /* in the beggining of the dialog */
+ /* attempt reconnect if the first Post fail */
+ if ((res = Post(Buffer)) != SUCCESS) {
+ MailConnect();
+ if ((res = Post(Buffer)) != SUCCESS) {
+ return (res);
+ }
+ }
+ if ((res = Ack(&server_response)) != SUCCESS) {
+ SMTP_ERROR_RESPONSE(server_response);
+ return (res);
+ }
+
+ SMTP_SKIP_SPACE(RPath);
+ FormatEmailAddress(Buffer, RPath, "MAIL FROM:<%s>\r\n");
+ if ((res = Post(Buffer)) != SUCCESS) {
+ return (res);
+ }
+ if ((res = Ack(&server_response)) != SUCCESS) {
+ SMTP_ERROR_RESPONSE(server_response);
+ return W32_SM_SENDMAIL_FROM_MALFORMED;
+ }
+
+ tempMailTo = estrdup(mailTo);
+ /* Send mail to all rcpt's */
+ token = strtok(tempMailTo, ",");
+ while (token != NULL)
+ {
+ SMTP_SKIP_SPACE(token);
+ FormatEmailAddress(Buffer, token, "RCPT TO:<%s>\r\n");
+ if ((res = Post(Buffer)) != SUCCESS) {
+ efree(tempMailTo);
+ return (res);
+ }
+ if ((res = Ack(&server_response)) != SUCCESS) {
+ SMTP_ERROR_RESPONSE(server_response);
+ efree(tempMailTo);
+ return (res);
+ }
+ token = strtok(NULL, ",");
+ }
+ efree(tempMailTo);
+
+ if (mailCc && *mailCc) {
+ tempMailTo = estrdup(mailCc);
+ /* Send mail to all rcpt's */
+ token = strtok(tempMailTo, ",");
+ while (token != NULL)
+ {
+ SMTP_SKIP_SPACE(token);
+ FormatEmailAddress(Buffer, token, "RCPT TO:<%s>\r\n");
+ if ((res = Post(Buffer)) != SUCCESS) {
+ efree(tempMailTo);
+ return (res);
+ }
+ if ((res = Ack(&server_response)) != SUCCESS) {
+ SMTP_ERROR_RESPONSE(server_response);
+ efree(tempMailTo);
+ return (res);
+ }
+ token = strtok(NULL, ",");
+ }
+ efree(tempMailTo);
+ }
+ /* Send mail to all Cc rcpt's */
+ else if (headers && (pos1 = strstr(headers_lc, "cc:")) && ((pos1 == headers_lc) || (*(pos1-1) == '\n'))) {
+ /* Real offset is memaddress from the original headers + difference of
+ * string found in the lowercase headrs + 3 characters to jump over
+ * the cc: */
+ pos1 = headers + (pos1 - headers_lc) + 3;
+ if (NULL == (pos2 = strstr(pos1, "\r\n"))) {
+ tempMailTo = estrndup(pos1, strlen(pos1));
+ } else {
+ tempMailTo = estrndup(pos1, pos2 - pos1);
+ }
+
+ token = strtok(tempMailTo, ",");
+ while (token != NULL)
+ {
+ SMTP_SKIP_SPACE(token);
+ FormatEmailAddress(Buffer, token, "RCPT TO:<%s>\r\n");
+ if ((res = Post(Buffer)) != SUCCESS) {
+ efree(tempMailTo);
+ return (res);
+ }
+ if ((res = Ack(&server_response)) != SUCCESS) {
+ SMTP_ERROR_RESPONSE(server_response);
+ efree(tempMailTo);
+ return (res);
+ }
+ token = strtok(NULL, ",");
+ }
+ efree(tempMailTo);
+ }
+
+ /* Send mail to all Bcc rcpt's
+ This is basically a rip of the Cc code above.
+ Just don't forget to remove the Bcc: from the header afterwards. */
+ if (mailBcc && *mailBcc) {
+ tempMailTo = estrdup(mailBcc);
+ /* Send mail to all rcpt's */
+ token = strtok(tempMailTo, ",");
+ while (token != NULL)
+ {
+ SMTP_SKIP_SPACE(token);
+ FormatEmailAddress(Buffer, token, "RCPT TO:<%s>\r\n");
+ if ((res = Post(Buffer)) != SUCCESS) {
+ efree(tempMailTo);
+ return (res);
+ }
+ if ((res = Ack(&server_response)) != SUCCESS) {
+ SMTP_ERROR_RESPONSE(server_response);
+ efree(tempMailTo);
+ return (res);
+ }
+ token = strtok(NULL, ",");
+ }
+ efree(tempMailTo);
+ }
+ else if (headers) {
+ if (pos1 = strstr(headers_lc, "bcc:")) {
+ /* Real offset is memaddress from the original headers + difference of
+ * string found in the lowercase headrs + 4 characters to jump over
+ * the bcc: */
+ pos1 = headers + (pos1 - headers_lc) + 4;
+ if (NULL == (pos2 = strstr(pos1, "\r\n"))) {
+ tempMailTo = estrndup(pos1, strlen(pos1));
+ /* Later, when we remove the Bcc: out of the
+ header we know it was the last thing. */
+ pos2 = pos1;
+ } else {
+ tempMailTo = estrndup(pos1, pos2 - pos1);
+ }
+
+ token = strtok(tempMailTo, ",");
+ while (token != NULL)
+ {
+ SMTP_SKIP_SPACE(token);
+ FormatEmailAddress(Buffer, token, "RCPT TO:<%s>\r\n");
+ if ((res = Post(Buffer)) != SUCCESS) {
+ efree(tempMailTo);
+ return (res);
+ }
+ if ((res = Ack(&server_response)) != SUCCESS) {
+ SMTP_ERROR_RESPONSE(server_response);
+ efree(tempMailTo);
+ return (res);
+ }
+ token = strtok(NULL, ",");
+ }
+ efree(tempMailTo);
+
+ /* Now that we've identified that we've a Bcc list,
+ remove it from the current header. */
+ if (NULL == (stripped_header = ecalloc(1, strlen(headers)))) {
+ return OUT_OF_MEMORY;
+ }
+ /* headers = point to string start of header
+ pos1 = pointer IN headers where the Bcc starts
+ '4' = Length of the characters 'bcc:'
+ Because we've added +4 above for parsing the Emails
+ we've to substract them here. */
+ memcpy(stripped_header, headers, pos1 - headers - 4);
+ if (pos1 != pos2) {
+ /* if pos1 != pos2 , pos2 points to the rest of the headers.
+ Since pos1 != pos2 if "\r\n" was found, we know those characters
+ are there and so we jump over them (else we would generate a new header
+ which would look like "\r\n\r\n". */
+ memcpy(stripped_header + (pos1 - headers - 4), pos2 + 2, strlen(pos2) - 2);
+ }
+ }
+ }
+
+ /* Simplify the code that we create a copy of stripped_header no matter if
+ we actually strip something or not. So we've a single efree() later. */
+ if (headers && !stripped_header) {
+ if (NULL == (stripped_header = estrndup(headers, strlen(headers)))) {
+ return OUT_OF_MEMORY;
+ }
+ }
+
+ if ((res = Post("DATA\r\n")) != SUCCESS) {
+ if (stripped_header) {
+ efree(stripped_header);
+ }
+ return (res);
+ }
+ if ((res = Ack(&server_response)) != SUCCESS) {
+ SMTP_ERROR_RESPONSE(server_response);
+ if (stripped_header) {
+ efree(stripped_header);
+ }
+ return (res);
+ }
+
+ /* send message header */
+ if (Subject == NULL) {
+ res = PostHeader(RPath, "No Subject", mailTo, stripped_header TSRMLS_CC);
+ } else {
+ res = PostHeader(RPath, Subject, mailTo, stripped_header TSRMLS_CC);
+ }
+ if (stripped_header) {
+ efree(stripped_header);
+ }
+ if (res != SUCCESS) {
+ return (res);
+ }
+
+ /* Escape \n. sequences
+ * We use php_str_to_str() and not php_str_replace_in_subject(), since the latter
+ * uses ZVAL as it's parameters */
+ data_cln = php_str_to_str(data, strlen(data), PHP_WIN32_MAIL_DOT_PATTERN, sizeof(PHP_WIN32_MAIL_DOT_PATTERN) - 1,
+ PHP_WIN32_MAIL_DOT_REPLACE, sizeof(PHP_WIN32_MAIL_DOT_REPLACE) - 1, &data_cln_len);
+ if (!data_cln) {
+ data_cln = estrdup("");
+ data_cln_len = 1;
+ }
+
+ /* send message contents in 1024 chunks */
+ {
+ char c, *e2, *e = data_cln + data_cln_len;
+ p = data_cln;
+
+ while (e - p > 1024) {
+ e2 = p + 1024;
+ c = *e2;
+ *e2 = '\0';
+ if ((res = Post(p)) != SUCCESS) {
+ efree(data_cln);
+ return(res);
+ }
+ *e2 = c;
+ p = e2;
+ }
+ if ((res = Post(p)) != SUCCESS) {
+ efree(data_cln);
+ return(res);
+ }
+ }
+
+ efree(data_cln);
+
+ /*send termination dot */
+ if ((res = Post("\r\n.\r\n")) != SUCCESS)
+ return (res);
+ if ((res = Ack(&server_response)) != SUCCESS) {
+ SMTP_ERROR_RESPONSE(server_response);
+ return (res);
+ }
+
+ return (SUCCESS);
+}
+
+static int addToHeader(char **header_buffer, const char *specifier, char *string)
+{
+ if (NULL == (*header_buffer = erealloc(*header_buffer, strlen(*header_buffer) + strlen(specifier) + strlen(string) + 1))) {
+ return 0;
+ }
+ sprintf(*header_buffer + strlen(*header_buffer), specifier, string);
+ return 1;
+}
+
+/*********************************************************************
+// Name: PostHeader
+// Input: 1) return path
+// 2) Subject
+// 3) destination address
+// 4) headers
+// Output: Error code or Success
+// Description:
+// Author/Date: jcar 20/9/96
+// History:
+//********************************************************************/
+static int PostHeader(char *RPath, char *Subject, char *mailTo, char *xheaders TSRMLS_DC)
+{
+ /* Print message header according to RFC 822 */
+ /* Return-path, Received, Date, From, Subject, Sender, To, cc */
+
+ int res;
+ char *header_buffer;
+ char *headers_lc = NULL;
+ size_t i;
+
+ if (xheaders) {
+ if (NULL == (headers_lc = estrdup(xheaders))) {
+ return OUT_OF_MEMORY;
+ }
+ for (i = 0; i < strlen(headers_lc); i++) {
+ headers_lc[i] = tolower(headers_lc[i]);
+ }
+ }
+
+ header_buffer = ecalloc(1, MAIL_BUFFER_SIZE);
+
+ if (!xheaders || !strstr(headers_lc, "date:")) {
+ time_t tNow = time(NULL);
+ char *dt = php_format_date("r", 1, tNow, 1 TSRMLS_CC);
+
+ snprintf(header_buffer, MAIL_BUFFER_SIZE, "Date: %s\r\n", dt);
+ efree(dt);
+ }
+
+ if (!headers_lc || !strstr(headers_lc, "from:")) {
+ if (!addToHeader(&header_buffer, "From: %s\r\n", RPath)) {
+ goto PostHeader_outofmem;
+ }
+ }
+ if (!addToHeader(&header_buffer, "Subject: %s\r\n", Subject)) {
+ goto PostHeader_outofmem;
+ }
+
+ /* Only add the To: field from the $to parameter if isn't in the custom headers */
+ if ((headers_lc && (!strstr(headers_lc, "\r\nto:") && (strncmp(headers_lc, "to:", 3) != 0))) || !headers_lc) {
+ if (!addToHeader(&header_buffer, "To: %s\r\n", mailTo)) {
+ goto PostHeader_outofmem;
+ }
+ }
+ if (xheaders) {
+ if (!addToHeader(&header_buffer, "%s\r\n", xheaders)) {
+ goto PostHeader_outofmem;
+ }
+ }
+
+ if (headers_lc) {
+ efree(headers_lc);
+ }
+ if ((res = Post(header_buffer)) != SUCCESS) {
+ efree(header_buffer);
+ return (res);
+ }
+ efree(header_buffer);
+
+ if ((res = Post("\r\n")) != SUCCESS) {
+ return (res);
+ }
+
+ return (SUCCESS);
+
+PostHeader_outofmem:
+ if (headers_lc) {
+ efree(headers_lc);
+ }
+ return OUT_OF_MEMORY;
+}
+
+
+
+/*********************************************************************
+// Name: MailConnect
+// Input: None
+// Output: None
+// Description: Connect to the mail host and receive the welcome message.
+// Author/Date: jcar 20/9/96
+// History:
+//********************************************************************/
+static int MailConnect()
+{
+
+ int res, namelen;
+ short portnum;
+ struct hostent *ent;
+ IN_ADDR addr;
+#ifdef HAVE_IPV6
+ IN6_ADDR addr6;
+#endif
+
+ /* Create Socket */
+ if ((sc = socket(PF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET) {
+ return (FAILED_TO_OBTAIN_SOCKET_HANDLE);
+ }
+
+ /* Get our own host name */
+ if (gethostname(LocalHost, HOST_NAME_LEN)) {
+ return (FAILED_TO_GET_HOSTNAME);
+ }
+
+ ent = gethostbyname(LocalHost);
+
+ if (!ent) {
+ return (FAILED_TO_GET_HOSTNAME);
+ }
+
+ namelen = strlen(ent->h_name);
+
+#ifdef HAVE_IPV6
+ if (inet_pton(AF_INET, ent->h_name, &addr) == 1 || inet_pton(AF_INET6, ent->h_name, &addr6) == 1)
+#else
+ if (inet_pton(AF_INET, ent->h_name, &addr) == 1)
+#endif
+ {
+ if (namelen + 2 >= HOST_NAME_LEN) {
+ return (FAILED_TO_GET_HOSTNAME);
+ }
+
+ strcpy(LocalHost, "[");
+ strcpy(LocalHost + 1, ent->h_name);
+ strcpy(LocalHost + namelen + 1, "]");
+ } else {
+ if (namelen >= HOST_NAME_LEN) {
+ return (FAILED_TO_GET_HOSTNAME);
+ }
+
+ strcpy(LocalHost, ent->h_name);
+ }
+
+ /* Resolve the servers IP */
+ /*
+ if (!isdigit(MailHost[0])||!gethostbyname(MailHost))
+ {
+ return (FAILED_TO_RESOLVE_HOST);
+ }
+ */
+
+ portnum = (short) INI_INT("smtp_port");
+ if (!portnum) {
+ portnum = 25;
+ }
+
+ /* Connect to server */
+ sock_in.sin_family = AF_INET;
+ sock_in.sin_port = htons(portnum);
+ sock_in.sin_addr.S_un.S_addr = GetAddr(MailHost);
+
+ if (connect(sc, (LPSOCKADDR) & sock_in, sizeof(sock_in))) {
+ return (FAILED_TO_CONNECT);
+ }
+
+ /* receive Server welcome message */
+ res = Ack(NULL);
+ return (res);
+}
+
+
+/*********************************************************************
+// Name: Post
+// Input:
+// Output:
+// Description:
+// Author/Date: jcar 20/9/96
+// History:
+//********************************************************************/
+static int Post(LPCSTR msg)
+{
+ int len = strlen(msg);
+ int slen;
+ int index = 0;
+
+ while (len > 0) {
+ if ((slen = send(sc, msg + index, len, 0)) < 1)
+ return (FAILED_TO_SEND);
+ len -= slen;
+ index += slen;
+ }
+ return (SUCCESS);
+}
+
+
+
+/*********************************************************************
+// Name: Ack
+// Input:
+// Output:
+// Description:
+// Get the response from the server. We only want to know if the
+// last command was successful.
+// Author/Date: jcar 20/9/96
+// History:
+//********************************************************************/
+static int Ack(char **server_response)
+{
+ static char buf[MAIL_BUFFER_SIZE];
+ int rlen;
+ int Index = 0;
+ int Received = 0;
+
+again:
+
+ if ((rlen = recv(sc, buf + Index, ((MAIL_BUFFER_SIZE) - 1) - Received, 0)) < 1) {
+ return (FAILED_TO_RECEIVE);
+ }
+ Received += rlen;
+ buf[Received] = 0;
+ /*err_msg fprintf(stderr,"Received: (%d bytes) %s", rlen, buf + Index); */
+
+ /* Check for newline */
+ Index += rlen;
+
+ /* SMPT RFC says \r\n is the only valid line ending, who are we to argue ;)
+ * The response code must contain at least 5 characters ex. 220\r\n */
+ if (Received < 5 || buf[Received - 1] != '\n' || buf[Received - 2] != '\r') {
+ goto again;
+ }
+
+ if (buf[0] > '3') {
+ /* If we've a valid pointer, return the SMTP server response so the error message contains more information */
+ if (server_response) {
+ int dec = 0;
+ /* See if we have something like \r, \n, \r\n or \n\r at the end of the message and chop it off */
+ if (Received > 2) {
+ if (buf[Received-1] == '\n' || buf[Received-1] == '\r') {
+ dec++;
+ if (buf[Received-2] == '\r' || buf[Received-2] == '\n') {
+ dec++;
+ }
+ }
+
+ }
+ *server_response = estrndup(buf, Received - dec);
+ }
+ return (SMTP_SERVER_ERROR);
+ }
+
+ return (SUCCESS);
+}
+
+
+/*********************************************************************
+// Name: unsigned long GetAddr (LPSTR szHost)
+// Input:
+// Output:
+// Description: Given a string, it will return an IP address.
+// - first it tries to convert the string directly
+// - if that fails, it tries o resolve it as a hostname
+//
+// WARNING: gethostbyname() is a blocking function
+// Author/Date: jcar 20/9/96
+// History:
+//********************************************************************/
+static unsigned long GetAddr(LPSTR szHost)
+{
+ LPHOSTENT lpstHost;
+ u_long lAddr = INADDR_ANY;
+
+ /* check that we have a string */
+ if (*szHost) {
+
+ /* check for a dotted-IP address string */
+ lAddr = inet_addr(szHost);
+
+ /* If not an address, then try to resolve it as a hostname */
+ if ((lAddr == INADDR_NONE) && (strcmp(szHost, "255.255.255.255"))) {
+
+ lpstHost = gethostbyname(szHost);
+ if (lpstHost) { /* success */
+ lAddr = *((u_long FAR *) (lpstHost->h_addr));
+ } else {
+ lAddr = INADDR_ANY; /* failure */
+ }
+ }
+ }
+ return (lAddr);
+} /* end GetAddr() */
+
+
+/*********************************************************************
+// Name: int FormatEmailAddress
+// Input:
+// Output:
+// Description: Formats the email address to remove any content ouside
+// of the angle brackets < > as per RFC 2821.
+//
+// Returns the invalidly formatted mail address if the < > are
+// unbalanced (the SMTP server should reject it if it's out of spec.)
+//
+// Author/Date: garretts 08/18/2009
+// History:
+//********************************************************************/
+static int FormatEmailAddress(char* Buf, char* EmailAddress, char* FormatString) {
+ char *tmpAddress1, *tmpAddress2;
+ int result;
+
+ if( (tmpAddress1 = strchr(EmailAddress, '<')) && (tmpAddress2 = strchr(tmpAddress1, '>')) ) {
+ *tmpAddress2 = 0; // terminate the string temporarily.
+ result = snprintf(Buf, MAIL_BUFFER_SIZE, FormatString , tmpAddress1+1);
+ *tmpAddress2 = '>'; // put it back the way it was.
+ return result;
+ }
+ return snprintf(Buf, MAIL_BUFFER_SIZE , FormatString , EmailAddress );
+} /* end FormatEmailAddress() */
diff --git a/win32/sendmail.h b/win32/sendmail.h
new file mode 100644
index 0000000..0a7698e
--- /dev/null
+++ b/win32/sendmail.h
@@ -0,0 +1,51 @@
+#if !defined(sendmail_h) /* Sentry, use file only if it's not already included. */
+#define sendmail_h
+#ifndef NETWARE
+#include <windows.h>
+#endif
+
+#define HOST_NAME_LEN 256
+#define MAX_APPNAME_LENGHT 100
+#define MAIL_BUFFER_SIZE (1024*4) /* 4k buffer */
+/* Return values */
+#define MIN_ERROR_INDEX 0 /* Always 0 like SUCCESS */
+#define SUCCESS 0
+#define FAILED_TO_PARSE_ARGUMENTS 1
+#define FAILED_TO_OPEN_MAILFILE 2
+#define FAILED_TO_START_SOCKETS 3
+#define FAILED_TO_RESOLVE_HOST 4
+#define FAILED_TO_OBTAIN_SOCKET_HANDLE 5
+#define FAILED_TO_CONNECT 6
+#define FAILED_TO_SEND 7
+#define FAILED_TO_RECEIVE 8
+#define SMTP_SERVER_ERROR 9
+#define FAILED_TO_GET_HOSTNAME 10
+#define OUT_OF_MEMORY 11
+#define UNKNOWN_ERROR 12
+#define BAD_MSG_CONTENTS 13
+#define BAD_MSG_SUBJECT 14
+#define BAD_MSG_DESTINATION 15
+#define BAD_MSG_RPATH 16
+#define BAD_MAIL_HOST 17
+#define BAD_MSG_FILE 18
+#define W32_SM_SENDMAIL_FROM_NOT_SET 19
+#define W32_SM_SENDMAIL_FROM_MALFORMED 20
+#define W32_SM_PCRE_ERROR 21
+#define MAX_ERROR_INDEX 22 /* Always last error message + 1 */
+
+
+PHPAPI int TSendMail(char *smtpaddr, int *returnerror, char **error_message,
+ char *RPath, char *Subject, char *mailTo, char *data,
+ char *mailCc, char *mailBcc, char *mailRPath TSRMLS_DC);
+PHPAPI void TSMClose(void);
+static int SendText(char *RPath, char *Subject, char *mailTo, char *mailCc, char *mailBcc, char *data,
+ char *headers, char *headers_lc, char **error_message TSRMLS_DC);
+PHPAPI char *GetSMErrorText(int index);
+
+static int MailConnect();
+static int PostHeader(char *RPath, char *Subject, char *mailTo, char *xheaders TSRMLS_DC);
+static int Post(LPCSTR msg);
+static int Ack(char **server_response);
+static unsigned long GetAddr(LPSTR szHost);
+static int FormatEmailAddress(char* Buf, char* EmailAddress, char* FormatString);
+#endif /* sendmail_h */
diff --git a/win32/signal.h b/win32/signal.h
new file mode 100644
index 0000000..de43f98
--- /dev/null
+++ b/win32/signal.h
@@ -0,0 +1,16 @@
+/*
+** Change here: if you plan to use your own version of <signal.h>
+** the original "#include <signal.h>" produces an infinite reinclusion
+** of this file, instead of including the standard include-file.
+** Under MS Visual Studio, there are occurences in the source where
+** <signal.h> gets included throughout the PHP sources, and this should
+** include THIS file, not the standard one which does not have the
+** additional signals defined below.
+** One way to remove the infinite reinclusion of this file (which is located
+** in ../win32), is to specify the parent directory in which the standard
+** include file is located.
+*/
+#include <../include/signal.h>
+#define SIGALRM 13
+#define SIGVTALRM 26 /* virtual time alarm */
+#define SIGPROF 27 /* profiling time alarm */
diff --git a/win32/sockets.c b/win32/sockets.c
new file mode 100644
index 0000000..d642808
--- /dev/null
+++ b/win32/sockets.c
@@ -0,0 +1,71 @@
+/*
+ +----------------------------------------------------------------------+
+ | PHP Version 5 |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1997-2013 The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Chris Vandomelen <chrisv@b0rked.dhs.org> |
+ | Sterling Hughes <sterling@php.net> |
+ | |
+ | WinSock: Daniel Beulshausen <daniel@php4win.de> |
+ +----------------------------------------------------------------------+
+ */
+
+/* $Id$ */
+
+/* Code originally from ext/sockets */
+
+#include <stdio.h>
+#include <fcntl.h>
+
+#include "php.h"
+
+PHPAPI int socketpair(int domain, int type, int protocol, SOCKET sock[2])
+{
+ struct sockaddr_in address;
+ SOCKET redirect;
+ int size = sizeof(address);
+
+ if(domain != AF_INET) {
+ WSASetLastError(WSAENOPROTOOPT);
+ return -1;
+ }
+
+
+ sock[0] = socket(domain, type, protocol);
+ address.sin_addr.s_addr = INADDR_ANY;
+ address.sin_family = AF_INET;
+ address.sin_port = 0;
+
+ bind(sock[0], (struct sockaddr*)&address, sizeof(address));
+
+ if(getsockname(sock[0], (struct sockaddr *)&address, &size) != 0) {
+ }
+
+ listen(sock[0], 2);
+ sock[1] = socket(domain, type, protocol);
+ address.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+
+ connect(sock[1], (struct sockaddr*)&address, sizeof(address));
+ redirect = accept(sock[0],(struct sockaddr*)&address, &size);
+
+ closesocket(sock[0]);
+ sock[0] = redirect;
+
+ if(sock[0] == INVALID_SOCKET ) {
+ closesocket(sock[0]);
+ closesocket(sock[1]);
+ WSASetLastError(WSAECONNABORTED);
+ return -1;
+ }
+
+ return 0;
+}
diff --git a/win32/sockets.h b/win32/sockets.h
new file mode 100644
index 0000000..f0b9f27
--- /dev/null
+++ b/win32/sockets.h
@@ -0,0 +1,26 @@
+/*
+ +----------------------------------------------------------------------+
+ | PHP Version 5 |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1997-2013 The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Chris Vandomelen <chrisv@b0rked.dhs.org> |
+ | Sterling Hughes <sterling@php.net> |
+ | |
+ | WinSock: Daniel Beulshausen <daniel@php4win.de> |
+ +----------------------------------------------------------------------+
+ */
+
+/* $Id$ */
+
+/* Code originally from ext/sockets */
+
+PHPAPI int socketpair(int domain, int type, int protocol, SOCKET sock[2]); \ No newline at end of file
diff --git a/win32/strtoi64.c b/win32/strtoi64.c
new file mode 100644
index 0000000..689cc09
--- /dev/null
+++ b/win32/strtoi64.c
@@ -0,0 +1,122 @@
+#if _MSC_VERS <= 1300
+#include "php_strtoi64.h"
+/*
+ From APR, apr_strings.c
+ See http://www.apache.org/licenses/LICENSE-2.0
+*/
+
+PHPAPI int64_t _strtoi64(const char *nptr, char **endptr, int base)
+{
+ const char *s;
+ int64_t acc;
+ int64_t val;
+ int neg, any;
+ char c;
+
+ /*
+ * Skip white space and pick up leading +/- sign if any.
+ * If base is 0, allow 0x for hex and 0 for octal, else
+ * assume decimal; if base is already 16, allow 0x.
+ */
+ s = nptr;
+ do {
+ c = *s++;
+ } while (isspace((unsigned char)c));
+ if (c == '-') {
+ neg = 1;
+ c = *s++;
+ } else {
+ neg = 0;
+ if (c == '+') {
+ c = *s++;
+ }
+ }
+
+ if ((base == 0 || base == 16) && c == '0' && (*s == 'x' || *s == 'X')) {
+ c = s[1];
+ s += 2;
+ base = 16;
+ }
+ if (base == 0) {
+ base = c == '0' ? 8 : 10;
+ }
+ acc = any = 0;
+ if (base < 2 || base > 36) {
+ errno = EINVAL;
+ if (endptr != NULL) {
+ *endptr = (char *)(any ? s - 1 : nptr);
+ }
+ return acc;
+ }
+
+ /* The classic bsd implementation requires div/mod operators
+ * to compute a cutoff. Benchmarking proves that iss very, very
+ * evil to some 32 bit processors. Instead, look for underflow
+ * in both the mult and add/sub operation. Unlike the bsd impl,
+ * we also work strictly in a signed int64 word as we haven't
+ * implemented the unsigned type in win32.
+ *
+ * Set 'any' if any `digits' consumed; make it negative to indicate
+ * overflow.
+ */
+ val = 0;
+ for ( ; ; c = *s++) {
+ if (c >= '0' && c <= '9')
+ c -= '0';
+
+#if (('Z' - 'A') == 25)
+ else if (c >= 'A' && c <= 'Z')
+ c -= 'A' - 10;
+ else if (c >= 'a' && c <= 'z')
+ c -= 'a' - 10;
+#elif APR_CHARSET_EBCDIC
+ else if (c >= 'A' && c <= 'I')
+ c -= 'A' - 10;
+ else if (c >= 'J' && c <= 'R')
+ c -= 'J' - 19;
+ else if (c >= 'S' && c <= 'Z')
+ c -= 'S' - 28;
+ else if (c >= 'a' && c <= 'i')
+ c -= 'a' - 10;
+ else if (c >= 'j' && c <= 'r')
+ c -= 'j' - 19;
+ else if (c >= 's' && c <= 'z')
+ c -= 'z' - 28;
+#else
+# error "CANNOT COMPILE apr_strtoi64(), only ASCII and EBCDIC supported"
+#endif
+ else {
+ break;
+ }
+
+ if (c >= base) {
+ break;
+ }
+
+ val *= base;
+ if ( (any < 0) /* already noted an over/under flow - short circuit */
+ || (neg && (val > acc || (val -= c) > acc)) /* underflow */
+ || (val < acc || (val += c) < acc)) { /* overflow */
+ any = -1; /* once noted, over/underflows never go away */
+#ifdef APR_STRTOI64_OVERFLOW_IS_BAD_CHAR
+ break;
+#endif
+ } else {
+ acc = val;
+ any = 1;
+ }
+ }
+
+ if (any < 0) {
+ acc = neg ? INT64_MIN : INT64_MAX;
+ errno = ERANGE;
+ } else if (!any) {
+ errno = EINVAL;
+ }
+
+ if (endptr != NULL) {
+ *endptr = (char *)(any ? s - 1 : nptr);
+ }
+ return (acc);
+}
+#endif
diff --git a/win32/syslog.h b/win32/syslog.h
new file mode 100644
index 0000000..e24737f
--- /dev/null
+++ b/win32/syslog.h
@@ -0,0 +1,78 @@
+/*
+ +----------------------------------------------------------------------+
+ | PHP Version 5 |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1997-2013 The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Author: Sterling Hughes <sterling@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id$ */
+
+#ifndef SYSLOG_H
+#define SYSLOG_H
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+
+#define LOG_EMERG 1
+#define LOG_ALERT 1
+#define LOG_CRIT 1
+#define LOG_ERR 4
+#define LOG_WARNING 5
+#define LOG_NOTICE 6
+#define LOG_INFO 6
+#define LOG_DEBUG 6
+
+#define LOG_PRIMASK 0x07
+
+#define LOG_PRI(p) ((p) & LOG_PRIMASK)
+#define LOG_MAKEPRI(fac, pri) (((fac) << 3) | (pri))
+
+#define LOG_KERN (0<<3)
+#define LOG_USER (1<<3)
+#define LOG_MAIL (2<<3)
+#define LOG_DAEMON (3<<3)
+#define LOG_AUTH (4<<3)
+#define LOG_SYSLOG (5<<3)
+#define LOG_LPR (6<<3)
+#define LOG_NEWS (7<<3)
+#define LOG_UUCP (8<<3)
+#define LOG_CRON (9<<3)
+#define LOG_AUTHPRIV (10<<3)
+
+#define LOG_NFACILITIES 10
+#define LOG_FACMASK 0x03f8
+#define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3)
+
+#define LOG_MASK(pri) (1 << (pri))
+#define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1)
+
+/*
+ * Option flags for openlog.
+ *
+ * LOG_ODELAY no longer does anything.
+ * LOG_NDELAY is the inverse of what it used to be.
+ */
+#define LOG_PID 0x01 /* log the pid with each message */
+#define LOG_CONS 0x02 /* log on the console if errors in sending */
+#define LOG_ODELAY 0x04 /* delay open until first syslog() (default) */
+#define LOG_NDELAY 0x08 /* don't delay open */
+#define LOG_NOWAIT 0x10 /* don't wait for console forks: DEPRECATED */
+#define LOG_PERROR 0x20 /* log to stderr as well */
+
+
+extern void closelog(void);
+extern void openlog(const char *, int, int);
+extern void syslog(int, const char *, ...);
+
+
+#endif /* SYSLOG_H */
diff --git a/win32/syslog.reg b/win32/syslog.reg
new file mode 100644
index 0000000..4d3e273
--- /dev/null
+++ b/win32/syslog.reg
@@ -0,0 +1,5 @@
+REGEDIT4
+
+[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application\PHP-5.3.99-dev]
+"TypesSupported"=dword:00000007
+"EventMessageFile"="g:\\test\\srcinstall6\\php5ts_debug.dll"
diff --git a/win32/testsuite.dsp b/win32/testsuite.dsp
new file mode 100644
index 0000000..5cd6562
--- /dev/null
+++ b/win32/testsuite.dsp
@@ -0,0 +1,150 @@
+# Microsoft Developer Studio Project File - Name="testsuite" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Generic Project" 0x010a
+
+CFG=testsuite - Win32 Debug_TS
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "testsuite.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "testsuite.mak" CFG="testsuite - Win32 Debug_TS"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "testsuite - Win32 Release_TS_Inline" (based on "Win32 (x86) Generic Project")
+!MESSAGE "testsuite - Win32 Release_TS" (based on "Win32 (x86) Generic Project")
+!MESSAGE "testsuite - Win32 Release_TSDbg" (based on "Win32 (x86) Generic Project")
+!MESSAGE "testsuite - Win32 Debug_TS" (based on "Win32 (x86) Generic Project")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+MTL=midl.exe
+
+!IF "$(CFG)" == "testsuite - Win32 Release_TS_Inline"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release_TS_Inline"
+# PROP BASE Intermediate_Dir "Release_TS_Inline"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "..\..\Release_TS_Inline"
+# PROP Intermediate_Dir "..\..\"
+# PROP Target_Dir ""
+
+!ELSEIF "$(CFG)" == "testsuite - Win32 Release_TS"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release_TS"
+# PROP BASE Intermediate_Dir "Release_TS"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "..\..\Release_TS"
+# PROP Intermediate_Dir "..\..\"
+# PROP Target_Dir ""
+
+!ELSEIF "$(CFG)" == "testsuite - Win32 Release_TSDbg"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release_TSDbg"
+# PROP BASE Intermediate_Dir "Release_TSDbg"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "..\..\Release_TSDbg"
+# PROP Intermediate_Dir "..\..\"
+# PROP Target_Dir ""
+
+!ELSEIF "$(CFG)" == "testsuite - Win32 Debug_TS"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug_TS"
+# PROP BASE Intermediate_Dir "Debug_TS"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "..\..\Debug_TS"
+# PROP Intermediate_Dir "..\..\"
+# PROP Target_Dir ""
+
+!ENDIF
+
+# Begin Target
+
+# Name "testsuite - Win32 Release_TS_Inline"
+# Name "testsuite - Win32 Release_TS"
+# Name "testsuite - Win32 Release_TSDbg"
+# Name "testsuite - Win32 Debug_TS"
+# Begin Source File
+
+SOURCE=..\results.txt
+
+!IF "$(CFG)" == "testsuite - Win32 Release_TS_Inline"
+
+# PROP Intermediate_Dir "..\Release_TS_Inline"
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Running Testsuite, please wait...
+IntDir=.\..\Release_TS_Inline
+InputPath=..\results.txt
+
+"..\..\results.txt" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ set TOP_BUILDDIR=Release_TS_inline
+ set TEST_DIR=tests
+ $(IntDir)\php.exe -q ..\run-tests.php > ..\results.txt
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "testsuite - Win32 Release_TS"
+
+# PROP Intermediate_Dir "..\Release_TS"
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Running Testsuite, please wait...
+IntDir=.\..\Release_TS
+InputPath=..\results.txt
+
+"..\..\results.txt" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ set TOP_BUILDDIR=Release_TS
+ set TEST_DIR=tests
+ $(IntDir)\php.exe -q ..\run-tests.php > ..\results.txt
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "testsuite - Win32 Release_TSDbg"
+
+# PROP Intermediate_Dir "..\Release_TSDbg"
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Running Testsuite, please wait...
+IntDir=.\..\Release_TSDbg
+InputPath=..\results.txt
+
+"..\..\results.txt" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ set TOP_BUILDDIR=Release_TSDbg
+ set TEST_DIR=tests
+ $(IntDir)\php.exe -q ..\run-tests.php > ..\results.txt
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "testsuite - Win32 Debug_TS"
+
+# PROP Intermediate_Dir "..\Debug_TS"
+# PROP Exclude_From_Build 1
+
+!ENDIF
+
+# End Source File
+# End Target
+# End Project
diff --git a/win32/time.c b/win32/time.c
new file mode 100644
index 0000000..391a8a8
--- /dev/null
+++ b/win32/time.c
@@ -0,0 +1,245 @@
+/*****************************************************************************
+ * *
+ * DH_TIME.C *
+ * *
+ * Freely redistributable and modifiable. Use at your own risk. *
+ * *
+ * Copyright 1994 The Downhill Project *
+ *
+ * Modified by Shane Caraveo for use with PHP
+ *
+ *****************************************************************************/
+
+/* $Id$ */
+
+ /**
+ *
+ * 04-Feb-2001
+ * - Added patch by "Vanhanen, Reijo" <Reijo.Vanhanen@helsoft.fi>
+ * Improves accuracy of msec
+ */
+
+/* Include stuff ************************************************************ */
+
+#include <config.w32.h>
+
+#include "time.h"
+#include "unistd.h"
+#include "signal.h"
+#include <windows.h>
+#include <winbase.h>
+#include <mmsystem.h>
+#include <errno.h>
+#include "php_win32_globals.h"
+
+int getfilesystemtime(struct timeval *time_Info)
+{
+ FILETIME ft;
+ __int64 ff;
+ ULARGE_INTEGER convFromft;
+
+ GetSystemTimeAsFileTime(&ft); /* 100 ns blocks since 01-Jan-1641 */
+ /* resolution seems to be 0.01 sec */
+ /*
+ * Do not cast a pointer to a FILETIME structure to either a
+ * ULARGE_INTEGER* or __int64* value because it can cause alignment faults on 64-bit Windows.
+ * via http://technet.microsoft.com/en-us/library/ms724284(v=vs.85).aspx
+ */
+ convFromft.HighPart = ft.dwHighDateTime;
+ convFromft.LowPart = ft.dwLowDateTime;
+ ff = convFromft.QuadPart;
+
+ time_Info->tv_sec = (int)(ff/(__int64)10000000-(__int64)11644473600);
+ time_Info->tv_usec = (int)(ff % 10000000)/10;
+ return 0;
+}
+
+
+
+PHPAPI int gettimeofday(struct timeval *time_Info, struct timezone *timezone_Info)
+{
+ __int64 timer;
+ LARGE_INTEGER li;
+ BOOL b;
+ double dt;
+ TSRMLS_FETCH();
+
+ /* Get the time, if they want it */
+ if (time_Info != NULL) {
+ if (PW32G(starttime).tv_sec == 0) {
+ b = QueryPerformanceFrequency(&li);
+ if (!b) {
+ PW32G(starttime).tv_sec = -1;
+ }
+ else {
+ PW32G(freq) = li.QuadPart;
+ b = QueryPerformanceCounter(&li);
+ if (!b) {
+ PW32G(starttime).tv_sec = -1;
+ }
+ else {
+ getfilesystemtime(&PW32G(starttime));
+ timer = li.QuadPart;
+ dt = (double)timer/PW32G(freq);
+ PW32G(starttime).tv_usec -= (int)((dt-(int)dt)*1000000);
+ if (PW32G(starttime).tv_usec < 0) {
+ PW32G(starttime).tv_usec += 1000000;
+ --PW32G(starttime).tv_sec;
+ }
+ PW32G(starttime).tv_sec -= (int)dt;
+ }
+ }
+ }
+ if (PW32G(starttime).tv_sec > 0) {
+ b = QueryPerformanceCounter(&li);
+ if (!b) {
+ PW32G(starttime).tv_sec = -1;
+ }
+ else {
+ timer = li.QuadPart;
+ if (timer < PW32G(lasttime)) {
+ getfilesystemtime(time_Info);
+ dt = (double)timer/PW32G(freq);
+ PW32G(starttime) = *time_Info;
+ PW32G(starttime).tv_usec -= (int)((dt-(int)dt)*1000000);
+ if (PW32G(starttime).tv_usec < 0) {
+ PW32G(starttime).tv_usec += 1000000;
+ --PW32G(starttime).tv_sec;
+ }
+ PW32G(starttime).tv_sec -= (int)dt;
+ }
+ else {
+ PW32G(lasttime) = timer;
+ dt = (double)timer/PW32G(freq);
+ time_Info->tv_sec = PW32G(starttime).tv_sec + (int)dt;
+ time_Info->tv_usec = PW32G(starttime).tv_usec + (int)((dt-(int)dt)*1000000);
+ if (time_Info->tv_usec >= 1000000) {
+ time_Info->tv_usec -= 1000000;
+ ++time_Info->tv_sec;
+ }
+ }
+ }
+ }
+ if (PW32G(starttime).tv_sec < 0) {
+ getfilesystemtime(time_Info);
+ }
+
+ }
+ /* Get the timezone, if they want it */
+ if (timezone_Info != NULL) {
+ _tzset();
+ timezone_Info->tz_minuteswest = _timezone;
+ timezone_Info->tz_dsttime = _daylight;
+ }
+ /* And return */
+ return 0;
+}
+
+PHPAPI int usleep(unsigned int useconds)
+{
+ HANDLE timer;
+ LARGE_INTEGER due;
+
+ due.QuadPart = -(10 * (__int64)useconds);
+
+ timer = CreateWaitableTimer(NULL, TRUE, NULL);
+ SetWaitableTimer(timer, &due, 0, NULL, NULL, 0);
+ WaitForSingleObject(timer, INFINITE);
+ CloseHandle(timer);
+ return 0;
+}
+
+PHPAPI int nanosleep( const struct timespec * rqtp, struct timespec * rmtp )
+{
+ if (rqtp->tv_nsec > 999999999) {
+ /* The time interval specified 1,000,000 or more microseconds. */
+ errno = EINVAL;
+ return -1;
+ }
+ return usleep( rqtp->tv_sec * 1000000 + rqtp->tv_nsec / 1000 );
+}
+
+#if 0 /* looks pretty ropey in here */
+#ifdef HAVE_SETITIMER
+
+
+#ifndef THREAD_SAFE
+unsigned int proftimer, virttimer, realtimer;
+extern LPMSG phpmsg;
+#endif
+
+struct timer_msg {
+ int signal;
+ unsigned int threadid;
+};
+
+
+LPTIMECALLBACK setitimer_timeout(UINT uTimerID, UINT info, DWORD dwUser, DWORD dw1, DWORD dw2)
+{
+ struct timer_msg *msg = (struct timer_msg *) info;
+
+ if (msg) {
+ raise((int) msg->signal);
+ PostThreadMessage(msg->threadid,
+ WM_NOTIFY, msg->signal, 0);
+ free(msg);
+ }
+ return 0;
+}
+
+PHPAPI int setitimer(int which, const struct itimerval *value, struct itimerval *ovalue)
+{
+ int timeout = value->it_value.tv_sec * 1000 + value->it_value.tv_usec;
+ int repeat = TIME_ONESHOT;
+
+ /*make sure the message queue is initialized */
+ PeekMessage(phpmsg, NULL, WM_USER, WM_USER, PM_NOREMOVE);
+ if (timeout > 0) {
+ struct timer_msg *msg = malloc(sizeof(struct timer_msg));
+ msg->threadid = GetCurrentThreadId();
+ if (!ovalue) {
+ repeat = TIME_PERIODIC;
+ }
+ switch (which) {
+ case ITIMER_REAL:
+ msg->signal = SIGALRM;
+ realtimer = timeSetEvent(timeout, 100, (LPTIMECALLBACK) setitimer_timeout, (UINT) msg, repeat);
+ break;
+ case ITIMER_VIRT:
+ msg->signal = SIGVTALRM;
+ virttimer = timeSetEvent(timeout, 100, (LPTIMECALLBACK) setitimer_timeout, (UINT) msg, repeat);
+ break;
+ case ITIMER_PROF:
+ msg->signal = SIGPROF;
+ proftimer = timeSetEvent(timeout, 100, (LPTIMECALLBACK) setitimer_timeout, (UINT) msg, repeat);
+ break;
+ default:
+ errno = EINVAL;
+ return -1;
+ break;
+ }
+ } else {
+ switch (which) {
+ case ITIMER_REAL:
+ timeKillEvent(realtimer);
+ break;
+ case ITIMER_VIRT:
+ timeKillEvent(virttimer);
+ break;
+ case ITIMER_PROF:
+ timeKillEvent(proftimer);
+ break;
+ default:
+ errno = EINVAL;
+ return -1;
+ break;
+ }
+ }
+
+
+ return 0;
+}
+
+#endif
+#endif
+
diff --git a/win32/time.h b/win32/time.h
new file mode 100644
index 0000000..f841a2b
--- /dev/null
+++ b/win32/time.h
@@ -0,0 +1,53 @@
+/*****************************************************************************
+ * *
+ * sys/time.h *
+ * *
+ * Freely redistributable and modifiable. Use at your own risk. *
+ * *
+ * Copyright 1994 The Downhill Project *
+ *
+ * Modified by Shane Caraveo for PHP
+ *
+ *****************************************************************************/
+#ifndef TIME_H
+#define TIME_H
+
+/* Include stuff ************************************************************ */
+#include <time.h>
+#include "php.h"
+
+/* Struct stuff ************************************************************* */
+struct timezone {
+ int tz_minuteswest;
+ int tz_dsttime;
+};
+
+
+struct itimerval {
+ struct timeval it_interval; /* next value */
+ struct timeval it_value; /* current value */
+};
+
+#ifndef timespec
+struct timespec
+{
+ time_t tv_sec; /* seconds */
+ long tv_nsec; /* nanoseconds */
+};
+#endif
+
+#define ITIMER_REAL 0 /*generates sigalrm */
+#define ITIMER_VIRTUAL 1 /*generates sigvtalrm */
+#define ITIMER_VIRT 1 /*generates sigvtalrm */
+#define ITIMER_PROF 2 /*generates sigprof */
+
+/* Prototype stuff ********************************************************** */
+PHPAPI extern int gettimeofday(struct timeval *time_Info, struct timezone *timezone_Info);
+
+/* setitimer operates at 100 millisecond resolution */
+PHPAPI extern int setitimer(int which, const struct itimerval *value,
+ struct itimerval *ovalue);
+
+PHPAPI int nanosleep( const struct timespec * rqtp, struct timespec * rmtp );
+
+#endif
diff --git a/win32/unistd.h b/win32/unistd.h
new file mode 100644
index 0000000..0b94461
--- /dev/null
+++ b/win32/unistd.h
@@ -0,0 +1,4 @@
+#ifndef _PHP_WIN32_UNISTD_H
+#define _PHP_WIN32_UNISTD_H
+PHPAPI int usleep(unsigned int useconds);
+#endif
diff --git a/win32/winutil.c b/win32/winutil.c
new file mode 100644
index 0000000..4afc28f
--- /dev/null
+++ b/win32/winutil.c
@@ -0,0 +1,127 @@
+/*
+ +----------------------------------------------------------------------+
+ | PHP Version 5 |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1997-2013 The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Author: Zeev Suraski <zeev@zend.com> |
+ * Pierre Joye <pierre@php.net> |
+ +----------------------------------------------------------------------+
+ */
+
+/* $Id$ */
+
+#include "php.h"
+#include <wincrypt.h>
+
+PHPAPI char *php_win32_error_to_msg(int error)
+{
+ char *buf = NULL;
+
+ FormatMessage(
+ FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&buf, 0, NULL
+ );
+
+ return (buf ? (char *) buf : "");
+}
+
+int php_win32_check_trailing_space(const char * path, const int path_len) {
+ if (path_len < 1) {
+ return 1;
+ }
+ if (path) {
+ if (path[0] == ' ' || path[path_len - 1] == ' ') {
+ return 0;
+ } else {
+ return 1;
+ }
+ } else {
+ return 0;
+ }
+}
+
+HCRYPTPROV hCryptProv;
+unsigned int has_crypto_ctx = 0;
+
+#ifdef ZTS
+MUTEX_T php_lock_win32_cryptoctx;
+void php_win32_init_rng_lock()
+{
+ php_lock_win32_cryptoctx = tsrm_mutex_alloc();
+}
+
+void php_win32_free_rng_lock()
+{
+ tsrm_mutex_lock(php_lock_win32_cryptoctx);
+ if (has_crypto_ctx == 1) {
+ CryptReleaseContext(hCryptProv, 0);
+ has_crypto_ctx = 0;
+ }
+ tsrm_mutex_unlock(php_lock_win32_cryptoctx);
+ tsrm_mutex_free(php_lock_win32_cryptoctx);
+
+}
+#else
+#define php_win32_init_rng_lock();
+#define php_win32_free_rng_lock();
+#endif
+
+
+
+PHPAPI int php_win32_get_random_bytes(unsigned char *buf, size_t size) { /* {{{ */
+
+ unsigned int has_contextg = 0;
+
+ BOOL ret;
+ size_t i = 0;
+
+#ifdef ZTS
+ tsrm_mutex_lock(php_lock_win32_cryptoctx);
+#endif
+
+ if (has_crypto_ctx == 0) {
+ /* CRYPT_VERIFYCONTEXT > only hashing&co-like use, no need to acces prv keys */
+ if (!CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, CRYPT_MACHINE_KEYSET|CRYPT_VERIFYCONTEXT )) {
+ /* Could mean that the key container does not exist, let try
+ again by asking for a new one. If it fails here, it surely means that the user running
+ this process does not have the permission(s) to use this container.
+ */
+ if (GetLastError() == NTE_BAD_KEYSET) {
+ if (CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, CRYPT_NEWKEYSET | CRYPT_MACHINE_KEYSET | CRYPT_VERIFYCONTEXT )) {
+ has_crypto_ctx = 1;
+ } else {
+ has_crypto_ctx = 0;
+ }
+ }
+ } else {
+ has_crypto_ctx = 1;
+ }
+ }
+
+#ifdef ZTS
+ tsrm_mutex_unlock(php_lock_win32_cryptoctx);
+#endif
+
+ if (has_crypto_ctx == 0) {
+ return FAILURE;
+ }
+
+ ret = CryptGenRandom(hCryptProv, size, buf);
+
+ if (ret) {
+ return SUCCESS;
+ } else {
+ return FAILURE;
+ }
+}
+/* }}} */
+
diff --git a/win32/winutil.h b/win32/winutil.h
new file mode 100644
index 0000000..8cf07ec
--- /dev/null
+++ b/win32/winutil.h
@@ -0,0 +1,31 @@
+/*
+ +----------------------------------------------------------------------+
+ | PHP Version 5 |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1997-2013 The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Author: |
+ +----------------------------------------------------------------------+
+ */
+
+PHPAPI char *php_win32_error_to_msg(int error);
+
+#define php_win_err() php_win32_error_to_msg(GetLastError())
+int php_win32_check_trailing_space(const char * path, const int path_len);
+PHPAPI php_win32_get_random_bytes(unsigned char *buf, size_t size);
+
+#ifdef ZTS
+void php_win32_init_rng_lock();
+void php_win32_free_rng_lock();
+#else
+#define php_win32_init_rng_lock();
+#define php_win32_free_rng_lock();
+#endif
diff --git a/win32/wsyslog.c b/win32/wsyslog.c
new file mode 100644
index 0000000..4266079
--- /dev/null
+++ b/win32/wsyslog.c
@@ -0,0 +1,136 @@
+/*
+ * This file modified from sources for imap4 for use
+ * in PHP 3
+ */
+/*
+ * Program: Unix compatibility routines
+ *
+ * Author: Mark Crispin
+ * Networks and Distributed Computing
+ * Computing & Communications
+ * University of Washington
+ * Administration Building, AG-44
+ * Seattle, WA 98195
+ * Internet: MRC@CAC.Washington.EDU
+ *
+ * Date: 14 September 1996
+ * Last Edited: 22 October 1996
+ *
+ * Copyright 1996 by the University of Washington
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted, provided
+ * that the above copyright notice appears in all copies and that both the
+ * above copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of the University of Washington not be
+ * used in advertising or publicity pertaining to distribution of the software
+ * without specific, written prior permission. This software is made available
+ * "as is", and
+ * THE UNIVERSITY OF WASHINGTON DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED,
+ * WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT LIMITATION ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, AND IN
+ * NO EVENT SHALL THE UNIVERSITY OF WASHINGTON BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, TORT
+ * (INCLUDING NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+
+/* DEDICATION
+
+ * This file is dedicated to my dog, Unix, also known as Yun-chan and
+ * Unix J. Terwilliker Jehosophat Aloysius Monstrosity Animal Beast. Unix
+ * passed away at the age of 11 1/2 on September 14, 1996, 12:18 PM PDT, after
+ * a two-month bout with cirrhosis of the liver.
+ *
+ * He was a dear friend, and I miss him terribly.
+ *
+ * Lift a leg, Yunie. Luv ya forever!!!!
+ */
+
+#include "php.h" /*php specific */
+#include "syslog.h"
+#include <stdio.h>
+#include <fcntl.h>
+#include <process.h>
+
+#include "php_win32_globals.h"
+#include "wsyslog.h"
+
+void closelog(void)
+{
+ TSRMLS_FETCH();
+ if (PW32G(log_source)) {
+ DeregisterEventSource(PW32G(log_source));
+ PW32G(log_source) = NULL;
+ }
+ if (PW32G(log_header)) {
+ STR_FREE(PW32G(log_header));
+ PW32G(log_header) = NULL;
+ }
+}
+
+/* Emulator for BSD syslog() routine
+ * Accepts: priority
+ * message
+ * parameters
+ */
+
+void syslog(int priority, const char *message, ...)
+{
+ va_list args;
+ LPTSTR strs[2];
+ unsigned short etype;
+ char *tmp = NULL;
+ DWORD evid;
+ TSRMLS_FETCH();
+
+ /* default event source */
+ if (!PW32G(log_source))
+ openlog("php", LOG_PID, LOG_SYSLOG);
+
+ switch (priority) { /* translate UNIX type into NT type */
+ case LOG_ALERT:
+ etype = EVENTLOG_ERROR_TYPE;
+ evid = PHP_SYSLOG_ERROR_TYPE;
+ break;
+ case LOG_INFO:
+ etype = EVENTLOG_INFORMATION_TYPE;
+ evid = PHP_SYSLOG_INFO_TYPE;
+ break;
+ default:
+ etype = EVENTLOG_WARNING_TYPE;
+ evid = PHP_SYSLOG_WARNING_TYPE;
+ }
+ va_start(args, message); /* initialize vararg mechanism */
+ vspprintf(&tmp, 0, message, args); /* build message */
+ strs[0] = PW32G(log_header); /* write header */
+ strs[1] = tmp; /* then the message */
+ /* report the event */
+ ReportEvent(PW32G(log_source), etype, (unsigned short) priority, evid, NULL, 2, 0, strs, NULL);
+ va_end(args);
+ efree(tmp);
+}
+
+
+/* Emulator for BSD openlog() routine
+ * Accepts: identity
+ * options
+ * facility
+ */
+
+void openlog(const char *ident, int logopt, int facility)
+{
+ TSRMLS_FETCH();
+
+ if (PW32G(log_source)) {
+ closelog();
+ }
+
+ STR_FREE(PW32G(log_header));
+
+ PW32G(log_source) = RegisterEventSource(NULL, "PHP-" PHP_VERSION);
+ spprintf(&PW32G(log_header), 0, (logopt & LOG_PID) ? "%s[%d]" : "%s", ident, getpid());
+}