PHP 5.2.3+mysqli installation and common error summary
PHP 5.2.3+mysqli installation and common error summaryRemember that in compiling PHP has already been added parameters
--with-mysql=/usr/local/mysql \
--with-mysqli=/usr/local/mysql/bin/mysql_config \ Can later find a, indeed does not exist mysqli.so, so only to compile mysqli alone. Mysqli is a library of optimized MySQL libraries, MySQL version can not be less than 4.1.12
Cd/root/tmp/php-5.2.3/ext/mysqli
# # # #进入到mysqli的目录. Then use Phpize to generate the Configure file:
/usr/local/bin/phpizeconfiguring for:
PHP Api version:20041225
Zend Module Api no:20060613
Zend Extension Api no:220060519
#./configure--prefix=/usr/local/mysqli--with-php-config=/usr/local/bin/php-config--with-mysqli=/usr/bin/mysql_ Configmake
Make installInstalling shared extensions:/usr/local/lib/php/extensions/debug-non-zts-20060613/then in/usr/local/lib/php.ini
Add one sentence:
extension=/usr/local/lib/php/extensions/no-debug-non-zts-20060613/mysqli.so restart Apache to see that the MYSQLI has been loaded successfully.1. If there is an error code:
- /root/tmp/php-5.2.3/ext/mysqli/mysqli.c:in function ' zm_startup_mysqli ':
- /root/tmp/php-5.2.3/ext/mysqli/mysqli.c:637:error: ' Mysql_rpl_master ' undeclared (first use of this function)
- /root/tmp/php-5.2.3/ext/mysqli/mysqli.c:637:error: (Each undeclared identifier was reported only once
- /root/tmp/php-5.2.3/ext/mysqli/mysqli.c:637:error:for each function it appears in.)
- /root/tmp/php-5.2.3/ext/mysqli/mysqli.c:638:error: ' Mysql_rpl_slave ' undeclared (first use of this function)
- /root/tmp/php-5.2.3/ext/mysqli/mysqli.c:639:error: ' Mysql_rpl_admin ' undeclared (first use of this function)
- Error Code 1
|
Modify this file to
Cd/usr/include/mysql
[Email protected] [/usr/include/mysql]# VI mysql.h
In line No. 221
- ... ...
- Enum Mysql_protocol_type
- {
- Mysql_protocol_default, Mysql_protocol_tcp, Mysql_protocol_socket,
- Mysql_protocol_pipe, Mysql_protocol_memory
- };
- /*
- There is three types of queries-the ones that has to go to
- The master, the ones, go to a slave, and the adminstrative
- Type which must happen on the pivot connectioin
- */
|
#添加下面的4行
- Enum Mysql_rpl_type
- {
- Mysql_rpl_master, Mysql_rpl_slave, mysql_rpl_admin
- };
|
2. If the following error occurs:/root/tmp/php-5.2.3/ext/mysqli/mysqli_api.c:in function ' Zif_mysqli_stmt_bind_param ':
/root/tmp/php-5.2.3/ext/mysqli/mysqli_api.c:144:error: ' Gptr ' undeclared (first use of this function)
/root/tmp/php-5.2.3/ext/mysqli/mysqli_api.c:144:error: (Each undeclared identifier was reported only once
/root/tmp/php-5.2.3/ext/mysqli/mysqli_api.c:144:error:for each function it appears in.)
/root/tmp/php-5.2.3/ext/mysqli/mysqli_api.c:in function ' Zif_mysqli_stmt_execute ':
/root/tmp/php-5.2.3/ext/mysqli/mysqli_api.c:603:error: ' Gptr ' undeclared (first use of this function)
Make: * * [Mysqli_api.lo] Error 1
Modify this file to
VI Mysqli_api.c Find Allgptr, there are everywhere in line 144, line 150, line 603, line 607, to char* Replacement
Test mysqli Health: Vim mysqli.php<?php
$mysqli = new Mysqli ("localhost", "My_user", "My_password", "dbname");/* Check connection */
if (Mysqli_connect_errno ()) {
printf ("Connect failed:%s\n", Mysqli_connect_error ());
Exit ();
}printf ("Host Information:%s\n", $mysqli->host_info);
/* Close Connection */
$mysqli->close ();
?>
Linux loaded mysqli.so