Page 1 of 1

Howto use same extension on different PHP5 versions

Posted: Fri Oct 30, 2009 12:26 pm
by harrym
Hi,

I'm have created an extension for PHP5 in Windows.
My problem is that the installed version of PHP5 must match exactly the source against which my extension was compiled,
or my extension is not loaded at all.

It seems to me that this means that I must have exactly as many extensions compiled as there are PHP5 versions,
even if if I'm quite sure that the same extension dll should work on other PHP5 versions than the one it was compiled on.

Is there a way in PHP5 to disable the very strict version checks, even if just for testing?

Thanks in advance.

Re: Howto use same extension on different PHP5 versions

Posted: Sat Oct 31, 2009 1:42 pm
by markusn00b
harrym wrote:Hi,

I'm have created an extension for PHP5 in Windows.
My problem is that the installed version of PHP5 must match exactly the source against which my extension was compiled,
or my extension is not loaded at all.

It seems to me that this means that I must have exactly as many extensions compiled as there are PHP5 versions,
even if if I'm quite sure that the same extension dll should work on other PHP5 versions than the one it was compiled on.

Is there a way in PHP5 to disable the very strict version checks, even if just for testing?

Thanks in advance.
Compile your extension under PHP4 - just like you do for PHP5.

However, ZE1 (Zend Engine 1) differs quite a lot from ZE2, so you may encounter some difficulty geting an extension written under ZE2 (PHP5) to compile for ZE1 (PHP4). As far as I can recall, ZE2 does provide BC (backwards compatibility) for extensions developed under ZE1, but I doubt you can get ZE2 extensions to work (easily) with ZE1.

Mark.

Re: Howto use same extension on different PHP5 versions

Posted: Sat Oct 31, 2009 1:57 pm
by harrym
For some reason I can't use an extension compiled on 5.3.0 on 5.2.9.
Is that normal?

Re: Howto use same extension on different PHP5 versions

Posted: Sat Oct 31, 2009 3:00 pm
by requinix
harrym wrote:For some reason I can't use an extension compiled on 5.3.0 on 5.2.9.
Is that normal?
Yes. 5.3 is very different from 5.2. It resembles PHP 6 more than it does PHP 5.

Re: Howto use same extension on different PHP5 versions

Posted: Sat Oct 31, 2009 3:17 pm
by markusn00b
harrym wrote:For some reason I can't use an extension compiled on 5.3.0 on 5.2.9.
Is that normal?
Much for the same reasons I mentioned before - an extension compiled on PHPx will not work for PHP<x.

Re: Howto use same extension on different PHP5 versions

Posted: Sat Oct 31, 2009 4:11 pm
by harrym
Thanks for the answer - I now start seeing the light. PHPx and higher is workable!

So let me ask the opposite question: If I compile with PHP5.0, will it work for all 5.x?
Or which is the lowest PHP5.y which will work with 5.3 and 5.2.

And the same question for PHP4 (or I may restrict the extension to PHP5).

Re: Howto use same extension on different PHP5 versions

Posted: Sun Nov 01, 2009 6:18 am
by markusn00b
harrym wrote:Thanks for the answer - I now start seeing the light. PHPx and higher is workable!

So let me ask the opposite question: If I compile with PHP5.0, will it work for all 5.x?
Or which is the lowest PHP5.y which will work with 5.3 and 5.2.

And the same question for PHP4 (or I may restrict the extension to PHP5).
In fact, after talking to the PHP developers, for example, an extension compiled on 5.2.0 will only work on the 5.2.x range of releases. The minor version is increased when a binary incompatibility exists, hence why you cannot compile on a newer/older build.

This is generally why we provide the source code, makefiles, etc., to the user so they can build the extension on their PHP.

Re: Howto use same extension on different PHP5 versions

Posted: Sun Nov 01, 2009 6:56 am
by harrym
This is a big problems for us developers - the too strict version check.

Under Windows we have:
2 compilers : VC6 & VC9
x versions : 5.0 5.1 5.2 5.3 4.4 4.3 4.2 4.1 4.0 (let's stop here) = 9 versions
2 flavors : Release and Debug.
That's assuming we restrict ourselves to the TS version.
Total : 2 x 9 x 2 = 36 (!)

Now just try and calculate the amount of time spent on maintaining all these versions.
And all this just for Windows. We haven't yet tried to port to Linux.

This multiplicity of versions is very simply unmanageable.
My company is not large, and what we're finding out about the maintenance costs
of furnishing a PHP extension is really very very frightening.