Bug #81658 [Com]: mysql_option MYSQL_OPT_LOAD_DATA_LOCAL_DIR not available in mariadb libraries

From: Date: Sun, 05 Dec 2021 18:25:18 +0000
Subject: Bug #81658 [Com]: mysql_option MYSQL_OPT_LOAD_DATA_LOCAL_DIR not available in mariadb libraries
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-238200@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81658&edit=1

 ID:                 81658
 Comment by:         php dot bugs at osxtra dot dev
 Reported by:        yury at codescar dot eu
 Summary:            mysql_option MYSQL_OPT_LOAD_DATA_LOCAL_DIR not
                     available in mariadb libraries
 Status:             Closed
 Type:               Bug
 Package:            Compile Failure
 Operating System:   Debian 10 (OS irrelevant)
 PHP Version:        8.1.0
 Block user comment: N
 Private report:     N

 New Comment:

Oh, forgot to mention that in configure, --with-mysqli needed the path to mysql_config, and
--with-pdo-mysql needed the base path to the MariaDB installation, otherwise the native mysqlnd
library will be used by default.

Without the paths added to --with-mysqli and --with-pdo-mysql, both mysqli and mysqlnd will show up
in php -i, both showing the native version.

With the paths, the compiled MariaDB/MySQL version showing in mysqli, but you won't see mysqlnd
unless --enable-mysqlnd is also set.

It's unclear whether the external MariaDB/MySQL or native mysqlnd library will be used if both
are present.

Without --with-mysqli or --with-pdo-mysql, you'll need sqlite in PKG_CONFIG_PATH or compilation
will fail as no SQL driver will be available.

If your db server socket is in a non-standard location, you'll also need
--with-mysql-sock=/path/to/socket, as well as pdo_mysql.default_socket=/path/to/socket in your
php.ini  (configure has no provision for setting the socket when PDO is used)


Previous Comments:
------------------------------------------------------------------------
[2021-12-05 18:12:08] git@php.net

Automatic comment on behalf of devnexen (author) and cmb69 (committer)
Revision: https://github.com/php/php-src/commit/15e7e570a52795a6fea4af8d02f04567320d802f
Log: Fix #81658: MYSQL_OPT_LOAD_DATA_LOCAL_DIR not available in MariaDB

------------------------------------------------------------------------
[2021-12-05 15:52:40] bugs dot php at osxtra dot dev

cmb@php.net's suggestion on 2021-11-26 @ 11:53 UTC seems to do the trick.

OS: OSX 10.15.7 (19H15)

Compiled app versions:
  Apache: 2.4.51
  PHP: 8.1.0
  MariaDB: 10.6.4

Editing these five lines in files located at php/8.1.0/ext/mysqli/ will allow the native MariaDB
client to compile:

  mysqli.c:600
    Original: #if MYSQL_VERSION_ID >= 80021 || defined(MYSQLI_USE_MYSQLND)
    Modified: #if (MYSQL_VERSION_ID >= 80021 && !defined(MARIADB_BASE_VERSION)) ||
defined(MYSQLI_USE_MYSQLND)

  mysqli_api.c:1723
    Original: #if MYSQL_VERSION_ID >= 80021 || defined(MYSQLI_USE_MYSQLND)
    Modified: #if (MYSQL_VERSION_ID >= 80021 && !defined(MARIADB_BASE_VERSION)) ||
defined(MYSQLI_USE_MYSQLND)

  mysqli_driver.c:547
    Original: #if MYSQL_VERSION_ID >= 80021 || defined(PDO_USE_MYSQLND)
    Modified: #if (MYSQL_VERSION_ID >= 80021 && !defined(MARIADB_BASE_VERSION)) ||
defined(PDO_USE_MYSQLND)

  mysqli_driver.c:773
    Original: #if MYSQL_VERSION_ID >= 80021 || defined(PDO_USE_MYSQLND)
    Modified: #if (MYSQL_VERSION_ID >= 80021 && !defined(MARIADB_BASE_VERSION)) ||
defined(PDO_USE_MYSQLND)

  mysqli_nonapi.c:336
    Original: #if MYSQL_VERSION_ID >= 80021 || defined(MYSQLI_USE_MYSQLND)
    Modified: #if (MYSQL_VERSION_ID >= 80021 && !defined(MARIADB_BASE_VERSION)) ||
defined(MYSQLI_USE_MYSQLND)

With original code, php -i reports:
Client API library version => mysqlnd 8.1.0
Client API version => mysqlnd 8.1.0

With edited code, php -i reports:
Client API library version => 3.2.4
Client API header version => 10.6.4-MariaDB

------------------------------------------------------------------------
[2021-11-26 11:53:13] cmb@php.net

> MYSQL_OPT_LOAD_DATA_LOCAL_DIR is defined as member of enum
> mysql_option […]

Ah, right, thanks!  Then we likely need something like:

    #if (MYSQL_VERSION_ID >= 80021 && !defined(MARIADB_BASE_VERSION)) ||
defined(MYSQLI_USE_MYSQLND)

------------------------------------------------------------------------
[2021-11-26 09:08:11] yury at codescar dot eu

Problem is OS irrelevant, it has to do with mariadb libraries

------------------------------------------------------------------------
[2021-11-26 09:03:15] oliver at erply dot com

Having the same issue with only difference, building on CentOS.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=81658


--
Edit this bug report at https://bugs.php.net/bug.php?id=81658&edit=1


Thread (12 messages)

« previous php.bugs (#238200) next »