Installing MongoDB and memcache_php instances for PHP in Windows

Source: Internet
Author: User
Tags memcached mongodb win32

MANGODB Installation

1. Download MongoDB installation files, I installed the Windows 64-bit, download the address as follows:

Https://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2008plus-2.6.6-signed.msi

2. Create a new MongoDB folder in E-disk (casually put, such as E:\mongodb)

3. Unzip the downloaded installation files and move the extracted files to e-disk MongoDB

4. Establishment of MONGODB data storage directory E:\mongodb\data

5. Start MongoDB (simple start does not configure service)

Copy Code code as follows:
E:\mongodb\bin\mongod.exe--dbpath E:\mongodb\data

You can see the following information:

Indicates that the installation started successfully.

6. Enter http://localhost:27017/in the browser and the following message appears, indicating that MONGDB has been activated.

Copy Code code as follows:
It looks like your are trying to access MongoDB over HTTP on the native driver port.

7, download the corresponding MongoDB PHP plug-in (not too easy to find, if PHP is 5.4-5.5 version can be used this address: HTTP://PAN.BAIDU.COM/S/1SJJJSYH) and configured well.

8. Use in PHP:

Copy Code code as follows:

try {
$mongo = new MONGO (' localhost ');
catch (Mongoconnectionexception $e) {
Var_dump ($e);
}
$mongo _db = $mongo->selectdb (' logdatastorage ');

Note: The code above is a demo and cannot be used in a production environment.

Memcache Installation

1, 64-bit download

from:http://www.urielkatz.com/archive/detail/memcached-64-bit-windows/
Download: Http://www.urielkatz.com/projects/memcached-win64/memcached-win64.zip
Source: Http://www.urielkatz.com/projects/memcached-win64/memcached-src.rar

2, decompression just downloaded the compressed package, get two files: Memcached.exe (server-side main program), PthreadGC2.dll

3, run the command prompt with administrator rights, locate to decompression path, install memcached service, command:

Copy Code code as follows:
memcached.exe-d Install

4, execution start → admin tools → service open windows Service View tool, find memcached service (no proof found without success)

5, start memcached:

Copy Code code as follows:
Memcached.exe-m 1024-d Start

-D is started for daemon and cannot specify port default port 11211
-M is the specified memory size

6. Configure Windows Firewall and add inbound rules for memcached default port 11211 (This step is not required if both the server and client are on this machine)

7, test whether the normal communication, here with the help of Telnet:

Copy Code code as follows:
Telnet 127.0.0.1 11211

If you go to a blank Doc screen, it's OK. The first line of command input is invisible, so I usually first knock a carriage return, back to an error, it does not matter, this is to say that you entered an unrecognized command;

Next look at the status, type stats and then enter:

8, download the corresponding memcache PHP plug-in (if PHP is 5.5 version can be used this address: http://pan.baidu.com/s/1mgspf9e) and configured well.

9, in the PHP connection use:

Copy Code code as follows:

$memcache = new Memcache;
$memcache->connect (' 127.0.0.1 ', 11211);

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.