php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28376 mysqli compile failure
Submitted: 2004-05-12 19:43 UTC Modified: 2004-07-11 22:27 UTC
Votes:15
Avg. Score:4.1 ± 0.9
Reproduced:15 of 15 (100.0%)
Same Version:13 (86.7%)
Same OS:8 (53.3%)
From: jedihudzilla at hotmail dot com Assigned: georg (profile)
Status: Closed Package: Compile Failure
PHP Version: 5CVS-2004-05-12 (dev) OS: Linux/Mandrake 10
Private report: No CVE-ID: None
 [2004-05-12 19:43 UTC] jedihudzilla at hotmail dot com
Description:
------------
Using the latest snapshot of PHP5 and MySQL 4.1.2  (it's 4.1.2-alpha-nightly-20040512) I get a compile failure with PHP.  MySQL was configured with:
  --prefix=/usr/local/mysql.

PHP was configured with 
  --with-mysqli=/usr/local/mysql/bin/mysql_config
  --prefix=/usr/local/php

With this it gets to compiling mysqli_prop.c then errors out:

/home/foo/php5-200405121430/ext/mysqli/mysqli_prop.c: In function 'stmt_num_rows_read':
/home/foo/php5-200405121430/ext/mysqli/mysqli_prop.c:191: error: invalid type argument of '->'
/home/foo/php5-200405121430/ext/mysqli/mysqli_prop.c:191: error: invalid type argument of '->'
/home/foo/php5-200405121430/ext/mysqli/mysqli_prop.c:191: error: invalid type argument of '->'
make: *** [ext/mysqli/mysqli_prop.lo] Error 1

I had previously tried with the pre-built MySQL binary for 4.1.1, which let PHP compile fine.  This seemed to be because PHP disabled the prepared statement code as it was < 4.1.2, which was why I downloaded the MySQL CVS build.

This also fails with PHP5 RC2, which was what I was using before I tried the PHP CVS snapshot.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-06-05 22:38 UTC] agifford at infowest dot com
I see the exact same problem building PHP5 (5.0.0RC2) from the FreeBSD port (mod_php5) using MYSQLI with the latest FreeBSD MYSQL 4.1 port (4.1.2) under FreeBSD 5.0.  It's probably related to the incompatible API changes MySQL recently made for the 4.1.2 alpha release (see http://lists.mysql.com/announce/199 for some info), but I don't know enought to go looking.
 [2004-06-05 22:51 UTC] agifford at infowest dot com
POSSIBLE FIX:

For PHP 5.0.0RC2 with MySQL 4.1.2 the following change to the PHP source file /ext/mysqli/mysqli_prop.c at line 191 fixed the issue for me (so far as I can tell - my mysql PHP web scripts appear to be working all right):

Change it FROM:

MYSQLI_MAP_PROPERTY_LONG_LONG(stmt_num_rows_read, STMT, stmt->result->row_count);

Change it TO:

MYSQLI_MAP_PROPERTY_LONG_LONG(stmt_num_rows_read, STMT, stmt->result.rows);

Looking at mysql.h, I see that the MYSQL_STMT structure's "result" member is of type MYSQL_DATA, which is a structure, not a pointer, and it has a member named "rows" but not one named "row_count".

Hope this helps!

-Aaron out.
 [2004-06-06 09:05 UTC] lars dot a dot johansson at se dot atlascopco dot com
Thanks Aaron, now it compiles. 
I spent 5 hours yesterday with this problem. The time wasn't wasted, as I learned a lot about CVS, configure, make etc.
 [2004-06-09 11:03 UTC] todd2321 at hotmail dot com
Hi

I've experienced a similar problem using MySQL 5 alpha :

Linux Mandrake 10 official
Apache 2.0.49
PHP 5 RC2
MySQL 5 alpha

CONFIGURE runs fine
./configure --with-apxs2=/usr/local/apache2/bin/apxs --disable-cgi  --without-mysql  --with-mysqli=/usr/bin/mysql_config

MAKE crashs like this :

/home/foo/php-5.0.0RC2/ext/mysqli/mysqli_prop.c: In function `stmt_affected_rows_read':
/home/foo/php-5.0.0RC2/ext/mysqli/mysqli_prop.c:189: error: structure has no member named `affected_rows'
/home/foo/php-5.0.0RC2/ext/mysqli/mysqli_prop.c:189: error: structure has no member named `affected_rows'
/home/foo/php-5.0.0RC2/ext/mysqli/mysqli_prop.c:189: error: structure has no member named `affected_rows'
make: *** [ext/mysqli/mysqli_prop.lo] Erreur 1

Thanks a lot to Aaron who opens my eyes, the problem is located near line 190 in ext/mysqli/mysqli_prop.c :

#if MYSQL_VERSION_ID < 40102
MYSQLI_MAP_PROPERTY_LONG_LONG(stmt_affected_rows_read, STMT, stmt->mysql->last_used_con->affected_rows);
#else
MYSQLI_MAP_PROPERTY_LONG_LONG(stmt_affected_rows_read, STMT, stmt->result->affected_rows);
#endif

Replace this last 5 lines by this only one works fine for me :
MYSQLI_MAP_PROPERTY_LONG_LONG(stmt_affected_rows_read, STMT, stmt->mysql->last_used_con->affected_rows);

Hope this helps. 
Todd

PS : there is another similar  bug with PHP 5 RC 3, this one seems to be located in mysqli.c ...
 [2004-07-11 22:27 UTC] georg@php.net
fixed (works with MySQL 4.1.3-beta)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Sep 11 22:01:26 2024 UTC