# PHP5 MySQLi extension compile error



## flipper999 (Apr 11, 2013)

Hi,

I'm getting a compile error when compiling the php5-mysqli extension.


```
/usr/ports/databases/php5-mysqli/work/php-5.4.13/ext/mysqli/mysqli.c: In function 'zm_startup_mysqli':
/usr/ports/databases/php5-mysqli/work/php-5.4.13/ext/mysqli/mysqli.c:842: error: 'MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS' undeclared (first use in this function)
/usr/ports/databases/php5-mysqli/work/php-5.4.13/ext/mysqli/mysqli.c:842: error: (Each undeclared identifier is reported only once
/usr/ports/databases/php5-mysqli/work/php-5.4.13/ext/mysqli/mysqli.c:842: error: for each function it appears in.)
*** [mysqli.lo] Error code 1
```

Anyone know how to fix this?


----------



## SirDice (Apr 11, 2013)

What version of the MySQL client do you have installed? And on what version of FreeBSD?


----------



## flipper999 (Apr 11, 2013)

FreeBSD 9.1-RELEASE.
MySQL client: 

```
mysql  Ver 14.14 Distrib 5.6.10, for FreeBSD9.1 (amd64) using  5.2
```


----------



## SirDice (Apr 11, 2013)

Did you turn off MYSQLND perhaps?


----------



## flipper999 (Apr 11, 2013)

SirDice said:
			
		

> Did you turn off MYSQLND perhaps?



Not sure what you mean by this and how one would turn this off.
I did not make any changes or set any special options for "making" the port(s).


----------



## flipper999 (Apr 11, 2013)

I also tried this with MySQL 5.5, but that gave same result. Now I reverted back to php53 with php53-extensions port as a workaround.


----------



## Ikinoki (Oct 7, 2013)

/usr/ports/databases/php5-mysqli/work/php-5.4.13/ext/mysqli/mysqli.c
Just open this file and c-rem the lines 841 842 843 (the if defined) and on another error- line 1675 1676 1677 (careful there is a return, send it on the next line).

Then save and compile.

Everything works well.


----------



## ShelLuser (Oct 7, 2013)

Actually that's not the best of advice right now, note that the thread is dated. At this moment the best thing to do is to update the ports collection. You'll notice that the OP was using version 5.4.13 while we're now at version 5.4.20.

It's also safe to assume that if something was wrong with the port itself it would also have been addressed by now.


----------



## Ikinoki (Oct 8, 2013)

```
/usr/ports/databases/php5-mysqli/work/php-5.4.20/ext/mysqli/mysqli.c: In function 'zm_startup_mysqli':
/usr/ports/databases/php5-mysqli/work/php-5.4.20/ext/mysqli/mysqli.c:842: error: 'MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS' undeclared (first use in this function)
/usr/ports/databases/php5-mysqli/work/php-5.4.20/ext/mysqli/mysqli.c:842: error: (Each undeclared identifier is reported only once
/usr/ports/databases/php5-mysqli/work/php-5.4.20/ext/mysqli/mysqli.c:842: error: for each function it appears in.)
/usr/ports/databases/php5-mysqli/work/php-5.4.20/ext/mysqli/mysqli_api.c: In function 'mysqli_options_get_option_zval_type':
/usr/ports/databases/php5-mysqli/work/php-5.4.20/ext/mysqli/mysqli_api.c:1676: error: 'MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS' undeclared (first use in this function)
/usr/ports/databases/php5-mysqli/work/php-5.4.20/ext/mysqli/mysqli_api.c:1676: error: (Each undeclared identifier is reported only once
/usr/ports/databases/php5-mysqli/work/php-5.4.20/ext/mysqli/mysqli_api.c:1676: error: for each function it appears in.)
```

What? Can't hear you behind my compilation errors in php-5.4.20


----------



## ShelLuser (Oct 8, 2013)

Then there's something set up wrong on your system which causes this, because databases/php5-mysqli builds cleanly for me. Using either gcc or clang makes no difference.

I'd start by checking out your /etc/make.conf.

(*Edit*): Another possible cause could be not carefully following /usr/ports/UPDATING. databases/php5-mysqli has specific dependencies, amongst which lang/perl5.14, devel/apr1 and devel/gettext. All of which have had specific update instructions not too long ago. Not following those could cause inconsistent behaviour like this.


----------



## Ikinoki (Oct 9, 2013)

No updating, it was a clean install of FreeBSD 9.1 followed by correct update to 9-STABLE.
make.conf

```
PERL_VERSION=5.16.3
FORCE_MAKE_JOBS=yes
MAKE_JOBS_NUMBER=8
```


----------



## ShelLuser (Oct 10, 2013)

9-STABLE is the developers branch of FreeBSD. If you use that then anything could happen because it's being used for active development (allowing constant changes).

Just look here. You can also see that it's status is still set to 'open' meaning so much that changes can still be submitted and will optionally be applied.

If you want a version for simply using the OS itself then look into the RELEASE branch of either version 9.1 or 9.2.


----------



## SirDice (Oct 10, 2013)

ShelLuser said:
			
		

> 9-STABLE is the developers branch of FreeBSD. If you use that then anything could happen because it's being used for active development (allowing constant changes).


You're confusing -STABLE with -CURRENT. -CURRENT is where the active development is being done. -STABLE does have constant changes but it's quite stable (hence the name). Releases are cut from the -STABLE branches.


----------



## ShelLuser (Oct 10, 2013)

Thanks for the update.

Still, I based my information on the handbook which describes STABLE as something which should be regarded as a developers branch which uses a different pace for updates and is not aimed at end-users.

So given the mentioned problem within this context my advice would still be to consider a RELEASE.


----------



## SirDice (Oct 10, 2013)

I've been running -STABLE since 3.x and it has never caused any issues. New features are developed and tested in -CURRENT first and after a while MFC'ed to -STABLE. Because there are new and updated features things may break, which is why you should use a -RELEASE for production work. But I've never encountered any real issues. -CURRENT on the other hand is extremely unstable and at times won't even build properly. At the moment -CURRENT is fairly stable but only because of the impending 10.0-RELEASE.


----------

