Home > Backend Development > PHP Tutorial > linux下php安装pdo_mysql扩展

linux下php安装pdo_mysql扩展

WBOY
Release: 2016-06-23 14:29:08
Original
1201 people have browsed it

1.确定php环境已经配置好,找到php安装包的pdo_mysql扩展目录,假设你的安装包放在/lamp/php-5.2.6下。

[root@localhost /]# cd /lamp/php-5.2.6/ext/pdo_mysql
[root@localhost pdo_mysql]#
[root@localhost pdo_mysql]# pwd
/lamp/php-5.2.6/ext/pdo_mysql
[root@localhost pdo_mysql]#

2.假设你的php是安装在/usr/local/php里的。执行/usr/local/php/bin/phpize ,运行命令:

[root@localhost pdo_mysql]# /usr/local/php5/bin/phpize 

3.进行编译。./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql (假设你的mysql是安装在/usr/local/mysql)

[root@localhost pdo_mysql]# ./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql

4.编译安装。make,make install

[root@localhost pdo_mysql]# make && make install;

5.编译后,在/usr/local/php/lib/php/extensions里就会多了个no-debug-non-zts-20060613文件夹,它里面就生成了一个pdo_mysql.so,修改php.ini,加入扩展语句

extension="/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/";

extension=pdo_mysql.so

6.重启apache就ok了,在phpinfo信息里会看到,pdo_mysql的扩展支持了。

[root@localhost pdo_mysql]# /usr/local/apache2/bin/apachectl  restart

 

 

 

 

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template