php怎么增加mysql扩展
php增加mysql擴展的方法:1、通過yum安裝libxml,openssl,mysql,mysql-devel等;2、修改“--with-mysql=/usr”即可。
本文操作環(huán)境:CentOS release 5.8系統(tǒng),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 等。
網(wǎng)上搜索了下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
網(wǎng)上各種說法都嘗試了,都沒有用,后來我直接看configure文件為啥老這樣報,
于是先grep 'error: Cannot find MySQL header files under' configure -n
發(fā)現(xiàn)出現(xiàn)這條日志的地方在這里:
./configure:fiif test "$PHP_MYSQL" = "yes" || test "$PHP_MYSQL" = "mysqlnd"; then PHP_MYSQLND_ENABLED=yeselif 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已經(jīng)被包含了,哥瞬間淚奔了,好大一個坑。
推薦學(xué)習(xí):《PHP視頻教程》
總結(jié)
以上是生活随笔為你收集整理的php怎么增加mysql扩展的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: extjs插件开发上传下载文件简单案例
- 下一篇: css样式中focus是什么意思