您的位置:首页 > 编程语言 > PHP开发

php追加编译scws、mysqli和mongo、pgsql扩展模块

2012-09-20 10:34 471 查看
一、scws编译安装
wget http://www.ftphp.com/scws/down/scws-1.2.0.tar.bz2 tar jxf scws-1.2.0.tar.bz2 cd scws-1.2.0./configure --prefix=/opt/scws make && make installcd phpext//opt/php-5.3.8/bin/phpize ./configure --with-scws=/opt/scws --with-php-config=/opt/php-5.3.8/bin/php-config make && make installvim /opt/php-5.3.8/etc/php.ini extension = "scws.so"/etc/init.d/php-fpm restart

二、mongo编译安装

下载http://webscripts.softpedia.com/scriptDownload/MongoDB-PHP-Driver-Download-70187.html
tar zxf mongo-php-driver-1.3.7.tar.gz
cd mongo-php-driver-1.3.7
/opt/php/bin/phpize
./configure --with-php-config=/opt/php/bin/php-config
make && make install
vim /opt/php/etc/php.ini
extension = "mongo.so"/etc/init.d/php-fpm restart
测试mongo是否连通:
<?php

$m = new Mongo('mongodb://lxx:123@127.0.0.1:27017');

//mongodb://username:password@IP:port

$a = $m->connect();

if($a){

echo"success";

}

else{

echo"wrong";

}

?>

三、mysqli安装
进入php源码包php-5.3.8/ext/mysqli/
/opt/php/bin/phpize
./configure --prefix=/usr/local/mysqli --with-php-config=/opt/php/bin/php-config --with-mysqli=/usr/bin/mysql_config
make && make install
在php.ini中添加extension = "mysqli.so",重启php-fpm
但报错:PHP Warning: PHP Startup: Invalid library (maybe not a PHP library) 'mysqli.so' in Unknown on line 0
原来我服务器上的php是5.2.4版本,而我用高版本的5.3.4的php源码去追加编译,导致不兼容。重新下载5.2.4的php重复上面安装过程即可。
四、pgsql
1、进入php编译目录下的 ext/pgsql/ 下;
2、根据php安装位置 执行 /usr/local/php/bin/phpize;
yum install postgresql-devel

3、./configure --with-php-config=/usr/local/php/bin/php-config
4、make && make install
5、将编译完的扩展添加到 php.ini 最后 重启php-fpm
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  php mongo scws