php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75612 php-mysqli build fails with MariaDB-10.2
Submitted: 2017-12-01 18:52 UTC Modified: 2021-02-14 04:22 UTC
Votes:23
Avg. Score:4.3 ± 0.9
Reproduced:21 of 21 (100.0%)
Same Version:9 (42.9%)
Same OS:9 (42.9%)
From: dkasyanov at cloudlinux dot com Assigned: cmb (profile)
Status: No Feedback Package: MySQLi related
PHP Version: 7.1.12 OS: Centos 7
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2017-12-01 18:52 UTC] dkasyanov at cloudlinux dot com
Description:
------------
MariaDB developers have changed mysql headers in 10.2.10+ and now PHP is not compiling.

How to reproduce:
install MariaDB-devel package >= 10.2.10 and run:
./configure --with-mysqli=/usr/bin/mysql_config  CPPFLAGS="-I/usr/include/mysql"
make


Test script:
---------------
Compiled PHP binary


Actual result:
--------------
In file included from /root/php-7.1.12/ext/mysqli/php_mysqli_structs.h:63:0,
                 from /root/php-7.1.12/ext/mysqli/mysqli.c:34:
/usr/include/mysql/my_global.h:3:2: warning: #warning This file should not be included by clients, include only <mysql.h> [-Wcpp]
 #warning This file should not be included by clients, include only <mysql.h>
  ^
In file included from /root/php-7.1.12/ext/mysqli/php_mysqli_structs.h:79:0,
                 from /root/php-7.1.12/ext/mysqli/mysqli.c:34:
/usr/include/mysql/my_sys.h:3:2: warning: #warning This file should not be included by clients, include only <mysql.h> [-Wcpp]
 #warning This file should not be included by clients, include only <mysql.h>
  ^
In file included from /root/php-7.1.12/ext/mysqli/mysqli.c:34:0:
/root/php-7.1.12/ext/mysqli/php_mysqli_structs.h:82:21: fatal error: my_list.h: No such file or directory
 #include <my_list.h>
                     ^
compilation terminated.
make: *** [ext/mysqli/mysqli.lo] Error 1

Patches

mysql-mariadb-10.3.patch (last revision 2018-04-06 20:04 UTC by bero at lindev dot ch)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-04-06 20:06 UTC] bero at lindev dot ch
Same issue here on OpenMandriva with MariaDB 10.3 -- attaching a patch that makes it build and essentially work, but I'm not sure I've handled the removal of st_mysql->reconnect correctly.
 [2018-04-06 22:05 UTC] spam2 at rhsoft dot net
why don't you just build with mysqlnd - IMHO the libmysql stuff should have been removed from php many years ago
 [2018-04-07 20:39 UTC] bero at lindev dot ch
One reason not to use mysqlnd is --enable-embedded-mysqli -- other than that, mysqlnd should do the trick (but needs some testing on our side -- we know libmysql to work from years of using it).
 [2018-04-07 20:43 UTC] spam2 at rhsoft dot net
we use mysqlnd since 2010 everywhere and i don't get why it should be a problem for mysqli - until you configure with shared both are directly in teh binary

[harry@srv-rhsoft:/lib64/php/modules]$ ls | grep mysql
-rwxr-xr-x 1 root root 131K 2018-04-07 19:33 mysqli.so
-rwxr-xr-x 1 root root 290K 2018-04-07 19:33 mysqlnd.so
 [2018-11-28 10:00 UTC] m0r1arty dot nv at yandex dot ru
For temporary solution: after configure open Makefile in root php src directory,look "-I/usr/include/mysql" and replace to "-I/usr/include/mysql/server".
 [2019-05-06 04:36 UTC] phpbugs dot ooglek at 0sg dot net
This is also failing on FreeBSD. I attempted to manually patch 7.3.5 with the changes in the attached patch and compile from source without success.

I have MariaDB 10.2.22 installed.

Process:

1. Checkout git
2. git checkout php-7.3.5
3. ./buildconf --force
4. ./configure --prefix=/usr/local --with-layout=GNU --with-config-file-path=/usr/local/etc --with-config-file-scan-dir=/usr/local/etc/php --mandir=/usr/local/man --infodir=/usr/local/info/ --localstatedir=/var --enable-bcmath --enable-exif --enable-fpm --enable-ftp --enable-intl --enable-libxml --enable-mbstring --enable-mysqlnd --with-mysqli=/usr/local/bin/mysql_config --enable-pcntl --enable-soap --enable-sockets --enable-zip --with-bz2 --with-curl --with-fpm-user=www --with-fpm-group=www --with-freetype-dir=/usr/local --with-gd --with-gettext=/usr/local --with-iconv --with-jpeg-dir=/usr/local --with-libxml-dir=/usr/local --with-openssl --with-pdo-mysql=/usr/local --with-png-dir=/usr/local --with-sodium=/usr/local --with-zlib-dir=/usr --with-zlib=/usr

I get stuff like this

--- ext/mysqli/mysqli_api.lo ---
In file included from /home/human/tmp/php-src/ext/mysqli/mysqli_api.c:32:
In file included from ext/mysqli/php_mysqli_structs.h:61:
/usr/local/include/mysql/my_global.h:3:2: warning: This file should not be included by clients, include only <mysql.h> [-W#warnings]
#warning This file should not be included by clients, include only <mysql.h>
 ^
/home/human/tmp/php-src/ext/mysqli/mysqli_api.c:156:2: warning: format specifies type 'unsigned long' but the argument has type 'my_ulonglong' (aka 'unsigne
d long long') [-Wformat]
        MYSQLI_RETURN_LONG_INT(rc);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~
ext/mysqli/mysqli_priv.h:99:45: note: expanded from macro 'MYSQLI_RETURN_LONG_INT'

In file included from /home/human/tmp/php-src/ext/mysqli/mysqli_api.c:32:
In file included from ext/mysqli/php_mysqli_structs.h:77:
/usr/local/include/mysql/my_sys.h:3:2: warning: This file should not be included by clients, include only <mysql.h> [-W#warnings]
#warning This file should not be included by clients, include only <mysql.h>
 ^
 [2021-02-03 12:44 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-02-03 12:44 UTC] cmb@php.net
Is this still an issue with any of the actively supported PHP
versions[1]?  If so, I suggest to submit a PR[2]?

[1] <https://www.php.net/supported-versions.php>
[2] <https://github.com/php/php-src/pulls>
 [2021-02-14 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Mon Sep 26 13:05:56 2022 UTC