сборка php для windows
PHP: Hypertext Preprocessor
PHP For Windows
This site is dedicated to supporting PHP on Microsoft Windows. It also supports ports of PHP extensions or features as well as providing special builds for the various Windows architectures.
If you like to build your own PHP binaries, instructions can be found on the Wiki.
PECL For Windows
PECL extensions for Windows is being worked on. Windows DLL can be downloaded right from the PECL website.
The PECL extension release and snapshot build directories are browsable directly.
Which version do I choose?
If you are using PHP as FastCGI with IIS you should use the Non-Thread Safe (NTS) versions of PHP.
Apache
Please use the Apache builds provided by Apache Lounge. They provide VC15 and VS16 builds of Apache for x86 and x64. We use their binaries to build the Apache SAPIs.
With Apache, using the apache2handler SAPI, you have to use the Thread Safe (TS) versions of PHP.
VC15 & VS16
More recent versions of PHP are built with VC15 or VS16 (Visual Studio 2017 or 2019 compiler respectively) and include improvements in performance and stability.
— The VC15 and VS16 builds require to have the Visual C++ Redistributable for Visual Studio 2015-2019 x64 or x86 installed
TS and NTS
TS refers to multithread capable builds. NTS refers to single thread only builds. Use case for TS binaries involves interaction with a multithreaded SAPI and PHP loaded as a module into a web server. For NTS binaries the widespread use case is interaction with a web server through the FastCGI protocol, utilizing no multithreading (but also for example CLI).
What is PGO?
Profile Guided Optimization is an optimization feature available in Microsoft’s Visual C++ compiler that allows you to optimize an output file based on profiling data collected during test runs of the application or module.
Links:
amd64 (x86_64) Builds
PHP 7 provides full 64-bit support. The x64 builds of PHP 7 support native 64-bit integers, LFS, 64-bit memory_limit and much more.
x64 builds are recommended (almost all Windows installations support x64).
Long and multibyte path
PHP 7.1+ supports long and UTF-8 paths. See the manual for details.
Archives
Past releases are available from our archives, older versions not found there can be found at the Museum.
Сборка php для windows
В этой главе рассказывается, как скомпилировать PHP из исходных кодов в Windows с помощью инструментов Microsoft. Чтобы скомпилировать PHP с помощью cygwin, обратитесь к Установка на Unix-системы.
User Contributed Notes 9 notes
If you are getting the following error message:
Input Error: There is no script engine for file extension «.js»
with Visual Studio 2005 Command Prompt or similar, try to add «/e:jscript» to the command line.
Something like:
cscript /nologo /e:jscript win32/build/buildconf.js
It worked for me, I hope it helps.
Building PHP on Windows 7 with Visual Studio 2010 installed.
— this differs slightly from the stepbystepbuild info and it worked for me 🙂
If trying to compile the code (Windows XP, SDK v6.1) and you get the following types of errors:
c:\phpdev\php-5.2.9\main\php_network.h(128) : warning C4005: ‘POLLIN’ : macro redefinition
c:\program files\microsoft sdks\windows\v6.1\include\winsock2.h(1495) :
see previous definition of ‘POLLIN’
c:\phpdev\php-5.2.9\main\php_network.h(129) : warning C4005: ‘POLLPRI’ : macro redefinition
c:\program files\microsoft sdks\windows\v6.1\include\winsock2.h(1496) :
see previous definition of ‘POLLPRI’
c:\phpdev\php-5.2.9\main\php_network.h(130) : warning C4005: ‘POLLOUT’ : macro redefinition
c:\program files\microsoft sdks\windows\v6.1\include\winsock2.h(1499) :
see previous definition of ‘POLLOUT’
c:\phpdev\php-5.2.9\main\php_network.h(131) : warning C4005: ‘POLLERR’ : macro redefinition
c:\program files\microsoft sdks\windows\v6.1\include\winsock2.h(1502) :
see previous definition of ‘POLLERR’
c:\phpdev\php-5.2.9\main\php_network.h(132) : warning C4005: ‘POLLHUP’ : macro redefinition
c:\program files\microsoft sdks\windows\v6.1\include\winsock2.h(1503) :
see previous definition of ‘POLLHUP’
c:\phpdev\php-5.2.9\main\php_network.h(133) : warning C4005: ‘POLLNVAL’ : macro redefinition
c:\program files\microsoft sdks\windows\v6.1\include\winsock2.h(1504) :
see previous definition of ‘POLLNVAL’
NMAKE : fatal error U1077: ‘»C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN
\cl.exe»‘ : return code ‘0x2’
Stop.
You can alter the Makefile and add the following switch to CFLAGS:
PHP: Hypertext Preprocessor
PHP For Windows
This site is dedicated to supporting PHP on Microsoft Windows. It also supports ports of PHP extensions or features as well as providing special builds for the various Windows architectures.
If you like to build your own PHP binaries, instructions can be found on the Wiki.
PECL For Windows
PECL extensions for Windows is being worked on. Windows DLL can be downloaded right from the PECL website.
The PECL extension release and snapshot build directories are browsable directly.
Which version do I choose?
If you are using PHP as FastCGI with IIS you should use the Non-Thread Safe (NTS) versions of PHP.
Apache
Please use the Apache builds provided by Apache Lounge. They provide VC15 and VS16 builds of Apache for x86 and x64. We use their binaries to build the Apache SAPIs.
With Apache, using the apache2handler SAPI, you have to use the Thread Safe (TS) versions of PHP.
VC15 & VS16
More recent versions of PHP are built with VC15 or VS16 (Visual Studio 2017 or 2019 compiler respectively) and include improvements in performance and stability.
— The VC15 and VS16 builds require to have the Visual C++ Redistributable for Visual Studio 2015-2019 x64 or x86 installed
TS and NTS
TS refers to multithread capable builds. NTS refers to single thread only builds. Use case for TS binaries involves interaction with a multithreaded SAPI and PHP loaded as a module into a web server. For NTS binaries the widespread use case is interaction with a web server through the FastCGI protocol, utilizing no multithreading (but also for example CLI).
What is PGO?
Profile Guided Optimization is an optimization feature available in Microsoft’s Visual C++ compiler that allows you to optimize an output file based on profiling data collected during test runs of the application or module.
Links:
amd64 (x86_64) Builds
PHP 7 provides full 64-bit support. The x64 builds of PHP 7 support native 64-bit integers, LFS, 64-bit memory_limit and much more.
x64 builds are recommended (almost all Windows installations support x64).
Long and multibyte path
PHP 7.1+ supports long and UTF-8 paths. See the manual for details.
Archives
Past releases are available from our archives, older versions not found there can be found at the Museum.
libjpeg dependency
As of PHP 8.1.0, the official Windows dependencies use libjpeg-turbo instead of libjpeg. The main reason is that libjpeg-turbo offers better performance, because it uses SIMD instructions on supported platforms (Windows x86 and x64 are supported). Note that many Linux distributions already use libjpeg-turbo for quite a while.
This is relevant for the GD extension, but may affect other extensions as well. Please file a bug report, if you experience any problems regarding this change.
PHP 8 Snapshot Builds
You may have already noticed that we didn’t provide snapshot builds for PHP 8 for many months. There are no plans to change that, but users can get third party provided nighly builds.
We will, of course, continue to provide Windows builds of all PHP (pre-)releases. So watch out for the release of PHP 8.1.0alpha1, scheduled for 10 Jun 2021!
OCI DLLs missing from PHP 8.0.0 pre-release builds
Due to a build system error which only has been noticed recently, so far the PHP 8.0.0 pre-release builds didn’t contain php_oci8_12c.dll and php_pdo_oci.dll in the ext/ folder. You can now separately download these files and copy them in your existing PHP-8.0.0beta1 installation (the DLLs are not suitable for the alpha releases). Make sure that you use the appropriate package (x64 vs. x86, and non thread-safe vs. thread-safe).
Windows Defender Warnings
A few days ago, we have noticed that Windows Defender reports some files in the PHP source and test packages as severe threat, claiming they would constitute a backdoor (e.g. Backdoor:PHP/Dirtelti.MTF). These files are auxiliary test files containing eval statements. Are these files backdoors? That depends on the context, i.e. in this case whether they are accessible via the Web. If they are, because they have been uploaded to the webroot of a publicly available Webserver, for instance, they may pose a serious threat. On the other hand, if they are just used on a local machine for development and testing purpuses, they are not malicious in any way.
So, if you experience such Windows Defender warnings, examine the reported files, make sure they don’t pose any threat, and then unblock them.
Happy PHPing on Windows!
OpenSSL default config path changed
As of PHP 7.4.0, the OpenSSL default config path changes from c:\usr\local\ssl\openssl.cnf to C:\Program Files\Common Files\SSL\openssl.conf for x64 builds, and C:\Program Files (x86)\Common Files\SSL\openssl.conf for x86 builds. These paths match the defaults of OpenSSL 1.1, and are more inline with the Windows folder structure than the old settings. Note that this path is still configurable via the environment variable OPENSSL_CONF. See also the installation section in the PHP manual.
PHP 7.4 builds use Visual Studio 2017
We used Visual Studio 2019 to build the early releases of PHP 7.4 (up to and including 7.4.0beta2). And although Visual Studio 2019 is generally an improvement over Visual Studio 2017, due to compatibility issues we have decided to switch back to Visual Studio 2017 for our PHP 7.4 builds, and we are planning to stick with this for the complete lifetime of PHP 7.4.
Note that it is still possible to use Apache VS16 builds from Apachelounge in combination with PHP 7.4, since VS 2019 is forward compatible with VS 2017.
Our master snapshots are still built with Visual Studio 2019, and we are planning to stick with Visual Studio 2019 for PHP 8.0.
Visual Studio 2019 Builds
All binary packages we were offering contained «vc#» (for instance, «vc14») in the filename to designate the Visual Studio version which has been used to build them. This number («#») has tradionally been the major number of the respective platform toolset. The preview releases of Visual Studio 2017 shipped with platform toolset 15.00, so we used «vc15» to mark the files. The first GA release of Visual Studio 2017, however, shipped with platform toolset 14.10 (to signal the backward compatibility), but the internal Visual Studio version number stayed 15.00. To avoid confusion with already distributed packages, we stuck with the «vc15» marker. For our Visual Studio 2019 builds (PHP 7.4 and master) we finally changed from «vc#» to «vs#» (note the «s»), where the number now designates the major internal Visual Studio version number. We are planning to stick with this new naming scheme for the foreseeable future.
OpenSSL 1.1.1a
The recent release candidates 7.2.14RC1 and 7.3.1RC1 use the latest OpenSSL 1.1.1 release branch. Please help testing these release candidates with the regard to the OpenSSL compatibility and report bugs. This concerns the OpenSSL extension itself as well as the extensions depending on OpenSSL like cURL.
The windows.php.net site uses SSL by default
Thanks to «Let’s Encrypt», the site now uses SSL by default. All the non SSL links are transparently redirected to the SSL locations.
WinXP users might experience connection issues. It is a high time to switch away from WinXP to some more recent OS version.
AVX builds
In addition to the usual regular snapshots, the current master builds deliver binaries with AVX (Advanced Vector Extensions) support. AVX is an instruction set available in many modern CPUs. The internal PHP implementation uses these specific CPU instructions to improve performance.
Processors, manufactured after 2011, most likely support AVX. The exact information about the hardware can be retrieved by using the Coreinfo tool.
Help us to test these new flavours, any feedback appreciated!