【PHP】PHP安装扩展-mysqli.so

在 centos 下编译安装 php 时,有时候经常会忘了某些扩展,比如 pdo,mysqli,但是到扩展目录下,我们又找不到相应的 扩展文件,(.so 文件) ,这样的情况下只能 编译安装该模块,生成对应的 so 文件,然后在 php.ini 中添加相应的 扩展记录,重启 php

安装mongo拓展:

  1. $ tar zxvf mongodb-mongodb-php-driver-<commit_id>.tar.gz
  2. $ cd mongodb-mongodb-php-driver-<commit_id>
  3. $ /usr/local/php/bin/phpize
  4. $ ./configure --with-php-config=/usr/local/php/bin/php-config
  5. $ sudo make install


就可以了,我们以安装 mysqli 为例。

首先进入 php 源码包  如果 找不到可以可下载一个 地址在这里:http://us2.php.net/get/php-5.2.17.tar.gz/from/a/mirror


完成后,请编辑你php.ini文件增加一行
extension=mongo.so
一般默认的编译php的ini文件在
/usr/local/php/etc/php.ini
重启你的web服务器或者php-fpm,打印phpinfo,如果看到mongo项表,那么mongodb的扩展安装成功了


其他命令:

  1. 查看所有模块
  2. [root@baseservice01 etc]# /usr/local/php/bin/php -m | grep -i mongo   ---mongo已安装成功
    mongo

  3. 查看所有信息
  4. [root@baseservice01 etc]# /usr/local/php/bin/php -i
  5. [root@baseservice01 etc]# /usr/local/php/bin/php -i|grep -i conf
    Configure Command =>  './configure'  '--prefix=/usr/local/php' '--enable-fpm' '--with-fpm-user=www' '--with-fpm-group=www' '--with-mysql=mysqlnd' '--with-mysqli=mysqlnd' '--with-pdo-mysql=mysqlnd' '--with-iconv-dir' '--with-freetype-dir' '--with-jpeg-dir' '--with-png-dir' '--with-zlib' '--with-libxml-dir=/usr' '--enable-xml' '--disable-rpath' '--enable-magic-quotes' '--enable-safe-mode' '--enable-bcmath' '--enable-shmop' '--enable-sysvsem' '--enable-inline-optimization' '--with-curl' '--with-curlwrappers' '--enable-mbregex' '--enable-mbstring' '--with-mcrypt' '--enable-ftp' '--with-gd' '--enable-gd-native-ttf' '--with-openssl=/usr/local/openssl' '--with-mhash' '--enable-pcntl' '--enable-sockets' '--with-xmlrpc' '--enable-zip' '--enable-soap' '--without-pear' '--with-gettext' '--enable-fileinfo'
    Configuration File (php.ini) Path => /usr/local/php/lib  --配置文件路径
    Loaded Configuration File => /usr/local/php/lib/php.ini  --使用的配置文件
    Configuration
    Openssl default config => /usr/local/openssl/ssl/openssl.cnf

参考:
http://123haixing.blog.163.com/blog/static/481202052012613111625223/


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29096438/viewspace-1802491/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/29096438/viewspace-1802491/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值