Topic: php-fpm and mysqlnd driver

Hi,
I'm trying to activate the mysqlnd driver when recompiling the php 5.3.3 RPMs. I've changed the configuration options to use mysqlnd (e.g.: --with-pdo-mysql=shared,mysqlnd). This works for the cli version of php but with mod_php and fpm I get the following errors:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/mysql.so' - /usr/lib64/php/modules/mysql.so: undefined symbol: _mysqlnd_fetch_lengths in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/mysqli.so' - /usr/lib64/php/modules/mysqli.so: undefined symbol: mysqlnd_get_client_version in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/pdo_mysql.so' - /usr/lib64/php/modules/pdo_mysql.so: undefined symbol: mysqlnd_allocator in Unknown on line 0

Apparently the mysqlnd stuff doesn't get linked into mod_php and the cgi sapi. Any idea what the proper fix for that would look like?

Regards,
  Dennis

Re: php-fpm and mysqlnd driver

mysqlnd is really awful to build.

mysqlnd is not a shared extension but a static one, build on the main php (libphp5.so, php-cli or php-fpm)
mysql, mysqli and pdo_mysql could be build as shared extension, but which use the static driver.

So you must add the options to enable it during each build (build-cgi build-apache build-embedded build-zts and build-fpm)

      --with-mysql=shared,mysqlnd \
      --with-mysqli=shared,mysqlnd \
      --with-pdo-mysql=shared,mysqlnd \

I don't know any option to enable it without building 1 of the shared extensions.

+

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: php-fpm and mysqlnd driver

Remi wrote:

mysqlnd is really awful to build.

mysqlnd is not a shared extension but a static one, build on the main php (libphp5.so, php-cli or php-fpm)
mysql, mysqli and pdo_mysql could be build as shared extension, but which use the static driver.

So you must add the options to enable it during each build (build-cgi build-apache build-embedded build-zts and build-fpm)

      --with-mysql=shared,mysqlnd \
      --with-mysqli=shared,mysqlnd \
      --with-pdo-mysql=shared,mysqlnd \

I don't know any option to enable it without building 1 of the shared extensions.

Found a way to do this fairly easily: In the spec file the php-cgi built options need to be changed like you mentioned above and then the crucial bit is to put the following line before the builds in %build:

PHP_MYSQLND_ENABLED=yes; export PHP_MYSQLND_ENABLED

After that everything looks fine.