六、使用编译安装httpd,php时遇到的问题及解决方法
1、 要使用usvn就要注意PHP的版本5.1.2 <= ver < 5.3,httpd要把模块mod_rewrite、mod_dav mod_ssl
2、 Apache相关的软件包apr apr-util httpd 可以从获得
Subversion包下载地址
3、 以下编译代码:
? install apr-1.4.5
./configure
make && make install
? install apr-util
/configure --with-apr=/usr/local/apr
make && make install
? install httpd
./configure --prefix=/usr/local/httpd-2.2.192 \
–-enable-rewrite \
--enable-dav \
--enable-so \
--enable-maintainer-mode \
--enable-ssl \
--with-apr=/usr/local/apr/bin/apr-1-config\ --with-apr-util=/usr/local/apr/bin/apu-1-config &&make && make install
? install subversion
./configure
--prefix=/usr/local/subversion-1.6.11 \
--with-apxs=/usr/local/httpd/bin/apxs \
--with-apr=/usr/local/apr \
--with-apr-util=/usr/local/apr && make && make install
? install php
./configure --prefix=/usr/local/php \
--with-apxs2=/usr/local/httpd/bin/apxs \
--with-config-file-path=/usr/local/php \
--with-mysql=/usr/local/mysql --with-freetype-dir \
--with-gd --with-jpeg-dir --with-curl --with-png-dir \
--with-zlib --enable-mbstring \
--enable-exif \
--with-openssl && make && make install
? Install mysqli
cd /mysql-ser/ext/mysqi/
/usr/local/php/bin/phpize (产生configure文件)
./configure \
-prefix=/usr/local/mysqli \
-with-php-config=/usr/local/php/bin/php-config \
-with-mysqli=/usr/local/mysql/bin/mysql_config && make && make install
在/usr/local/php/php.ini 添加mysqli.so模块
extension_dir=”/path/to/mysqli.so/dir” 这个mysqli.so文件的目录在安装完成会显示
extension=mysqli.so
4、错误解决方法
? 在编译mysqli.so的错误
vi /usr/local/mysql/include/mysql.h
在第221行
... ...
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
*/
#添加下面的4行
enum mysql_rpl_type
{
MYSQL_RPL_MASTER, MYSQL_RPL_SLAVE, MYSQL_RPL_ADMIN
};
2、如果出现以下错误:
/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 in this function)
/root/tmp/php-5.2.3/ext/mysqli/mysqli_api.c:144: error: (Each undeclared identifier is 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 in this function)
make: *** [mysqli_api.lo] 错误 1
修改一下这个文件就可以
vi mysqli_api.c
查找所有gptr,有四处分别位于行144、行150、行603、行607,以 char* 替换
? 在进行到usvn第六步时要出现type=innodb错误,将报错的文件type=innodb全替换成engine=innodb,因为新的mysql版本不在支持type命令。