Edit report at https://bugs.php.net/bug.php?id=81658&edit=1
ID: 81658
Comment by: bugs dot php 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:
Looks like the code has been patched, so for now, no need to manually edit with version changes.
v8.1.3 compiles without error whether the native driver or compiled MariaDB driver is used.
Yury's test script now returns "MySQL Client Version 30206", though the code
references still appear to be comparing to 80021:
Machine [~/src/php/8.1.3/ext/mysqli] grep "80021" *
mysqli.c:#if (MYSQL_VERSION_ID >= 80021 && !defined(MARIADB_BASE_VERSION)) ||
defined(MYSQLI_USE_MYSQLND)
mysqli_api.c:#if (MYSQL_VERSION_ID >= 80021 && !defined(MARIADB_BASE_VERSION)) ||
defined(MYSQLI_USE_MYSQLND)
mysqli_nonapi.c:#if (MYSQL_VERSION_ID >= 80021 && !defined(MARIADB_BASE_VERSION)) ||
defined(MYSQLI_USE_MYSQLND)
Machine [~/src/php/8.1.3/ext/pdo_mysql] grep "80021" *
mysql_driver.c:#if (MYSQL_VERSION_ID >= 80021 && !defined(MARIADB_BASE_VERSION)) ||
defined(PDO_USE_MYSQLND)
mysql_driver.c:#if (MYSQL_VERSION_ID >= 80021 && !defined(MARIADB_BASE_VERSION)) ||
defined(PDO_USE_MYSQLND)
pdo_mysql.c:#if MYSQL_VERSION_ID >= 80021 || defined(PDO_USE_MYSQLND)
php_pdo_mysql_int.h:#if MYSQL_VERSION_ID >= 80021 || defined(PDO_USE_MYSQLND)
One last note, in my original post, mysqli_driver was actually mysql_driver in ext/pdo_mysql, not
ext/mysqli. Apologies for any confusion.
PHP 8.1.3 compiled against MariaDB 10.7.3:
# Using Native Driver
Client API library version => mysqlnd 8.1.3
Client API version => mysqlnd 8.1.3
Soap Client => enabled
# Using MariaDB
Client API library version => 3.2.6
Client API header version => 10.7.3-MariaDB
Client API version => 3.2.6
Soap Client => enabled
Previous Comments:
------------------------------------------------------------------------
[2021-12-28 07:45:44] oliver at erply dot com
Is there going to be fix here or I have to manually edit the lines at php/8.1.0/ext/mysqli/ ?
------------------------------------------------------------------------
[2021-12-15 19:16:44] yury at codescar dot eu
Great, thank you very much for this fix :)
------------------------------------------------------------------------
[2021-12-05 18:25:18] php dot bugs at osxtra dot dev
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)
------------------------------------------------------------------------
[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
------------------------------------------------------------------------
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