问题
How to compile a PHP extension that will work on every version of PHP as well as every version of Linux?
回答1:
You'll need to compile it once for every platform (a Windows library won't run on GNU/Linux, just as well as a 64-bit library won't run in a 32-bit environment). If this is what you are trying to do, the answer is: it's impossible.
回答2:
You won't be able to create a "compatible with everything" binary package.
To allow for maximum compatibility I'd recommend that you package the file in a tarball with a package.xml
file in the same way that PECL packages are distributed. This would allow someone to easily compile/install the package anywhere.
回答3:
That's not possible - its not even possible in java
回答4:
I have asked a similar question and was given a very sensible suggestion:
How to build a PHP extension that runs in many PHP versions?
来源:https://stackoverflow.com/questions/6041511/how-to-compile-php-extensions-cross-version