Discussion:
[PHP-INSTALL] Shared mysql modules with mysqlnd
Ryan Schmidt
2009-07-31 20:08:48 UTC
Permalink
Hi. I'm the maintainer of php in MacPorts. Our php5 port has been
monolithic, with all modules compiled in statically. I'm now
switching this to a more modular architecture so that shared modules
can be added and removed as needed.

I wanted to make the mysql modules use mysqlnd by default for the
obvious reasons, but I'm having trouble making them work this way as
shared modules. I think they were working fine with mysqlnd when
compiled into php statically. Using php 5.3.0 I see:


$ php
PHP Warning: Cannot load module 'mysql' because required module
'mysqlnd' is not loaded in Unknown on line 0
dyld: lazy symbol binding failed: Symbol not found:
__mysqlnd_palloc_rinit
Referenced from: /mp/lib/php/extensions/no-debug-non-zts-20090626/
mysqli.so
Expected in: dynamic lookup

dyld: Symbol not found: __mysqlnd_palloc_rinit
Referenced from: /mp/lib/php/extensions/no-debug-non-zts-20090626/
mysqli.so
Expected in: dynamic lookup

Trace/BPT trap
$


I see this on Mac OS X 10.4.11 and 10.5.7 on Intel Macs.


The mysql modules have been configured with

--prefix=/mp
--disable-all
--disable-cgi
--without-pear
--with-zlib-dir=/mp
--enable-pdo
--with-mysql=shared,mysqlnd
--with-mysqli=shared,mysqlnd
--with-pdo-mysql=shared,mysqlnd


I found references on third-party sites to an "--enable-mysqlnd"
option but php 5.3.0 does not mention this in "./configure --help",
if I try to use it it says it's an unknown option, and it doesn't
change the issue.


I looked into how FreeBSD Ports is doing it, and it doesn't look like
they're using mysqlnd at all.


Am I supposed to have a "mysqlnd.so"? I couldn't find any pages about
such a module on Google so I'm guessing not.


If you want to reproduce my setup on your system, you can install
Xcode and MacPorts and then "sudo port install php5-
mysql" (optionally "sudo port install php5 +no_web" first to avoid
building apache2).
Ryan Schmidt
2009-08-02 23:38:40 UTC
Permalink
Post by Ryan Schmidt
I wanted to make the mysql modules use mysqlnd by default for the
obvious reasons, but I'm having trouble making them work this way
as shared modules.
Has anybody else tried to build the mysql extensions as shared
modules when using mysqlnd? If so, on what platform? How did you do
it? Did you succeed? If not, what problems did you encounter?
Ryan Schmidt
2009-08-26 13:40:05 UTC
Permalink
Post by Ryan Schmidt
I wanted to make the mysql modules use mysqlnd by default for the
obvious reasons, but I'm having trouble making them work this way
as shared modules. I think they were working fine with mysqlnd when
$ php
PHP Warning: Cannot load module 'mysql' because required module
'mysqlnd' is not loaded in Unknown on line 0
__mysqlnd_palloc_rinit
Referenced from: /mp/lib/php/extensions/no-debug-non-zts-20090626/
mysqli.so
Expected in: dynamic lookup
dyld: Symbol not found: __mysqlnd_palloc_rinit
Referenced from: /mp/lib/php/extensions/no-debug-non-zts-20090626/
mysqli.so
Expected in: dynamic lookup
Trace/BPT trap
$
I was told off-list by Rénald Casagraude that I could set the
environment variable PHP_MYSQLND_ENABLED=yes while running php's
configure script to fix this. This worked great. So now my php has
the mysqlnd extension compiled in statically, and I can have the
mysql, mysqli and pdo_mysql extensions use mysqlnd if desired. Thanks
Rénald!

Loading...