Board logo

标题: [教程] 增加mysqli 扩展 的安裝 [打印本页]

作者: bluegua    时间: 2011-11-15 17:13     标题: 增加mysqli 扩展 的安裝

假如你是用lanmp.tar.gz安装的
cd lanmp/php-5.2.17
可以通过phpinfo来查看原本php的编译参数,如下
./configure --prefix=/www/wdlinux/php-5.2.17 --with-config-file-path=/www/wdlinux/etc --with-fpm-conf=/www/wdlinux/etc/php-fpm.conf --with-mysql=/www/wdlinux/mysql --with-iconv-dir=/usr --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --with-mcrypt=/usr --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-ftp --with-apxs2=/www/wdlinux/apache/bin/apxs

在最后增加 --with-mysqli=/www/wdlinux/mysql/bin/mysql_config

全部如下
./configure --prefix=/www/wdlinux/php-5.2.17 --with-config-file-path=/www/wdlinux/etc --with-fpm-conf=/www/wdlinux/etc/php-fpm.conf --with-mysql=/www/wdlinux/mysql --with-iconv-dir=/usr --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --with-mcrypt=/usr --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-ftp --with-apxs2=/www/wdlinux/apache/bin/apxs --with-mysqli=/www/wdlinux/mysql/bin/mysql_config
然后
make;make install

编译完,重起下httpd就可以了,如
service httpd restart

完成
以上是对apache的,如果是nginx,方法一样,只是把apache相关的替换为nginx即可

也单独下载php-5.2.17.tar.gz文件进行编译
作者: hyxuzhimin    时间: 2012-1-16 14:08

本帖最后由 hyxuzhimin 于 2012-1-16 14:32 编辑

我需要装pdo_mysql.so 扩展是不是也重新编译这么装?
--with_pdo_mysql  ??
这是我lanmp.sh文件里找到的
325:    ./configure --prefix=$IN_DIR/php-5.2.17 --with-config-file-path=$IN_DIR/etc --with-mysql=$IN_DIR/mysql --with-iconv=/usr --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --with-mcrypt=/usr --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-ftp $NV
请问是在这里添加--with_pdo_mysql  来安装pdo_mysql.so 扩展吗?
作者: hyxuzhimin    时间: 2012-1-16 18:13

请问为什么我添加之后 configure,提示
configure: error: --with_pdo_mysql: invalid option; use --help to show usage
作者: admin    时间: 2012-1-16 20:59

参数错误,应该是--with-pdo-mysql
作者: share    时间: 2012-1-19 12:59

为什么编译完后phpinfo()函数不能用了呢?
作者: hyxuzhimin    时间: 2012-1-25 21:01

本帖最后由 hyxuzhimin 于 2012-1-25 21:03 编辑

回复 4# admin
很奇怪 只加--with-pdo-mysql然后configure会提示找不到mysql的header。有--with-mysql=/www/wdlinux/mysql-5.1.56 也不行。而mysql.h在这个路径里。
但是改成 --with-pdo-mysql=/www/wdlinux/mysql-5.1.56/bin/mysql_config    , configure就成功了。
作者: hyxuzhimin    时间: 2012-1-25 21:05

改成这样就成功了。
./configure --prefix=/www/wdlinux/php-5.2.17 --with-config-file-path=/www/wdlinux/etc  --with-mysql=/www/wdlinux/mysql-5.1.56  --with-pdo-mysql=/www/wdlinux/mysql-5.1.56/bin/mysql_config  --with-iconv=/usr --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --with-mcrypt=/usr --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-ftp
作者: hyxuzhimin    时间: 2012-1-25 21:52

很奇怪用上面的configure参数可以make make install,但phpinfo()里依然没有pdo-mysql,而且参数里也没--with-pdo-mysql=/www/wdlinux/mysql-5.1.56/bin/mysql_config
pdo.jpg
2012-1-25 21:52

configure.jpg
2012-1-25 21:52


图片附件: pdo.jpg (2012-1-25 21:52, 31.21 KB) / 下载次数 1469
http://www.wdlinux.cn/bbs/attachment.php?aid=228&k=8c2b01151862aadb8445c403e53a5fa6&t=1573619019&sid=OZDKYD



图片附件: configure.jpg (2012-1-25 21:52, 46.29 KB) / 下载次数 1462
http://www.wdlinux.cn/bbs/attachment.php?aid=229&k=bc98ee5024afac87835acf4447ab8034&t=1573619019&sid=OZDKYD


作者: hyxuzhimin    时间: 2012-1-26 01:08

请问单独编译pdo_mysql为啥也不行?
我是通过这个教程装的 http://www.cnblogs.com/DavidYan/articles/2149647.html
使用了lanmp压缩包里的PDO_MYSQL-1.0.2.tgz
tar xzf  PDO_MYSQL-1.0.2.tgz
cd  PDO_MYSQL-1.0.2
/www/wdlinux/php-5.2.17/bin/phpize
Configuring for:
PHP Api Version:         20041225
Zend Module Api No:      20060613
Zend Extension Api No:   220060519
./configure --with-php-config=/www/wdlinux/php-5.2.17/bin/php-config --with-pdo-mysql=/www/wdlinux/mysql
顺利安装,并修改了vi /www/wdlinux/etc/php.ini
extension=pdo_mysql.so
我find一下pdo_mysql.so已经放在php/extensions/debug-non-zts-20060613/pdo_mysql.so文件夹了
重启httpd
但是phpinfo里还是没有pdo_mysql,Drupal安装也没有找到mysql,只有sqlite.
请问这是怎么回事呢?
作者: hyxuzhimin    时间: 2012-1-26 01:12

./configure --prefix=/www/wdlinux/php-5.2.17 --with-config-file-path=/www/wdlinux/etc  --with-mysql=/www/wdlinux/mysql  --enable-pdo  --with-pdo-mysql=/www/wdlinux/mysql  --with-iconv=/usr --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --with-mcrypt=/usr --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-ftp 重新改了参数make install 成功还是不能在phpinfo里看到pdo_mysql,drupal7也找不到mysql,只有sqlite。求助大虾了。因为上面两种安装现在都顺利了,但是还是开启不了pdo_mysql
作者: admin    时间: 2012-1-26 11:38

重起一下apache
作者: hamen    时间: 2012-1-26 17:03

/tmp/lanmp/php-5.2.17/ext/standard/info.c:68: undefined reference to `ts_resource_ex'
ext/standard/.libs/info.o: In function `php_print_info':
/tmp/lanmp/php-5.2.17/ext/standard/info.c:743: undefined reference to `executor_globals_id'
/tmp/lanmp/php-5.2.17/ext/standard/info.c:746: undefined reference to `executor_globals_id'
/tmp/lanmp/php-5.2.17/ext/standard/info.c:749: undefined reference to `executor_globals_id'
/tmp/lanmp/php-5.2.17/ext/standard/info.c:752: undefined reference to `executor_globals_id'
/tmp/lanmp/php-5.2.17/ext/standard/info.c:676: undefined reference to `sapi_globals_id'
/tmp/lanmp/php-5.2.17/ext/standard/info.c:469: undefined reference to `sapi_globals_id'
/tmp/lanmp/php-5.2.17/ext/standard/info.c:655: undefined reference to `sapi_globals_id'
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1
增加mysql扩展的时候出现错误,麻烦看看。
作者: hamen    时间: 2012-1-26 18:40

假如你是用lanmp.tar.gz安装的
cd lanmp/php-5.2.17
可以通过phpinfo来查看原本php的编译参数,如下
./c ...
bluegua 发表于 2011-11-15 17:13



    按照这么做后,查看phpinfo文件信息,
Command './configure' '--prefix=/www/wdlinux/php-5.2.17' '--with-config-file-path=/www/wdlinux/etc' '--with-mysql=/www/wdlinux/mysql' '--with-iconv=/usr' '--with-freetype-dir' '--with-jpeg-dir' '--with-png-dir' '--with-zlib' '--with-libxml-dir=/usr' '--enable-xml' '--disable-rpath' '--enable-discard-path' '--enable-inline-optimization' '--with-curl' '--enable-mbregex' '--enable-mbstring' '--with-mcrypt=/usr' '--with-gd' '--enable-gd-native-ttf' '--with-openssl' '--with-mhash' '--enable-ftp' '--with-apxs2=/www/wdlinux/apache/bin/apxs'


Command './configure' '--prefix=/www/wdlinux/php-5.2.17' '--with-config-file-path=/www/wdlinux/etc' '--with-mysql=/www/wdlinux/mysql' '--with-iconv=/usr' '--with-freetype-dir' '--with-jpeg-dir' '--with-png-dir' '--with-zlib' '--with-libxml-dir=/usr' '--enable-xml' '--disable-rpath' '--enable-discard-path' '--enable-inline-optimization' '--with-curl' '--enable-mbregex' '--enable-mbstring' '--with-mcrypt=/usr' '--with-gd' '--enable-gd-native-ttf' '--with-openssl' '--with-mhash' '--enable-ftp' '--with-apxs2=/www/wdlinux/apache/bin/apxs'
./configure' '--prefix=/www/wdlinux/php-5.2.17' '--with-config-file-path=/www/wdlinux/etc' '--with-mysql=/www/wdlinux/mysql' '--with-iconv=/usr' '--with-freetype-dir' '--with-jpeg-dir' '--with-png-dir' '--with-zlib' '--with-libxml-dir=/usr' '--enable-xml' '--disable-rpath' '--enable-discard-path' '--enable-inline-optimization' '--with-curl' '--enable-mbregex' '--enable-mbstring' '--with-mcrypt=/usr' '--with-gd' '--enable-gd-native-ttf' '--with-openssl' '--with-mhash' '--enable-ftp' '--with-apxs2=/www/wdlinux/apache/bin/apxs'

还是这样,没看见加载mysqli
作者: admin    时间: 2012-1-26 20:40

没有mysqli的的参数
作者: hamen    时间: 2012-1-26 20:57

什么意思,我用configure 添加了啊,在哪里设置mysqli参数。
作者: hamen    时间: 2012-1-26 21:50

make出错:

ext/iconv/iconv.o: In function `_php_iconv_strlen':
/tmp/lanmp/php-5.2.17/ext/iconv/iconv.c:603: undefined reference to `libiconv_open'
/tmp/lanmp/php-5.2.17/ext/iconv/iconv.c:626: undefined reference to `libiconv'
/tmp/lanmp/php-5.2.17/ext/iconv/iconv.c:660: undefined reference to `libiconv_close'
ext/iconv/iconv.o: In function `php_iconv_string':
/tmp/lanmp/php-5.2.17/ext/iconv/iconv.c:441: undefined reference to `libiconv_open'
/tmp/lanmp/php-5.2.17/ext/iconv/iconv.c:453: undefined reference to `libiconv'
/tmp/lanmp/php-5.2.17/ext/iconv/iconv.c:467: undefined reference to `libiconv'
/tmp/lanmp/php-5.2.17/ext/iconv/iconv.c:478: undefined reference to `libiconv_close'
ext/iconv/iconv.o: In function `_php_iconv_strpos':
/tmp/lanmp/php-5.2.17/ext/iconv/iconv.c:851: undefined reference to `libiconv_open'
/tmp/lanmp/php-5.2.17/ext/iconv/iconv.c:879: undefined reference to `libiconv'
/tmp/lanmp/php-5.2.17/ext/iconv/iconv.c:993: undefined reference to `libiconv_close'
ext/iconv/iconv.o: In function `_php_iconv_appendl':
/tmp/lanmp/php-5.2.17/ext/iconv/iconv.c:348: undefined reference to `libiconv'
/tmp/lanmp/php-5.2.17/ext/iconv/iconv.c:385: undefined reference to `libiconv'
ext/iconv/iconv.o: In function `_php_iconv_substr':
/tmp/lanmp/php-5.2.17/ext/iconv/iconv.c:723: undefined reference to `libiconv_open'
/tmp/lanmp/php-5.2.17/ext/iconv/iconv.c:747: undefined reference to `libiconv'
/tmp/lanmp/php-5.2.17/ext/iconv/iconv.c:802: undefined reference to `libiconv_close'
/tmp/lanmp/php-5.2.17/ext/iconv/iconv.c:806: undefined reference to `libiconv_close'
/tmp/lanmp/php-5.2.17/ext/iconv/iconv.c:755: undefined reference to `libiconv_open'
ext/iconv/iconv.o: In function `_php_iconv_mime_decode':
/tmp/lanmp/php-5.2.17/ext/iconv/iconv.c:1354: undefined reference to `libiconv_open'
/tmp/lanmp/php-5.2.17/ext/iconv/iconv.c:1465: undefined reference to `libiconv_close'
/tmp/lanmp/php-5.2.17/ext/iconv/iconv.c:1468: undefined reference to `libiconv_open'
/tmp/lanmp/php-5.2.17/ext/iconv/iconv.c:1823: undefined reference to `libiconv_close'
/tmp/lanmp/php-5.2.17/ext/iconv/iconv.c:1826: undefined reference to `libiconv_close'
ext/iconv/iconv.o: In function `php_iconv_stream_filter_dtor':
/tmp/lanmp/php-5.2.17/ext/iconv/iconv.c:2465: undefined reference to `libiconv_close'
ext/iconv/iconv.o: In function `_php_iconv_mime_encode':
/tmp/lanmp/php-5.2.17/ext/iconv/iconv.c:1043: undefined reference to `libiconv_open'
/tmp/lanmp/php-5.2.17/ext/iconv/iconv.c:1057: undefined reference to `libiconv_open'
/tmp/lanmp/php-5.2.17/ext/iconv/iconv.c:1316: undefined reference to `libiconv_close'
/tmp/lanmp/php-5.2.17/ext/iconv/iconv.c:1319: undefined reference to `libiconv_close'
/tmp/lanmp/php-5.2.17/ext/iconv/iconv.c:1176: undefined reference to `libiconv'
/tmp/lanmp/php-5.2.17/ext/iconv/iconv.c:1128: undefined reference to `libiconv'
/tmp/lanmp/php-5.2.17/ext/iconv/iconv.c:1160: undefined reference to `libiconv'
/tmp/lanmp/php-5.2.17/ext/iconv/iconv.c:1319: undefined reference to `libiconv_close'
/tmp/lanmp/php-5.2.17/ext/iconv/iconv.c:1228: undefined reference to `libiconv'
/tmp/lanmp/php-5.2.17/ext/iconv/iconv.c:1259: undefined reference to `libiconv'
/tmp/lanmp/php-5.2.17/ext/iconv/iconv.c:1303: undefined reference to `libiconv'
ext/iconv/iconv.o: In function `php_iconv_stream_filter_append_bucket':
/tmp/lanmp/php-5.2.17/ext/iconv/iconv.c:2615: undefined reference to `libiconv'
/tmp/lanmp/php-5.2.17/ext/iconv/iconv.c:2537: undefined reference to `libiconv'
ext/iconv/iconv.o: In function `php_iconv_stream_filter_ctor':
/tmp/lanmp/php-5.2.17/ext/iconv/iconv.c:2491: undefined reference to `libiconv_open'
collect2: ld returned 1 exit status
make: *** [sapi/cgi/php-cgi] Error 1
作者: hyxuzhimin    时间: 2012-1-27 01:54

回复 11# admin
重启过apache,机器也重启过。pdo-mysql还是没安装成功。
作者: hyxuzhimin    时间: 2012-1-27 23:38

回复 11# admin
经自己编译的lamp(centos5.7+最新amp版本)测试可以加入pdo-mysql,并安装drupal成功。
但是cent5.6Base+lamnp的。死活不能加入pdo-mysql。请检查下。谢谢。
作者: admin    时间: 2012-1-28 09:32

都一样的,lanmp也是编译
留意下错误提示或检查下参数
作者: hyxuzhimin    时间: 2012-1-28 21:33

本帖最后由 hyxuzhimin 于 2012-1-28 21:39 编辑

回复 19# admin
./configure --prefix=/www/wdlinux/php-5.2.17 --with-config-file-path=/www/wdlinux/etc  --with-mysql=/www/wdlinux/mysql  --enable-pdo  --with-pdo-mysql=/www/wdlinux/mysql  --with-iconv=/usr --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --with-mcrypt=/usr --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-ftp
你好。我试过好多遍了,参数是上面的,编译过程中没提示错误,我在非wdlinux版的centos5.7下编译安装可以成。不知道是不是系统的原因。还是apahce和nginx一起的原因。搞不清啊。
作者: wpailili    时间: 2012-5-30 19:49

回复 20# hyxuzhimin


    要怎么编译啊   我是CentOS 6.0   
跪求解释啊




欢迎光临 WDlinux官方论坛 (http://www.wdlinux.cn/bbs/) Powered by Discuz! 7.2