先到http://pecl.php.net/找需要的版本,我用的是稳定的版本。要先看看说明,特别是要注意mysql的php的版本。
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
经过configure就可以make了
make
make install注意pdo_mysql的全路径,我的是:
/usr/local/php/lib/php/extensions/debug-non-zts-20060613/pdo_mysql.so
然后在/usr/local/lib/php.ini
加上一句:
extension=/usr/local/php/lib/php/extensions/debug-non-zts-20060613/pdo_mysql.so
重新启动apache即可看到已经加载pdo_mysql成功。
之二:
Linux
下安装
PHP pdo_mysql
支持
后勤的网站(彭同学做的)使用了
pdo
来操作数据库,服务器在配置是未编译
pdo
支持,遂给www服务器加上此功能的 支持。
一、
先是在原有
php5.2.9
的基础上添加对
pdo
的支持,整了整整一天,也重新编译的
php 5.2.9
,最终没有成功
1.安装 pdo/usr/local/php/bin/pecl install pdo2.安装 pdo_mysqlwget http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgztar xzvf PDO_MYSQL-1.0.2.tgzcd PDO_MYSQL-1.0.2/usr/local/php/bin/phpize./configure –with-php-config=/usr/local/php/bin/php-config –with-pdo-mysql=/usr/local/mysqlmakemake install3.修改 php.ini加入:extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/pdo.soextension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/pdo_mysql.so/usr/local/php/bin/php -vPHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib/php/modules//usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/pdo.so’ - /usr/lib/php/modules//usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/pdo.so: cannot open shared object file: No such file or directory in Unknown on line 0PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib/php/modules//usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/pdo_mysql.so’ - /usr/lib/php/modules//usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/pdo_mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0PHP Warning: Zend Optimizer does not support this version of PHP - please upgrade to the latest version of Zend Optimizer in Unknown on line 0PHP 5.2.9 (cli) (built: Nov 30 2009 15:00:32)Copyright (c) 1997-2009 The PHP GroupZend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologieswith Zend Extension Manager v1.0.10, Copyright (c) 2003-2006, by Zend Technologies