Home >Backend Development >PHP Tutorial >安装PHP的mysql扩展
wget http://blog.s135.com/soft/linux/nginx_php/pdo/PDO_MYSQL-1.0.2.tgz#wget http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgztar zxvf PDO_MYSQL-1.0.2.tgzcd PDO_MYSQL-1.0.2//usr/local/webserver/php/bin/phpize./configure --with-php-config=/usr/local/webserver/php/bin/php-config --with-pdo-mysql=/usr/local/webserver/mysqlmakemake installcd ../
修改php.ini,添加"extension = pdo_mysql.so"
<?php $pdo = new PDO( 'mysql:host=hostname;dbname=defaultDbName', 'username', 'password', array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8") ); ?>