开发者

Compiling From Source vs. Pre-compiled Windows Binaries

开发者 https://www.devze.com 2023-02-24 15:34 出处:网络
So in the past I\'ve always used the pre-compiled Windows PHP binaries but then this guide caught my attention.

So in the past I've always used the pre-compiled Windows PHP binaries but then this guide caught my attention.

That brings me to this:

  • Why would someone want to compile PHP from the sources when the binaries are available for them?
  • Is there a performance bonus I should be aware of?
  • If so, is it a significant enough amount that I should take notice?
  • 开发者_C百科

For reference, I use PHP for mostly CLI applications mainly for bulk data processing and some website info collection.

My system specs: Windows 7 x64, 6gb RAM, Intel Q6600 (2.4gHz x 4).


There are three good reasons I can think of for compiling PHP rather than using a binary build on Windows:

  • you need a compiled in extension or compile-time-option that does not come as standard with available binaries

  • you are short of memory and need a leaner PHP executable devoid of extensions you do not use

  • you want a binary compiled specifically for your processor/environment to gain the small performance boost this might achieve (possible if you have an unusual setup)

Otherwise, just stick with the binary.


If you trust the provider of the binaries that they aren't doing something evil, then I don't see how the performance would be significantly different from anything you could compile, unless your compiler is significantly better than the norm.


As Dagon indicated, really paranoid (or once-bitten) sysadmins would rather compile from source.


Why would someone want to compile PHP from the sources when the binaries are available for them?

I suppose one reason would be to enable the specific extensions one needs -- possibly compiling them statically, instead of using external .dll files

Another reason (mostly on Linux, though) would be to have the latest version of PHP -- which is generally not the one provided by distributions.


Is there a performance bonus I should be aware of?

I suppose that, if you have some specific architecture on your server, the binary generated by a generic compilation could be less efficient than one generated specifically for it -- provided you used the right configuration options and switches to compile.

Also, if you compile (only) the extensions you need as embedded into the resulting binary, that's a couple of files you won't need to load dynamically.


is it a significant enough amount that I should take notice?

Considering you are not running some heavy-loaded website with hundreds of requests per second... not sure that compiling yourself would be that interesting...

Especially considering that compiling PHP on Windows is a bit harder than on Linux...

0

精彩评论

暂无评论...
验证码 换一张
取 消