(1)问题
在编译php-5.2.6时:
./configure --prefix=/usr/local/php/ --with-config-file-path=/usr/local/php/etc/ --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql/ --with-libxml-dir=/usr/local/libxml2/ --with-jpeg-dir=/usr/local/jpeg6/ --with-freetype-dir=/usr/local/freetype/ --with-gd=/usr/local/gd2/ --with-mcrypt=/usr/local/libmcrypt/ --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-soap --enable-mbstring=all --enable-sockets
报如下错误:
/software/LAMP_Resource_Package/php-5.2.6/ext/mysqli/mysqli.c: In function 'zm_startup_mysqli':
/software/LAMP_Resource_Package/php-5.2.6/ext/mysqli/mysqli.c:643: error: 'MYSQL_RPL_MASTER' undeclared (first use in this function)make: *** [ext/mysqli/mysqli.lo] 错误 1
(2)原因
这是mysql的一个bug,http://bugs.php.net/bug.php?id=46207&edit=1 ,已经提交了。
(3)解决方法:
修改/usr/local/mysql/include/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 */
const char *comment; /* comment */
const char *dir; /* character set directory */
unsigned int mbminlen; /* min. length for multibyte strings */
unsigned int mbmaxlen; /* max. length for multibyte strings */
} MY_CHARSET_INFO;
将以上红色加粗的内容,添加到mysql.h文件对应的位置,重新编译php即可。