# Mixing different versions of php extensions



## vatson (May 10, 2010)

Hello!

I find that I need to rebuild the gd extension of PHP 5.2 on a server which currently has php5-5.2.9 port and a lot of php5-<extension>-5.2.9 extension ports installed. In the past, when I've been in a situation like this, I have always rebuilt php itself and all the extensions, but frankly, it's quite a lot of work because of all the dependencies and so on. 

Is it possible to rebuild just the php52-gd extension to a newer version of php52-gd-5.2.13 and have it working with existing php-5.2.9 and all the existing extensions, or would it be asking for trouble?


----------



## vorbote (May 17, 2010)

It shouldn't be a problem as long as long as you do it by hand, that is: a) go into the port directory, b) make, c) make deinstall, d) make reinstall. As a plus, this will give you a chance to make sure you are not bitten by the libpng breakage happening these days in ports.


----------



## gilinko (May 18, 2010)

I would say that using different versions of a extensions that come from a different version of the core php(even if they are "patch" versions) is a very bad idea. The interface between the extensions and the core isn't guaranteed to be the same and you could spend a lot of time chasing down coredumps. I'm not totally sure that a extension that isn't same version as the core php version even would get loaded.


----------



## vatson (May 18, 2010)

In the meantime, I decided to try it out and it seems to work. I now have php52-gd-5.2.13 installed along with the following:


```
php5-5.2.9          PHP Scripting Language
php5-bz2-5.2.9      The bz2 shared extension for php
php5-ctype-5.2.9    The ctype shared extension for php
php5-curl-5.2.9     The curl shared extension for php
php5-dbase-5.2.9    The dbase shared extension for php
php5-dom-5.2.9      The dom shared extension for php
php5-exif-5.2.9     The exif shared extension for php
php5-ftp-5.2.9      The ftp shared extension for php
php5-gettext-5.2.9  The gettext shared extension for php
php5-hash-5.2.9     The hash shared extension for php
php5-iconv-5.2.9    The iconv shared extension for php
php5-imap-5.2.9     The imap shared extension for php
php5-json-5.2.9     The json shared extension for php
php5-mbstring-5.2.9 The mbstring shared extension for php
php5-mcrypt-5.2.9   The mcrypt shared extension for php
php5-mysql-5.2.9    The mysql shared extension for php
php5-mysqli-5.2.9   The mysqli shared extension for php
php5-openssl-5.2.9  The openssl shared extension for php
php5-pcntl-5.2.9    The pcntl shared extension for php
php5-pcre-5.2.9     The pcre shared extension for php
php5-pdo-5.2.9      The pdo shared extension for php
php5-pdo_mysql-5.2.9 The pdo_mysql shared extension for php
php5-pdo_pgsql-5.2.9 The pdo_pgsql shared extension for php
php5-pgsql-5.2.9    The pgsql shared extension for php
php5-posix-5.2.9    The posix shared extension for php
php5-session-5.2.9  The session shared extension for php
php5-simplexml-5.2.9 The simplexml shared extension for php
php5-soap-5.2.9     The soap shared extension for php
php5-sockets-5.2.9  The sockets shared extension for php
php5-spl-5.2.9      The spl shared extension for php
php5-tokenizer-5.2.9 The tokenizer shared extension for php
php5-xml-5.2.9      The xml shared extension for php
php5-zip-5.2.9      The zip shared extension for php
php5-zlib-5.2.9     The zlib shared extension for php
php52-gd-5.2.13     The gd shared extension for php
```

This was done just for the purpose of testing whether it would work at all. I hacked the lang/php5/Makefile.ext to use older versions of png and jpeg libraries for the gd extension. I'm not planning to run this way for extended period of time, but for a temporary stop-gap measure it seems to work and not cause any more coredumping than is usual on my server


----------

