• php新手第一次安装mongo


      以下是我走位php新手第一次安装mongo模块的步骤:

      1.首先从在网上选取适当版本的mongoDB扩展包下载;

      2.解压扩展包,并且进入解压目录;

      tar -zxf mongo-1.4.1.tgz

      cd mongo-1.4.1

      3.在mongo-1.3.2目录下执行phpize,命令如下:(注:此工具是php添加扩展的工具,我的phpize位置为/www/php/bin/phpize)

      /usr/local/php/bin/phpize

      注:肯能会出如下错误:

      Configuring for:

      PHP Api Version: 20041225

      Zend Module Api No: 20060613

      Zend Extension Api No: 220060519

      Cannot find autoconf. Please check your autoconf installation and the

      $PHP_AUTOCONF environment variable. Then, rerun this script

      问题在于:未安装m4与autoconf

      继续执行: yum -y install m4 autoconf 会生成configure文件

      4.执行如下命令:

      ./configure --with-php-config=/usr/local/php/bin/php-config

      注:–with-php-config 参数需要指定的是php-config文件的位置,而不是php.ini文件的位置

      creating libtool

      appending configuration tag "CXX" to libtool

      configure: creating ./config.status

      config.status: creating config.h

      5.查看配置信息如果无误的话,编译并安装:

      make&&make install

      正确编译执行结果如下:

      Build complete.

      Don't forget to run 'make test'.

      Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20130712/

      6.编译安装完成后,在php.ini中添加一句:

      extension=mongo.so

      7.重启php-fpm或者web服务,查看phpinfo,如果有mongoDB,恭喜你,安装成功了。(来源:程序员)

  • 相关阅读:
    Linux命令全训练
    解决maven中静态资源只能放到properties中的问题
    Mybatis出现错误org.apache.ibatis.executor.ExecutorException: No constructor found in
    Fence Repair
    Saruman's Army
    Best Cow Line
    区间调度问题
    硬币问题
    迷宫最短路径
    Divide by Zero 2017 and Codeforces Round #399 (Div. 1 + Div. 2, combined) A. Oath of the Night's Watch
  • 原文地址:https://www.cnblogs.com/pengpeng1208/p/9081521.html
Copyright © 2020-2023  润新知