百度空间 | 百度首页 
               
 
查看文章
 
php扩展中mysql版本不同引起的错误及解决方法
2008-08-07 14:56

访问一个调数据库页面时,apache error_log 提示
Character set '#24' is not a compiled character set and is not specified in the 'NONEXISTENT/charsets/Index' file
File 'NONEXISTENT/charsets/?.conf' not found (Errcode: 2)
Character set '#24' is not a compiled character set and is not specified in the 'NONEXISTENT/charsets/Index' file
File 'NONEXISTENT/charsets/?.conf' not found (Errcode: 2)
Character set '#24' is not a compiled character set and is not specified in the 'NONEXISTENT/charsets/Index' file
File 'NONEXISTENT/charsets/?.conf' not found (Errcode: 2)

通过phpinfo()函数看到

mysql

MySQL Support enabled
Active Persistent Links 0
Active Links 0
Client API version 3.23.49
MYSQL_MODULE_TYPE builtin
MYSQL_SOCKET /tmp/mysql.sock
MYSQL_INCLUDE no value
MYSQL_LIBS no value

上面这个client版本,与系统上正在使用的 mysql-4.0.24 版本不一致,当初编译php时没指定mysql路径

解决方法
重新编译php加入 --with-mysql=/usr/local/mysql

新的问题
编译时出现错误
mysql/php_mysql.c:1160: undefined reference to `mysql_create_db'
......
collect2: ld returned 1 exit status

解决方法
# clean make
# CFLAGS="-DUSE_OLD_FUNCTIONS -O6 -march=pentiumpro -fomit-frame-pointer" ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-apxs=/usr/local/apache/bin/apxs
# make && make install

重启apache

mysql

MySQL Support enabled
Active Persistent Links 0
Active Links 0
Client API version 4.0.24
MYSQL_MODULE_TYPE external
MYSQL_SOCKET /tmp/mysql.sock
MYSQL_INCLUDE -I/usr/local/mysql/include/mysql
MYSQL_LIBS -L/usr/local/mysql/lib/mysql -lmysqlclient

ok!


类别:Mysql | 添加到搜藏 | 浏览() | 评论 (0)
 
最近读者:
 
网友评论:
发表评论:
姓 名:
网址或邮箱: (选填)
内 容:
验证码: 请点击后输入四位验证码,字母不区分大小写
      

     

©2009 Baidu