|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2021-11-25 13:27 UTC] yury at codescar dot eu
Description: ------------ Compiling PHP 8.1.0 (https://www.php.net/distributions/php-8.1.0.tar.bz2) on Debian 10 with libmariadb packages (10.3.31 version) instead of mysqlnd, fails with error: > /tmp/php-8.1.0/ext/mysqli/mysqli.c:600:59: error: 'MYSQL_OPT_LOAD_DATA_LOCAL_DIR' undeclared (first use in this function); did you mean 'MYSQL_OPT_READ_TIMEOUT'? REGISTER_LONG_CONSTANT("MYSQLI_OPT_LOAD_DATA_LOCAL_DIR", MYSQL_OPT_LOAD_DATA_LOCAL_DIR, CONST_CS | CONST_PERSISTENT); This option was introduced in MySQL 8.0 (https://dev.mysql.com/doc/c-api/8.0/en/mysql-options.html) so there is a check in the previous line (https://github.com/php/php-src/blob/php-8.1.0/ext/mysqli/mysqli.c#L599) > #if MYSQL_VERSION_ID >= 80021 || defined(MYSQLI_USE_MYSQLND)" Unfortunately, it appears that with libmaria packages (10.3.31) `mysql_get_client_version()` returns a value of 100331 (as you can see from the compiling and running the test script). Test script: --------------- #include <stdlib.h> #include <stdio.h> #include <mysql.h> int main(int argc, char **argv) { printf("MySQL Client Version %lu\n", mysql_get_client_version()); return EXIT_SUCCESS; } Compile: gcc -o testscript test.c `mysql_config --cflags --libs` Execute: "MySQL Client Version 100331" Expected result: ---------------- Being able to compile PHP 8.1.0 with MySQL extensions being compiled against the MariaDB Client Library PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 20:00:01 2025 UTC |
That versioning is a mess, but can't we just do #ifdef MYSQL_OPT_LOAD_DATA_LOCAL_DIR here?> 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)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