# Why does mysqlnd get included in Linux 'core' PHP5 packages?

- Thread: https://externals.io/message/55141
- Original archive: https://news-web.php.net/php.internals/55141
- Started by Lester Caine on 2011-09-03T09:06:15+00:00
- Messages: 19
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #55141 — Lester Caine — 2011-09-03T09:06:15+00:00

URL: https://externals.io/message/55141#55141

New thread ...

> > […]
> But I just told you that wasn't the case. Try it yourself. Download the
> PHP tarball on your SUSE box and do ./configure && make
> Show me where mysqlnd is linked in. It isn't.

OK done that ...

http://lsces.co.uk/PHP/testphpinfo.php is the current PHP install managed via 
SUSE. Additional .ini files shows what I've added from the package manager (and 
my own extension builds), yet mysqlnd is listed as well.

I will put my hands up that I am only _building_ my own distributions on 
windows, but since the core packages I am seeing on SUSE and Mandriva are the 
same as a default windows build, as provided by `phpinfo()`, I did assume php was 
doing the same thing on Linux as windows. It would be useful if they DID do the 
same thing? But now the question is why do the Linux distributions do what they do?

I have to add -without-mysqlnd in the windows builds, and expected the same in 
the linux ones, but I'm not finding any switch in './configure --help' to 
enable/disable it at all, so how is it included in the core package that Linux 
distributions are supplying? Since the bulk of users will be using a php 
distribution, rather than building their own, should there not be some 
correlation between what is being tested and what is being used by most users? 
In the past the first we know about problems such as the fun with re-writing 
everybody's 'date' class is when the hosts apply the latest updates? So saying 
it's not a PHP problem is not really an option? On one hand one wants to update 
to get the latest security fixes, but there is the niggling doubt that something 
will get broken in the process ... so one switches this off just in case :(

I hope this also explains some of the background to other posts I've made. A 
Firebird and Apache install run fairly transparently on either Linux or Windows 
( and I understand Mac ) with little need to document differences, but PHP can 
be fun to get a parallel system work on both.

-- 
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

---

## #55142 — Tomas Kuliavas — 2011-09-03T10:10:17+00:00

URL: https://externals.io/message/55141#55142 · In reply to: #55141

2011.09.03 12:06 Lester Caine rašė:
> New thread ...
>
> > […]
>
> OK done that ...
>
> http://lsces.co.uk/PHP/testphpinfo.php is the current PHP install managed
> via
> SUSE. Additional .ini files shows what I've added from the package manager
> (and
> my own extension builds), yet mysqlnd is listed as well.
>
> I will put my hands up that I am only _building_ my own distributions on
> windows, but since the core packages I am seeing on SUSE and Mandriva are
> the
> same as a default windows build, as provided by `phpinfo()`, I did assume
> php was
> doing the same thing on Linux as windows. It would be useful if they DID
> do the
> same thing? But now the question is why do the Linux distributions do what
> they do?

SuSE builds PHP with --with-mysql=shared,mysqlnd. IMHO php-mysql is
suggested when you install php package. It is not required.

Debian, Mandriva and Fedora build PHP with '--with-mysql=shared,/usr
--with-mysqli=shared,/usr/bin/mysql_config'. You haven't checked
Mandriva's PHP build and assumed that it is the same as on SuSE.

You can always check ./configure options in their source packages. Mysqlnd
is new PHP feature and Linuxes used 'shared,/usr' for ages.

-- 
Tomas

---

## #55143 — Ferenc Kovacs — 2011-09-03T10:17:16+00:00

URL: https://externals.io/message/55141#55143 · In reply to: #55141

> New thread ...
>
> > […]
>
> OK done that ...
>
> http://lsces.co.uk/PHP/testphpinfo.php is the current PHP install managed
> via SUSE. Additional .ini files shows what I've added from the package
> manager (and my own extension builds), yet mysqlnd is listed as well.
>
> I will put my hands up that I am only _building_ my own distributions on
> windows, but since the core packages I am seeing on SUSE and Mandriva are
> the same as a default windows build, as provided by `phpinfo()`, I did assume
> php was doing the same thing on Linux as windows. It would be useful if they
> DID do the same thing? But now the question is why do the Linux
> distributions do what they do?
>
> I have to add -without-mysqlnd in the windows builds, and expected the same
> in the linux ones, but I'm not finding any switch in './configure --help' to
> enable/disable it at all, so how is it included in the core package that
> Linux distributions are supplying? Since the bulk of users will be using a
> php distribution, rather than building their own, should there not be some
> correlation between what is being tested and what is being used by most
> users? In the past the first we know about problems such as the fun with
> re-writing everybody's 'date' class is when the hosts apply the latest
> updates? So saying it's not a PHP problem is not really an option? On one
> hand one wants to update to get the latest security fixes, but there is the
> niggling doubt that something will get broken in the process ... so one
> switches this off just in case :(
>
> I hope this also explains some of the background to other posts I've made. A
> Firebird and Apache install run fairly transparently on either Linux or
> Windows ( and I understand Mac ) with little need to document differences,
> but PHP can be fun to get a parallel system work on both.
>

mysql is(should be) disabled by default in the makefiles, so you have
to pass --with-mysql* arguments to explicitly enable mysql  in your
build.
if you don't need it, you can just omit the --with-mysql or set it to 'no'
I don't know much about OpenSuse, but for debian you have to
explicitly install the php5-mysql package, without that, you have no
mysql related module in the module list generated by php -m.

the windows build however seems interesting, I've just downloaded the
php-5.3.8-nts-Win32-VC9-x86.zip package, and it shows the mysqlnd in
the module list, albeit I don't see that explicitly added in the
configure line:
Configure Command => cscript /nologo configure.js
"--enable-snapshot-build" "--enable-debug-pack" "--disable-zts"
"--disable-isapi" "--disable-nsapi" "--without-mssql"
"--without-pdo-mssql" "--without-pi3web"
"--with-pdo-oci=D:\php-sdk\oracle\instantclient10\sdk,shared"
"--with-oci8=D:\php-sdk\oracle\instantclient10\sdk,shared"
"--with-oci8-11g=D:\php-sdk\oracle\instantclient11\sdk,shared"
"--with-enchant=shared" "--enable-object-out-dir=../obj/"
"--enable-com-dotnet" "--with-mcrypt=static"
"--disable-static-analyze"

maybe Pierre can elaborate why is that.

-- 
Ferenc Kovács
@Tyr43l - http://tyrael.hu

---

## #55145 — Pierre Joye — 2011-09-03T10:36:12+00:00

URL: https://externals.io/message/55141#55145 · In reply to: #55143

It is part of the default exts just like on unix with the difference windows
has no libmysql support anymore since 5.3

> 
> > […]
assume
> > […]
they
> > […]
same
> > […]
to
> > […]
a
> > […]
some
> > […]
the
> > […]
made. A
> > […]
differences,
> > […]
>
> mysql is(should be) disabled by default in the makefiles, so you have
> to pass --with-mysql* arguments to explicitly enable mysql in your
> build.
> if you don't need it, you can just omit the --with-mysql or set it to 'no'
> I don't know much about OpenSuse, but for debian you have to
> explicitly install the php5-mysql package, without that, you have no
> mysql related module in the module list generated by php -m.
>
> the windows build however seems interesting, I've just downloaded the
> php-5.3.8-nts-Win32-VC9-x86.zip package, and it shows the mysqlnd in
> the module list, albeit I don't see that explicitly added in the
> configure line:
> Configure Command => cscript /nologo configure.js
> "--enable-snapshot-build" "--enable-debug-pack" "--disable-zts"
> "--disable-isapi" "--disable-nsapi" "--without-mssql"
> "--without-pdo-mssql" "--without-pi3web"
> "--with-pdo-oci=D:\php-sdk\oracle\instantclient10\sdk,shared"
> "--with-oci8=D:\php-sdk\oracle\instantclient10\sdk,shared"
> "--with-oci8-11g=D:\php-sdk\oracle\instantclient11\sdk,shared"
> "--with-enchant=shared" "--enable-object-out-dir=../obj/"
> "--enable-com-dotnet" "--with-mcrypt=static"
> "--disable-static-analyze"
>
> maybe Pierre can elaborate why is that.
>
> --
> Ferenc Kovács
> @Tyr43l - http://tyrael.hu

---

## #55146 — Ferenc Kovacs — 2011-09-03T10:43:28+00:00

URL: https://externals.io/message/55141#55146 · In reply to: #55145

> It is part of the default exts just like on unix with the difference windows
> has no libmysql support anymore since 5.3

so for windows, the mysqlnd is a builtin extension, (but one cannot
use it without the mysql or mysqli or pdo_mysql extension)?
I found that we have documentation about the windows built-in
extensions: http://php.net/manual/en/install.windows.extensions.php
but it seems a little bit outdated.
should I open a documentation bug report about this?

-- 
Ferenc Kovács
@Tyr43l - http://tyrael.hu

---

## #55147 — Lester Caine — 2011-09-03T11:49:43+00:00

URL: https://externals.io/message/55141#55147 · In reply to: #55146

Ferenc Kovacs wrote:
> 
> > […]
> so for windows, the mysqlnd is a builtin extension, (but one cannot
> use it without the mysql or mysqli or pdo_mysql extension)?
> I found that we have documentation about the windows built-in
> extensions:http://php.net/manual/en/install.windows.extensions.php
> but it seems a little bit outdated.
> should I open a documentation bug report about this?

There are a lot of gaps in the windows documentation. I'm still trying to get my 
head around a number of them, and my own crib sheets are slowly getting up to 
date. -without-mysqlnd certainly removes mysqlnd on the windows builds, but I'm 
hitting a brick wall trying to do the same thing on the on the SUSE setup.

-- 
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

---

## #55151 — Lester Caine — 2011-09-03T12:00:38+00:00

URL: https://externals.io/message/55141#55151 · In reply to: #55142

Tomas Kuliavas wrote:
> 2011.09.03 12:06 Lester Caine rašė:
> > […]
>
> SuSE builds PHP with --with-mysql=shared,mysqlnd. IMHO php-mysql is
> suggested when you install php package. It is not required.
>
> Debian, Mandriva and Fedora build PHP with '--with-mysql=shared,/usr
> --with-mysqli=shared,/usr/bin/mysql_config'. You haven't checked
> Mandriva's PHP build and assumed that it is the same as on SuSE.
>
> You can always check ./configure options in their source packages. Mysqlnd
> is new PHP feature and Linuxes used 'shared,/usr' for ages.

This is a changing area, and I moved back to SUSE from Mandriva for other 
reasons, so it was older versions of PHP that I had on Mandriva installs. All 
have had mysqlnd listed, without my selecting mysql.

Current state of play, the SUSE install includes mysqlnd with the core package, 
and mysql and mysqli are available as extra packages. Again - nowdays the 
'required' dependency on MySQL does seem to have been dropped, but other PHP 
extensions sometimes flag that they need it - even when they don't, which is 
when a manual build of the extension is required.

I'm currently trying to build a mod_php5.so replacement that does not include 
mysqlnd, really just as an exercise since I can live with the bloat as long as 
MySQL is not getting installed. The php has built fine, but 
--with-apxs2=/usr/sbin/apxs2 does not seem to be building the same things as 
SUSE expects ... It's little niggles like this which waste so much time :(

-- 
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

---

## #55153 — Reindl Harald — 2011-09-03T12:08:04+00:00

URL: https://externals.io/message/55141#55153 · In reply to: #55151

Am 03.09.2011 14:00, schrieb Lester Caine:

> Current state of play, the SUSE install includes mysqlnd with the core package, and mysql and mysqli are available
> as extra packages. Again - nowdays the 'required' dependency on MySQL does seem to have been dropped, but other PHP
> extensions sometimes flag that they need it - even when they don't

and that is why libmysql-support should be dropped to get this clean

the other extensions MAY require mysql
if they use mysqlnd they do not
if they use libmysql they do

mysqlnd does exactly what you want - there is no longer any mysql-package
needed on a server to have mysql-support in php because libmysql would
not be needed - i really do not understand why tis legacy libmysql-support
will not be simply dropped - nobody needs this these days in php

on the other hand that some auto-tests seem behave differently depending
on mysqlnd/libmysql shows that the existence of both makes only troubles

normally a auto-tets shuld have ONE expected result

---

## #55154 — Lester Caine — 2011-09-03T12:27:23+00:00

URL: https://externals.io/message/55141#55154 · In reply to: #55153

Reindl Harald wrote:
>
> Am 03.09.2011 14:00, schrieb Lester Caine:
>
> > […]
> and that is why libmysql-support should be dropped to get this clean
>
> the other extensions MAY require mysql
> if they use mysqlnd they do not
> if they use libmysql they do
>
> mysqlnd does exactly what you want - there is no longer any mysql-package
> needed on a server to have mysql-support in php because libmysql would
> not be needed - i really do not understand why tis legacy libmysql-support
> will not be simply dropped - nobody needs this these days in php
>
> on the other hand that some auto-tests seem behave differently depending
> on mysqlnd/libmysql shows that the existence of both makes only troubles
>
> normally a auto-tets shuld have ONE expected result

In my own case I do not require any MySQL support ;)
I've only got Firebird as a database server, so I simply ignore any of the MySQL 
stuff, however it would be nice to be able to switch it off altogether ;)

-- 
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

---

## #55155 — johannes.schlueter@oracle.com — 2011-09-03T12:42:33+00:00

URL: https://externals.io/message/55141#55155 · In reply to: #55141

Lester,


> OK done that ...
> 
> http://lsces.co.uk/PHP/testphpinfo.php is the current PHP install managed via 
> SUSE. Additional .ini files shows what I've added from the package manager (and 
> my own extension builds), yet mysqlnd is listed as well.

You have a point of which i wasn't aware.

mysqlnd is not yet default from php.net side but SuSE has chosen to do
so. Now there is one consequence: If mysqlnd is used it will be built
statically in PHP, even on Unix, even if the other MySQL modules are
built shared. This can be fixed by adding a specific configuration
option to enforce mysqlnd being build as its own shared .so, too.

Doing this will add a small dependency issue as one has to ensure to
load mysqlnd first, then the other MySQL extensions. I think all
distributions are using a single mysql.ini file to activate all MySQL
extensions they would be able to list mysqlnd first in there and be
done.

johannes

-- 
Johannes Schlüter, Oracle
MySQL Engineering - Connectors and Client Connectivity

---

## #55157 — Lester Caine — 2011-09-03T15:19:55+00:00

URL: https://externals.io/message/55141#55157 · In reply to: #55155

Johannes Schlüter wrote:
> 
> > […]
> You have a point of which i wasn't aware.
>
> mysqlnd is not yet default from php.net side but SuSE has chosen to do
> so. Now there is one consequence: If mysqlnd is used it will be built
> statically in PHP, even on Unix, even if the other MySQL modules are
> built shared. This can be fixed by adding a specific configuration
> option to enforce mysqlnd being build as its own shared .so, too.
>
> Doing this will add a small dependency issue as one has to ensure to
> load mysqlnd first, then the other MySQL extensions. I think all
> distributions are using a single mysql.ini file to activate all MySQL
> extensions they would be able to list mysqlnd first in there and be
> done.

This is actually the area that I find very nice in the way all the distributions 
handle extensions ... Piling everything into php.ini makes for a large amount of 
redundant settings. Adding a separate .ini for each package makes a lot more 
sense, and all of the extension specific settings can be kept in the one place. 
You can then load a database driver along with all it's own configuration simply 
by enabling an .ini file? And optional configurations are handled away from the 
core php.ini.

-- 
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

---

## #55158 — Reindl Harald — 2011-09-03T15:24:27+00:00

URL: https://externals.io/message/55141#55158 · In reply to: #55157

Am 03.09.2011 17:19, schrieb Lester Caine:
> Adding a separate .ini for each package makes a lot more sense

this is usally done since years

> and all of the extension specific settings can be kept in the one place. You can then load
> a database driver along with all it's own configuration simply by enabling an .ini file? 

tahts why --with-config-file-scan-dir exists

> And optional configurations are handled away from the core php.ini

fedora does this since i can think

---

## #55163 — Lester Caine — 2011-09-03T22:01:37+00:00

URL: https://externals.io/message/55141#55163 · In reply to: #55158

Reindl Harald wrote:
>
> Am 03.09.2011 17:19, schrieb Lester Caine:
> > […]
> this is usally done since years
>
> > […]
> tahts why --with-config-file-scan-dir exists
>
> > […]
> fedora does this since i can think

Lots of distributions do this nicely, but not necessarily the same way?
My point was more that it would be nice if a clean stock install supported this, 
and extensions managed their own ini files centrally, rather then each 
distribution doing it's own thing? Some of the current discussions relate to 
individual extensions, rather than core functionality so it would be nice simply 
to wrap them in a way that they can be ignored if not applicable to a particular 
installation?

-- 
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

---

## #55170 — Remi Collet — 2011-09-04T07:10:41+00:00

URL: https://externals.io/message/55141#55170 · In reply to: #55155

Le 03/09/2011 14:42, Johannes Schlüter a écrit :
> Now there is one consequence: If mysqlnd is used it will be built
> statically in PHP, even on Unix, even if the other MySQL modules are
> built shared. This can be fixed by adding a specific configuration
> option to enforce mysqlnd being build as its own shared .so, too.

This will be great.

For RPM, php is build 1 time for each sapi (apache, cli, ...) but
extension are only build once (well twice in we also build zts).

This is ok with libmysql.
If we want to switch to mysqlnd (for RPM), this will imply to build
mysqlnd for each sapi (don't find a flag for this except also building
mysql or mysqli extensions) and so provide various copy of the "static"
library (in the various binaries).

Having mysqlnd as a shared library will also allow to provides easily
mysql/mysqli build with both mysqlnd and libmysql and give the final
user the choice.


Regards,
Remi.

---

## #55232 — johannes.schlueter@oracle.com — 2011-09-05T16:52:41+00:00

URL: https://externals.io/message/55141#55232 · In reply to: #55155

> mysqlnd is not yet default from php.net side but SuSE has chosen to do
> so. Now there is one consequence: If mysqlnd is used it will be built
> statically in PHP, even on Unix, even if the other MySQL modules are
> built shared. This can be fixed by adding a specific configuration
> option to enforce mysqlnd being build as its own shared .so, too.

I didn't get it done today, but I created a bug for tracking this.
https://bugs.php.net/bug.php?id=55609

johannes

---

## #55309 — Remi Collet — 2011-09-08T16:59:29+00:00

URL: https://externals.io/message/55141#55309 · In reply to: #55232

Le 05/09/2011 18:52, Johannes Schlüter a écrit :
> 
> > […]
> 
> I didn't get it done today, but I created a bug for tracking this.
> https://bugs.php.net/bug.php?id=55609

Great thanks.

Test report :

Apache SAPI build with
      --enable-mysqlnd=shared \
      --with-mysql=shared,mysqlnd \
      --with-mysqli=shared,mysqlnd \
      --enable-pdo=shared \
      --with-pdo-mysql=shared,mysqlnd \

CLI SAPI build with
      --with-mysql=shared,%{_prefix} \
      --with-mysqli=shared,%{mysql_config} \
      --enable-pdo=shared \
      --with-pdo-mysql=shared,%{mysql_config} \

With, in /etc/php.d/mysqlnd.ini
	extension=mysqlnd.so
	extension=mysqlnd_mysql.so
	extension=mysqlnd_mysqli.so
	extension=mysqlnd_pdo_mysql.so
Apache and CLI load and works fine.

With, in /etc/php.d/mysql.ini
	extension=mysql.so
	extension=mysqli.so
	extension=pdo_mysql.so
Apache and CLI load and works fine.

You probably note that I have to rename the extensions
(mysql.so/mysqlnd_mysql.so) to be able to distinguish them in the
install tree.

I will, probably, use this solution, for php 5.4 in fedora.
User will have to choose between php-mysql and php-mysqlnd packages.

Remi.

---

## #55311 — Remi Collet — 2011-09-08T17:25:52+00:00

URL: https://externals.io/message/55141#55311 · In reply to: #55309

Le 08/09/2011 18:59, Remi Collet a écrit :
> Test report :

Just a little issue :
With --enable-mysqlnd=shared,
the extension is not load during test, so, all test fail...

001+ PHP Warning:  PHP Startup: Unable to load dynamic library
'/home/rpmbuild/BUILD/php5.4-201109081430/build-apache/modules/pdo_mysql.so'
-
/home/rpmbuild/BUILD/php5.4-201109081430/build-apache/modules/pdo_mysql.so:
undefined symbol: mysqlnd_allocator in Unknown on line 0
...

Remi.

---

## #55312 — johannes.schlueter@oracle.com — 2011-09-08T17:36:57+00:00

URL: https://externals.io/message/55141#55312 · In reply to: #55311

> Le 08/09/2011 18:59, Remi Collet a écrit :
> > […]
> 
> Just a little issue :
> With --enable-mysqlnd=shared,
> the extension is not load during test, so, all test fail...

I think it is loaded, but in the wrong order. I'll look into it.

johannes

---

## #55424 — Remi Collet — 2011-09-14T05:34:14+00:00

URL: https://externals.io/message/55141#55424 · In reply to: #55142

Le 03/09/2011 12:10, Tomas Kuliavas a écrit :

> Debian, Mandriva and Fedora build PHP with '--with-mysql=shared,/usr
> --with-mysqli=shared,/usr/bin/mysql_config'. 

FYI: starting with fedora 16, PHP is build once with libmysql and once
with mysqlnd. So users will have the choice to install:
- php-mysql (mysql + mysqli + pdo_mysql build with libmysql)
OR
- php-mysqlnd (same extensions with mysqlnd).

Remi.

P.S. just need to patch for mysql.sock location, need to dig further and
propose a patch for this.
