# Error in Installing php5-mysqli



## qatanah (Jan 19, 2010)

Hi,

I'm getting this error when trying to install on php5-mysqli.

```
/usr/ports/databases/php5-mysqli/work/php-5.2.12/ext/mysqli/mysqli.c: In function 'zm_startup_mysqli':
/usr/ports/databases/php5-mysqli/work/php-5.2.12/ext/mysqli/mysqli.c:637: error: 'MYSQL_RPL_MASTER' undeclared (first use in this function)
/usr/ports/databases/php5-mysqli/work/php-5.2.12/ext/mysqli/mysqli.c:637: error: (Each undeclared identifier is reported only once
/usr/ports/databases/php5-mysqli/work/php-5.2.12/ext/mysqli/mysqli.c:637: error: for each function it appears in.)
/usr/ports/databases/php5-mysqli/work/php-5.2.12/ext/mysqli/mysqli.c:638: error: 'MYSQL_RPL_SLAVE' undeclared (first use in this function)
/usr/ports/databases/php5-mysqli/work/php-5.2.12/ext/mysqli/mysqli.c:639: error: 'MYSQL_RPL_ADMIN' undeclared (first use in this function)
*** Error code 1
1 error
*** Error code 1
```


I'm using freebsd8. Any ideas?


----------



## crsd (Jan 19, 2010)

Which mysql-client version do you have installed?


----------



## qatanah (Jan 19, 2010)

Yes, here it is: 


```
mysql-client-5.5.1  Multithreaded SQL database (client)
mysql-server-5.5.1  Multithreaded SQL database (server)
```


----------



## qatanah (Jan 20, 2010)

For some reason, I was able to fix this by downgrading my mysql-server/client to 5.1.

Thanks for the heads-up on the version.


----------



## R1_Bzh (Jan 20, 2010)

Iv'e found this solution on a chinese forum


```
cd /usr/local/include/mysql
toor@com[/usr/local/include/mysql] vi mysql.h

... ...
enum mysql_protocol_type
{
MYSQL_PROTOCOL_DEFAULT, MYSQL_PROTOCOL_TCP, MYSQL_PROTOCOL_SOCKET,
MYSQL_PROTOCOL_PIPE, MYSQL_PROTOCOL_MEMORY
};
/*
There are three types of queries - the ones that have to go to
the master, the ones that go to a slave, and the adminstrative
type which must happen on the pivot connectioin
*/
enum mysql_rpl_type
{
MYSQL_RPL_MASTER, MYSQL_RPL_SLAVE, MYSQL_RPL_ADMIN
};

typedef struct character_set
{
unsigned int number; /* character set number */
unsigned int state; /* character set state */
const char *csname; /* collation name */
const char *name; /* character set name */
```

it's working with mysql55-server and php5-mysqli


----------



## MarS (Jan 21, 2010)

Thanks! I was about to downgrade to MySQL 5.1 but luckily I saw this before.


----------



## dbi (Jan 21, 2010)

Thanks from me too!


----------



## vizkr (Feb 1, 2010)

Fantastic! Brilliant this worked like a charm. Thanks for figuring it out.

I created a patch file for these changes. It's available at http://mikelking.com/files/mysql.h-patch and hopefully I did it right.

Cheers,
Mikel King


----------



## vizkr (Feb 2, 2010)

I also got this error after getting things to finally compile properly.

php -v

```
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20060613/xsl.so' - /usr/local/lib/php/20060613/xsl.so: 
Undefined symbol "dom_node_class_entry" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20060613/mysqli.so' - /usr/local/lib/php/20060613/mysqli.so: 
Undefined symbol "spl_ce_RuntimeException" in Unknown on line 0
PHP 5.2.12 with Suhosin-Patch 0.9.7 (cli) (built: Feb  1 2010 18:57:43) 
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
```

So I moved rearranged some of the extensions in /usr/local/etc/php/extensions.ini. Specifically I moved the line extension=mysqli.so to appear after extension=spl.so. Then I move the line extension=xsl.so to the end of the file after all of the extensions that defined XML. 

As you can see all seems well.

php -v

```
PHP 5.2.12 with Suhosin-Patch 0.9.7 (cli) (built: Feb  1 2010 18:57:43) 
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
```

Cheers,
Mikel King


----------



## Yettie (Apr 12, 2010)

crsd said:
			
		

> Which mysql-client version do you have installed?



Thank you for your help in channel ##freebsd on freenode


----------

