php增加mysql擴充的方法:1、透過yum安裝libxml,openssl,mysql,mysql-devel等;2、修改「--with-mysql=/usr」即可。
本文操作環境:CentOS release 5.8系統,PHP5.6版,Dell G3電腦。
php怎麼增加mysql擴充?
php 新增mysql擴充:
os:CentOS release 5.8 (Final)
php 版本:http://cn2.php .net/distributions/php-5.6.18.tar.gz
先yum安裝libxml ,openssl ,mysql,mysql-devel 等。
網路上搜尋了下congfigure指令如下
./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
報錯:
Cannot find MySQL header files under /usr/include/mysql
網路上各種說法都嘗試了,都沒有用,後來我直接看configure檔為啥老這樣報,
於是先grep 'error: Cannot find MySQL header files under' configure -n
發現出現這條日誌的地方在這裡:
./configure: 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已經被包含了,哥哥瞬間淚奔了,好大一個坑。
推薦學習:《PHP影片教學》
以上是php怎麼增加mysql擴展的詳細內容。更多資訊請關注PHP中文網其他相關文章!