nginx mysqlnd驱动引擎提升mysql性能

时间:2022-08-05 08:02:04

nginx mysqlnd驱动引擎提升mysql性能

前期要安装 mysql mysqli pdo_mysql libiconv
1 先去PHP官网下个 php-5.6.29.tar.gz wget http://cn2.php.net/distributions/php-5.6.29.tar.gz
2 <pre>
./configure --prefix=/usr/local/php --with-iconv=/usr/local/libiconv --enable-sysvsem --with-curl --enable-mbregex --enable-mbstring --with-mcrypt --with-gd --with-openssl --with-mhash --enable-sockets --with-xmlrpc --with-zlib --enable-fpm --with-config-file-path=/usr/local/php/etc --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd
</pre>
如果报错
make: *** [ext/fileinfo/libmagic/apprentice.lo] Error 1
这是由于内存小于1G所导致.

在./configure加上选项:

<pre>
--disable-fileinfo
</pre>

Disable fileinfo support 禁用 fileinfo

接下来 make && make install

编译成功记得重启php-fpm
/usr/local/php/sbin/php-fpm -y /usr/local/php/etc/php-fpm.conf -c /usr/local/php/etc/php.ini

phpinfo()可以看到如下信息
mysql mysqli pdo_mysql
<pre>
Client API version mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a
</pre>

说明成功了