Linux system PHP installation configuration MongoDB 3.0.x database connection extension

Source: Internet
Author: User
Tags fpm install php mongodb php mongodb phpinfo

Description

Operating system: CentOS 6.X 64-bit

MongoDB Database server:

IP Address: 192.168.21.130

Web server:

IP Address: 192.168.21.127

PHP Installation path:/usr/local/php

To achieve the purpose:

Install PHP MongoDB database extensions, connect MongoDB database via PHP program

Specific actions:

First, the installation of PHP MongoDB database extensions (on the Web server 192.168.21.127 operation)

Download Address: http://pecl.php.net/get/mongo-1.6.11.tgz

Upload mongo-1.6.11.tgz to/usr/local/src directory

Tar zxvf mongo-1.6.11.tgz #解压

CD mongo-1.6.11

/usr/local/php/bin/phpize

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

Make #编译

Make install #安装, the following interface appears after completion

System Yun-wei www.osyunwei.com warm reminder: qihang01 original Content © Copyright, reproduced please indicate the source and the original chain

/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/

Vi/usr/local/php/etc/php.ini #编辑, add the following code on the last line

extension= "Mongo.so"

: wq! #保存退出

Service PHP-FPM Reload #重新加载php-fpm

Add a PHP test page under the site root directory

vi/usr/local/nginx/html/phpinfo.php #编辑

<?php

Phpinfo ();

?>

: wq! #保存退出

Open the page above, http://192.168.21.127/phpinfo.php

As shown in the following illustration:

Second, create test database (operate on MongoDB database server)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.