今天尝试编译PHP4中加上MYSQL4,据说mysql3的CLIENT的协议是一个非常老的,速度什么的差很多,可编译好几次都失败了,今天决定一定编译过去
用的是这个命令:
./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-apache=../apache_1.3.33 --with-iconv
中间是加了ICONV,字符的转换,中间我需要UTF-8 转成 GB2312, 在/usr/local/mysql 装4.1.16,然后就报这个错
1 ext/mysql/php_mysql.
lo( .text+0x2040) : In function `zif_mysql_create_db':
2 /var/temp/php-4.4.0/ext/mysql/php_mysql.c:1160: undefined reference to `mysql_create_db' 3 ext/mysql/php_mysql.lo(.text+0x2253): In function `zif_mysql_drop_db': 4 /var/temp/php-4.4.0/ext/mysql/php_mysql.c:1202: undefined reference to `mysql_drop_db'
在GOOGLE中查了一下,台湾的一个哥们显然也碰到了这个问题
中间他提示: 才找到是因為 PHP 使用了 MySQL 4 預設不編譯的 3.x 舊 function 所以要在 build MySQL 時指定 CFLAGS=-DUSE_OLD_FUNCTIONS 的環境變數,
CFLAGS="-O6 -mpentiumpro -fomit-frame-pointer" CXX=gcc CXXFLAGS="-O6 -mpentiumpro -fomit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti"
./configure --prefix=/usr/local/mysql CFLAGS="-DUSE_OLD_FUNCTIONS -O6 -march=pentiumpro -fomit-frame-pointer" --with-mysqld-ldflags=-all-static --without-inodb --without-bdb
又全部重新编译APACHE和php
./configure / --prefix=/usr/local/apache / --activate-module=src/modules/php4/libphp4.a / --disable-module=actions / --disable-module=autoindex / --disable-module=env / --disable-module=imap / --disable-module=negotiation / --disable-module=status / --disable-module=userdir / --disable-module=cgi / --disable-module=include / --disable-module=auth / --disable-module=asis / --enable-module=so / --enable-module=setenvif / --enable-module=rewrite / --enable-module=expires;make;make install;
重新编译成功,只是ZEND OPTIMZER好像就安装不成了,php是用的4.4.1 ,不知道zend OPTIMZER应该是用那个版本