php 添加mysql擴展

os:CentOS release 5.8 (Final)
php 版本:http://cn2.php.net/distributions/php-5.6.18.tar.gzphp

先yum安裝libxml ,openssl ,mysql,mysql-devel 等。mysql

網上搜索了下congfigure命令以下sql

./configure --prefix=/usr/local/php5 --with-config-file-path=/usr --with-mysql=/usr/include/mysql --with-mysqli=/usr/bin/mysql_config --with-libxml-dir=/usr/local/libxml2 --with-openssl.net

報錯:日誌

Cannot find MySQL header files under /usr/include/mysqlxml

網上各類說法都嘗試了,都沒有用,後來我直接看configure文件爲啥老這樣報,ssl

因而先grep 'error: Cannot find MySQL header files under' configure -nget

發現出現這條日誌的地方在這裏:openssl

./configure:it

fi

if test "$PHP_MYSQL" = "yes" || test "$PHP_MYSQL" = "mysqlnd"; then
    PHP_MYSQLND_ENABLED=yes

elif test "$PHP_MYSQL" != "no"; then
  MYSQL_DIR=
  MYSQL_INC_DIR=

  if test -r $PHP_MYSQL/include/mysql/mysql.h; then
    MYSQL_DIR=$PHP_MYSQL
    MYSQL_INC_DIR=$PHP_MYSQL/include/mysql
    break
  elif test -r $PHP_MYSQL/include/mysql.h; then
    MYSQL_DIR=$PHP_MYSQL
    MYSQL_INC_DIR=$PHP_MYSQL/include
    break
  fi

  if test -z "$MYSQL_DIR"; then
    { { $as_echo "$as_me:$LINENO: error: test Cannot find MySQL header files under $PHP_MYSQL.
Note that the MySQL client library is not bundled anymore!" >&5
$as_echo "$as_me: error: hgyang Cannot find MySQL header files under $PHP_MYSQL $MYSQL_DIR.
Note that the MySQL client library is not bundled anymore!" >&2;}
   { (exit 1); exit 1; }; }
  fi

 

你妹啊!!!

原來 --with-mysql=/usr就能夠了,include/mysql已經被包含了,哥瞬間淚奔了,好大一個坑。

相關文章
相關標籤/搜索