sles10.1的安装源中只用php5-pdo,没有pdo_mysql,安装后phpinfo页面PDO drivers栏为空。
下载并安装PDO_MYSQL 1.0.1
wget http://pecl.php.net/get/PDO_MYSQL-1.0.1.tgz
tar zxvf PDO_MYSQL-1.0.1.tgz
cd PDO_MYSQL-1.0.1/
phpize
./configure
报错:
PDO_MYSQL – mysql_config and header files problem
安装mysql_devel,继续:
./configure
又报错:
configure: error:
You’ve configured extension pdo_mysql, which depends on extension pdo,
but you’ve either not enabled pdo, or have disabled it.
到这里就怎么也进行不下去了,查了好多资料,都没用。后来看到一篇文章说把configure中的这一段判断注释掉,试了一下成功了。要注释的内容:
if test “$am_i_shared” = “no” && test “$is_it_shared” = “yes” ; then
{ { echo “$as_me:$LINENO: error:
You’ve configured extension pdo_mysql to build statically, but it
depends on extension pdo, which you’ve configured to build shared.
You either need to build pdo_mysql shared or build pdo statically for the
build to be successful.
” >&5
echo “$as_me: error:
You’ve configured extension pdo_mysql to build statically, but it
depends on extension pdo, which you’ve configured to build shared.
You either need to build pdo_mysql shared or build pdo statically for the
build to be successful.
” >&2;}
{ (exit 1); exit 1; }; }
fi
# if test “x$is_it_shared” = “x” && test “x” != “xtrue”; then
# { { echo “$as_me:$LINENO: error:
#You’ve configured extension pdo_mysql, which depends on extension pdo,
#but you’ve either not enabled pdo, or have disabled it.
#” >&5
#echo “$as_me: error:
#You’ve configured extension pdo_mysql, which depends on extension pdo,
#but you’ve either not enabled pdo, or have disabled it.
#” >&2;}
# { (exit 1); exit 1; }; }
# fi
PDO_MYSQL_MODULE_TYPE=external
PDO_MYSQL_SHARED_LIBADD=$PDO_MYSQL_LIBS
然后继续:
make
make install
提示生成的so文件在/usr/lib/php5/extensions/pdo_mysql.so,修改php的配置文件增加pdo_mysql的extension:
cd /etc/php5/conf.d
cp pdo.ini pdo_mysql.ini
vi pdo_mysql.ini
把pdo.so改成pdo_mysql.so
重启apache