1, into the PHP source package installation path Pdo_mysql directory inside
/usr/local/src/php/package/php-5.6.29/ext/pdo_mysql
2. Run phpize, generate a configure file in this directory
/usr/local/php/bin/phpize
3. Run config to specify MySQL and PHP directory locations
./configure--prefix=/data/php--with-pdo-mysql=/data/mysql/bin/mysql_config--with-php-config=/data/php/bin/ Php-config--with-zlib-dir=/root/php-5.6.25/ext/zlib
4, compile and install, generate mysql.so
Make && make install
5, modify the php.ini file, add mysql.so extension configuration, save exit
Vim/data/php/etc/php.ini
Extension=pdo_mysql.so
6. Restart PHP-FPM
Service PHP-FPM Restart
7. Test, add php files to the web directory, such as/data/nginx/html/mysql.php
<?php$con = mysql_connect(‘localhost‘,‘root‘,‘‘);if($con){ die(‘ok‘);}else{ die(‘Could not connect: ‘ . mysql_error());}
Access URLs, such as: http://ip/mysql.php
Show OK, the configuration is successful
PHP Compiler Installation Mysql.so extensions