今天刚接手一个WEB服务器(Linux CentOS5.4) php5.3
发现其不支持mysqli,
于是用phpinfo()发现当初在编译的时候没有加入此项扩展
我如果不重新编译吗???要怎么才能使其支持mysqli啊。。感谢Configure Command './configure' '--prefix=/usr/local/php' '--with-mysql=/usr/local/mysql' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-config-file-path=/usr/local/php' '--with-imap-ssl' '--with-kerberos' '--with-imap' '--with-gd' '--with-zlib-dir' '--with-png-dir' '--with-jpeg-dir' '--with-freetype-dir' '--enable-gd-native-ttf' '--with-mcrypt' '--enable-exif' '--enable-mbstring' '--enable-magic-quotes' '--enable-sockets' '--with-curl'
发现其不支持mysqli,
于是用phpinfo()发现当初在编译的时候没有加入此项扩展
我如果不重新编译吗???要怎么才能使其支持mysqli啊。。感谢Configure Command './configure' '--prefix=/usr/local/php' '--with-mysql=/usr/local/mysql' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-config-file-path=/usr/local/php' '--with-imap-ssl' '--with-kerberos' '--with-imap' '--with-gd' '--with-zlib-dir' '--with-png-dir' '--with-jpeg-dir' '--with-freetype-dir' '--enable-gd-native-ttf' '--with-mcrypt' '--enable-exif' '--enable-mbstring' '--enable-magic-quotes' '--enable-sockets' '--with-curl'
如果支持 pdo 的话就改用 pdo,性能比 mysqli 好
也可以改用 mysql,也没太大的差别
http://liuxh.blogbus.com/logs/50211228.html
我只在 window 下工作
编译生成mysqli.so,在php.ini中加载上该库。
参照:
1 进入php源代码目录中的mbstring所在目录
cd /usr/local/src/php-5.2.4/ext/mbstring/
2 执行php安装后目录中的bin/phpize文件
/usr/local/php/bin/phpize
3 进入php源代码目录
cd /usr/local/src/php-5.2.4/
4 执行上述目录中的configure文件
./configure --prefix=/usr/local/src/php-5.2.4/ext/mbstring --with-php-config=/usr/local/php/bin/php-config
5 make; make install
将mbstring.so安装到/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/中
6 编辑php.ini,加入一行
extension=mbstring.so
7 重新启动httpd
service httpd restart
(如果是php-cgi模式的,请先杀掉所有的php-cgi进程,再重启httpd)
以前的时候装了php的mysql,也会自动装上mysqli。