一、php5编译参数如下:
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-config-file-path=/usr/local/php/etc --with-iconv-dir=/usr/ --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr/local/libxml2 --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-sockets --with-xmlrpc --enable-zip --enable-soap --enable-exif --enable-calendar --enable-magic-quotes --enable-wddx --enable-dba --with-qdbm && make && make install
二、用phpize来加载pdo_mysql,
wget http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz
tar xzvf PDO_MYSQL-1.0.2.tgz
cd PDO_MYSQL-1.0.2
/usr/local/php/bin/phpize
Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519
./configure –with-php-config=/usr/local/php/bin/php-config
make
make install
三、编辑/usr/local/etc/php.ini文件,添加一句extension=pdo.so,重启apache后生效。
四、验证php,输入php – m命令,里面有pdo_mysq.so
http://pecl.php.net/package/PDO_MYSQL 去这里下载PDO_MYSQL-1.0.2.tgz 包,然后本地编译安装,然后到php.ini中加载此模块。ok