883   Centos MySQL PHP

PHP扩展通过phpize安装之前说过很多,今天安装mysql扩展时遇到些奇怪的错误
1,

Cannot find MySQL header files

首先确认有没 mysql.h文件

find / -name mysql.h

如果没有就安装mysql-devel

yun install mysql-devel

安装之后,重新编译扩展使用以下参数即可,不用制定mysql目录

--with-mysql

2,

ext/mysqlnd/mysqlnd_libmysql_compat.h

编译mysql竟然跟mysqlnd有关,什么鬼!
谷歌一番说得重新编译php,真是见鬼了,不过还真有效。
重新编译PHP参数更改如下

--with-mysql=shared,msyqlnd

3,

configure: error: Cannot find libmysqlclient under /usr

重新编译PHP时又报其他错误,好吧,继续谷歌
这是因为PHP没有找到libmysqlclient,但是它是有的,查下就知道

[root@localhost ~]# find / -name libmysqlclient*
/usr/lib64/mysql/libmysqlclient_r.so.16
/usr/lib64/mysql/libmysqlclient_r.so.16.0.0
/usr/lib64/mysql/libmysqlclient.so.16.0.0
/usr/lib64/mysql/libmysqlclient.so.16
/usr/lib64/mysql/libmysqlclient.so
/usr/lib64/mysql/libmysqlclient_r.so

但是PHP去了/usr/lib目录找,所以得做个软连接

ln -s /usr/lib64/mysql/libmysqlclient.so /usr/lib/libmysqlclient.so 



Leave a Reply

Your email address will not be published. Required fields are marked *