Linux下安装PHP 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 pdo
2.安装 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
./configure �Cwith-php-config=/usr/local/php/bin/php-config �Cwith-pdo-mysql=/usr/local/mysql
make
make install
3.修改 php.ini
加入:
extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/pdo.so
extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/pdo_mysql.so
/usr/local/php/bin/php -v
PHP 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 0
PHP 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 0
PHP Warning: Zend Optimizer does not support this version of PHP - please upgrade to the latest version of Zend Optimizer in Unknown on line 0
PHP 5.2.9 (cli) (built: Nov 30 2009 15:00:32)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
with Zend Extension Manager v1.0.10, Copyright (c) 2003-2006, by Zend Technologies
二、 下午下班回家决定升级 php 的版本,最后成功支持 pdo
1.下载 php 5.2.13
2.安装
tar zxvf php*****
cd php**
./configure �Cprefix=/usr/local/php �Cwith-apxs2=/usr/local/apache/bin/apxs �Cwith-mysql=/usr/local/mysql/ �Cwith-gd=/usr/local/gd/ �Cwith-zlib-dir �Cwith-png-dir �Cwith-freetype-dir �Cwith-jpeg-dir �Cenable-mbstring=all �Cwith-curl �Cenable-pdo=shared \
�Cwith-pdo-mysql=shared \
�Cwith-sqlite=shared \
�Cwith-pdo-sqlite=shared \
cp php.ini-dist /usr/local/php/lib/php.ini
3.修改 php.ini
修改:
extension_dir = “/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613″
加入:
extension=pdo.so
extension=pdo_mysql.so
4.查看 http://*****/phpinfo.ini 看到对 pdo 的支持,ok!
有价值的资料:
http://www.directadmin.com/forum/showthread.php?t=24448
http://www.spiration.co.uk/post/1332/install%20PDO_MYSQL%20-%20mysql_config%20and%20header%20files%20problem

你可能感兴趣的:(linux,mysql,PHP,数据库,pdo)