# Trouble with php5-mysqli and installing phpMyAdmin.



## snerpton (Feb 11, 2010)

Hi,

First of all, apologies if this is a daft question and I have missed the obvious; I'm new to FreeBSD.

I have been trying to set up a development web server with the usual Apache, MySQL, PHP and phpMyAdmin. I've manage to install from the ports collection OpenSSL, Apache, MySQL and PHP (in that order), but I am having a little difficulty with phpMyAdmin.

Half way through compiling phpMyAdmin I ran into an error, saying some function in mysqli wasn't present. These are the last few lines of the compile:


```
cc -I. -I/usr/ports/databases/php5-mysqli/work/php-5.2.12/ext/mysqli -DPHP_ATOM_INC -I/usr/ports/databases/php5-mysqli/work/php-5.2.12
/ext/mysqli/include -I/usr/ports/databases/php5-mysqli/work/php-5.2.12/ext/mysqli/main -I/usr/ports/databases/php5-mysqli/work/php-5.2.12
/ext/mysqli -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local
/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/local/include/mysql -DHAVE_CONFIG_H -O2 -fno-strict-aliasing -pipe -c /usr/ports
/databases/php5-mysqli/work/php-5.2.12/ext/mysqli/mysqli.c  -fPIC -DPIC -o .libs/mysqli.o
/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

Stop in /usr/ports/databases/php5-mysqli.
*** Error code 1

Stop in /usr/ports/databases/phpmyadmin.
*** Error code 1
```

I attempted to make mysqli (/usr/ports/databases/php5-mysqli) and met with the error:


```
===>  Building for php5-mysqli-5.2.12
/bin/sh /usr/ports/databases/php5-mysqli/work/php-5.2.12/ext/mysqli/libtool --mode=compile cc  -I. -I/usr/ports/databases/php5-mysqli/work/php-
5.2.12/ext/mysqli -DPHP_ATOM_INC -I/usr/ports/databases/php5-mysqli/work/php-5.2.12/ext/mysqli/include -I/usr/ports/databases/php5-mysqli
/work/php-5.2.12/ext/mysqli/main -I/usr/ports/databases/php5-mysqli/work/php-5.2.12/ext/mysqli -I/usr/local/include/php -I/usr/local/include
/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr
/local/include/mysql  -DHAVE_CONFIG_H  -O2 -fno-strict-aliasing -pipe   -c /usr/ports/databases/php5-mysqli/work/php-5.2.12/ext/mysqli
/mysqli.c -o mysqli.lo
mkdir .libs
 cc -I. -I/usr/ports/databases/php5-mysqli/work/php-5.2.12/ext/mysqli -DPHP_ATOM_INC -I/usr/ports/databases/php5-mysqli/work/php-5.2.12
/ext/mysqli/include -I/usr/ports/databases/php5-mysqli/work/php-5.2.12/ext/mysqli/main -I/usr/ports/databases/php5-mysqli/work/php-5.2.12
/ext/mysqli -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local
/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/local/include/mysql -DHAVE_CONFIG_H -O2 -fno-strict-aliasing -pipe -c /usr/ports
/databases/php5-mysqli/work/php-5.2.12/ext/mysqli/mysqli.c  -fPIC -DPIC -o .libs/mysqli.o
/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

Stop in /usr/ports/databases/php5-mysqli.
```

I deselected mysqli from the phpMyAdmin configuration, and found I am able to make phpMyAdmin and install it.

So it seem as though the problem lies with the mysqli port. Any help with how to make this so as to allow it to be included when making phpMyAdmin would be very much appreciated.

Kind regards,

Chris

Background information follows in my next post


----------



## snerpton (Feb 11, 2010)

*Background Information*

Before making each port I have updated the port collection with:

```
portsnap fetch update
```

The Apache, MySQL and PHP parts run just fine, the problem seems to lies with phpMyAdmin.

The ports I have directly and indirectly installed are:


```
apache-2.2.14_5     Version 2.2.x of Apache web server with prefork MPM.
autoconf-2.62       Automatically configure source code on many Un*x platforms 
autoconf-wrapper-20071109 Wrapper script for GNU autoconf
automake-1.10.1     GNU Standards-compliant Makefile generator (1.10)
automake-wrapper-20071109 Wrapper script for GNU automake
bash-4.0.35         The GNU Project's Bourne Again SHell
bigreqsproto-1.0.2  BigReqs extension headers
bison-2.4.1,1       A parser generator from FSF, (mostly) compatible with Yacc
expat-2.0.1_1       XML 1.0 parser written in C
freetype2-2.3.11    A free and portable TrueType font rendering engine
gettext-0.17_1      GNU gettext package
gmake-3.81_3        GNU version of 'make' utility
help2man-1.37.1     Automatically generating simple manual pages from program o
inputproto-1.5.0    Input extension headers
jpeg-8              IJG's jpeg compression utilities
kbproto-1.0.3       KB extension headers
libICE-1.0.4_1,1    Inter Client Exchange library for X11
libSM-1.1.0_1,1     Session Management library for X11
libX11-1.2.1_1,1    X11 library
libXau-1.0.4        Authentication Protocol library for X11
libXaw-1.0.5_1,1    X Athena Widgets library
libXdmcp-1.0.2_1    X Display Manager Control Protocol library
libXext-1.0.5,1     X11 Extension library
libXmu-1.0.4,1      X Miscellaneous Utilities libraries
libXp-1.0.0,1       X print library
libXpm-3.5.7        X Pixmap library
libXt-1.0.5_1       X Toolkit library
libcheck-0.9.8      A unit test framework for C
libgcrypt-1.4.4     General purpose crypto library based on code used in GnuPG
libgpg-error-1.7    Common error values for all GnuPG components
libiconv-1.13.1_1   A character set conversion library
libltdl-2.2.6b      System independent dlopen wrapper
libmcrypt-2.5.8     Multi-cipher cryptographic library (used in PHP)
libpthread-stubs-0.3_3 This library provides weak aliases for pthread functions
libtool-2.2.6b      Generic shared library support script
libxcb-1.5          The X protocol C-language Binding (XCB) library
libxml2-2.7.6_1     XML parser library for GNOME
libxslt-1.1.26      The XSLT C library for GNOME
m4-1.4.13,1         GNU m4
makedepend-1.0.1,1  A dependency generator for makefiles
mysql-client-5.5.1  Multithreaded SQL database (client)
mysql-server-5.5.1  Multithreaded SQL database (server)
openssl-0.9.8l_4    SSL and crypto library
p5-gettext-1.05_2   Message handling functions
pcre-8.00           Perl Compatible Regular Expressions library
pdflib-7.0.4        A C library for dynamically generating PDF
pecl-pdflib-2.1.6_1 A PECL extension to create PDF on the fly
perl-5.10.1         Practical Extraction and Report Language
php5-5.2.12         PHP Scripting Language
php5-bz2-5.2.12     The bz2 shared extension for php
php5-ctype-5.2.12   The ctype shared extension for php
php5-filter-5.2.12  The filter shared extension for php
php5-gd-5.2.12      The gd shared extension for php
php5-mbstring-5.2.12 The mbstring shared extension for php
php5-mcrypt-5.2.12  The mcrypt shared extension for php
php5-mysql-5.2.12   The mysql shared extension for php
php5-openssl-5.2.12 The openssl shared extension for php
php5-pcre-5.2.12    The pcre shared extension for php
php5-session-5.2.12 The session shared extension for php
php5-simplexml-5.2.12 The simplexml shared extension for php
php5-spl-5.2.12     The spl shared extension for php
php5-zip-5.2.12     The zip shared extension for php
php5-zlib-5.2.12    The zlib shared extension for php
phpMyAdmin-3.2.5    A set of PHP-scripts to manage MySQL over the web
pkg-config-0.23_1   A utility to retrieve information about installed libraries
png-1.2.42          Library for manipulating PNG images
portaudit-0.5.14    Checks installed ports against a list of security vulnerabi
portmaster-2.19     Manage your ports without external databases or languages
printproto-1.0.4    Print extension headers
python26-2.6.4      An interpreted object-oriented programming language
sudo-1.7.2.2        Allow others to run commands as root
t1lib-5.1.2_1,1     A Type 1 Rasterizer Library for UNIX/X11
xcb-proto-1.6       The X protocol C-language Binding (XCB) protocol
xcmiscproto-1.1.2   XCMisc extension headers
xextproto-7.0.5     XExt extension headers
xf86bigfontproto-1.1.2 XFree86-Bigfont extension headers
xorg-macros-1.2.1   X.Org development aclocal macros
xproto-7.0.15       X11 protocol headers
xtrans-1.2.3        Abstract network code for X
```

I started from a minimum install on:

```
# uname -a
FreeBSD dinosaur.homeln 7.2-RELEASE FreeBSD 7.2-RELEASE #0: Fri May  1 08:49:13 UTC 2009     root@walker.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
```

Any other information feel free to ask, and as before, any help would be much appreciated.

Chris


----------



## SirDice (Feb 11, 2010)

The only thing I could think off is the mysql version. Any reason why you picked 5.5.x? 
I've found that most of these 'extra' plugins or forum/cms still work best on 5.0.x or 5.1.x.


----------



## MarS (Feb 12, 2010)

SirDice is right, it is because of MySQL 5.5. Solution can be found here.


----------



## snerpton (Feb 12, 2010)

Thanks for taking an interest.

I believe I have deleted phpMyAdmin, PHP and MySQL. with a series of pkg_delete -r PACKAGE. I finished with portmaster --clean-distfiles. 

I wrote a long post, but as it took over an hour i was logged out and lost the post!

It seems as though phpMyAdmin with mysqli requires php5-mysqli-5.2.12, which in turn requires MySQL 5.0.89:


```
# make search name=mysqli
Port:	php5-mysqli-5.2.12
Path:	/usr/ports/databases/php5-mysqli
Info:	The mysqli shared extension for php
Maint:	ale@FreeBSD.org
B-deps:	autoconf-2.62 autoconf-wrapper-20071109 libiconv-1.13.1_1 libxml2-2.7.6_1 m4-1.4.13,1 mysql-client-5.0.89 pcre-8.00 perl-5.10.1 
php5-5.2.12 php5-pcre-5.2.12 php5-simplexml-5.2.12 php5-spl-5.2.12 pkg-config-0.23_1
R-deps:	libiconv-1.13.1_1 libxml2-2.7.6_1 mysql-client-5.0.89 pcre-8.00 php5-5.2.12 php5-pcre-5.2.12 php5-simplexml-5.2.12 php5-spl-5.2.12 
pkg-config-0.23_1
WWW:	http://www.php.net/
```

I believe the MySql client and server version must be the same?

My install process was:

```
# cd /usr/ports/databases/mysql50-server/
# make -D BUILD_OPTIMIZED install clean
```
Amongst other things, this installed:

```
mysql-client-5.0.89 Multithreaded SQL database (client)
mysql-server-5.0.89 Multithreaded SQL database (server)
```
 To build PHP etc I used:

```
cd /usr/ports/lang/php5
make config; make install clean  -- Apache module enabled
cd /usr/ports/databases/php5-mysqli
make install clean
cd /usr/ports/databases/php5-mysql
make install clean
```

To install phpMyAdmin:

```
cd /usr/ports/databases/phpmyadmin
make config; make install clean  -- enabled mysqli
```

And PHP sessions:

```
cd /usr/ports/www/php5-session
make install clean
```

I now have a working AMP installation with phpMyAdmin.

Many thanks for prodding me in the correct direction.

Kind regards,

Chris


----------



## snerpton (Feb 12, 2010)

Many thanks MarS.


----------



## SirDice (Feb 12, 2010)

snerpton said:
			
		

> It seems as though phpMyAdmin with mysqli requires php5-mysqli-5.2.12, which in turn requires MySQL 5.0.89:


If a port requires mysql but doesn't specifically state a version 5.0.x will be used. You can change the default version by adding the following to /etc/make.conf:

```
DEFAULT_MYSQL_VER=51
```

More information about this can be found in /usr/ports/Mk/bsd.database.mk.



> I believe the MySql client and server version must be the same?


Absolutely. Actually, they both use the same source files


----------



## snerpton (Feb 12, 2010)

Hi SirDice,

Going a bit off topic with regard to the initial post... but here goes.

When you say





> If a port requires mysql but doesn't specifically state a version 5.0.x will be used...


How do I set about finding this information out? I have been using make _search name=somename_ to find the port and reading the resulting information regarding root and branch dependencies. I have also searched on http://www.freebsd.org/ports/index.html.

Is this where I would be told if a port required a specific version of another port?

Is this the best way to research dependencies, or is there a better method?

Many thanks,

Chris


----------

