Home Backend Development PHP Tutorial Installation of memcache and mongodb in php environment on windows

Installation of memcache and mongodb in php environment on windows

Aug 08, 2016 am 09:32 AM
http memcache memcached mongodb windows

mangodb installation

1. Download the installation file of mongodb. I installed windows 64-bit. The download address is as follows:

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

2. Create a new mongodb folder in drive E (put it anywhere, such as E:mongodb)

3. Unzip the downloaded installation file and move the unzipped file to mongodb on drive E

4. Create the mongodb data storage directory E:mongodbdata

5. Start mongodb (simple startup without configuring the service)

E:\mongodb\bin\mongod.exe --dbpath  E:\mongodb\data
Copy after login

You can see the following information:

Indicates that the installation started successfully.

6. Enter http://localhost:27017/ in the browser, the following message will appear, indicating that mongdb has been started

It looks like you are trying to access MongoDB over HTTP on the native driver port.
Copy after login

7. Download the corresponding mongodb php plug-in (it’s not easy to find, if php is version 5.4-5.5, you can use this address: http://pan.baidu.com/s/1sjJjsYh) and configure it.

8. Use in php:

<span>try</span><span> {
    </span><span>$mongo</span> = <span>new</span> Mongo('localhost'<span>);
} </span><span>catch</span>(MongoConnectionException <span>$e</span><span>) {
    </span><span>var_dump</span>(<span>$e</span><span>);
}
</span><span>$mongo_db</span> = <span>$mongo</span>->selectDB('logdatastorage');
Copy after login

Note: The above code 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 code: http://www.urielkatz.com/projects/memcached-win64/memcached-src.rar

2. Unzip the compressed package you just downloaded and get two files: memcached.exe (server main program), pthreadGC2.dll

3. Run the command prompt with administrator rights, locate the decompression path, and install the Memcached service. Command:

memcached.exe -d install
Copy after login

4. Execute Start→Management Tools→Services, open the Windows service viewing tool, and find the memcached service (not found indicates that the installation was not successful)

5. Start Memcached:

memcached.exe -m <span>1024</span> -d start
Copy after login

-d starts the daemon process, and the port cannot be specified. The default port is 11211.
-m specifies the memory size

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

7. Test whether normal communication is possible. Use Telnet here:

telnet <span>127.0</span>.<span>0.1</span> <span>11211</span>
Copy after login

If you enter a blank doc screen, it is probably OK. The first line of command input is invisible, so I usually hit Enter first and an Error will be returned. It doesn’t matter. This means that the command you entered is an unrecognizable command;

Then check the status, type stats and press Enter:

8. Download the corresponding memcache php plug-in (if php is version 5.5, you can use this address: http://pan.baidu.com/s/1mgspf9e) and configure it.

9. Connect and use in php:

<span>$memcache</span> = <span>new</span><span> Memcache;
</span><span>$memcache</span>->connect('127.0.0.1', 11211);
Copy after login

Reference documentation

1. Mongodb installation configuration, startup and shutdown

2. Memcached installation and configuration example under Windows

The above introduces the installation of memcache and mongodb in the PHP environment on Windows, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1666
14
PHP Tutorial
1273
29
C# Tutorial
1253
24
Use Composer to solve the dilemma of recommendation systems: andres-montanez/recommendations-bundle Use Composer to solve the dilemma of recommendation systems: andres-montanez/recommendations-bundle Apr 18, 2025 am 11:48 AM

When developing an e-commerce website, I encountered a difficult problem: how to provide users with personalized product recommendations. Initially, I tried some simple recommendation algorithms, but the results were not ideal, and user satisfaction was also affected. In order to improve the accuracy and efficiency of the recommendation system, I decided to adopt a more professional solution. Finally, I installed andres-montanez/recommendations-bundle through Composer, which not only solved my problem, but also greatly improved the performance of the recommendation system. You can learn composer through the following address:

Can vs code run in Windows 8 Can vs code run in Windows 8 Apr 15, 2025 pm 07:24 PM

VS Code can run on Windows 8, but the experience may not be great. First make sure the system has been updated to the latest patch, then download the VS Code installation package that matches the system architecture and install it as prompted. After installation, be aware that some extensions may be incompatible with Windows 8 and need to look for alternative extensions or use newer Windows systems in a virtual machine. Install the necessary extensions to check whether they work properly. Although VS Code is feasible on Windows 8, it is recommended to upgrade to a newer Windows system for a better development experience and security.

How to run sublime after writing the code How to run sublime after writing the code Apr 16, 2025 am 08:51 AM

There are six ways to run code in Sublime: through hotkeys, menus, build systems, command lines, set default build systems, and custom build commands, and run individual files/projects by right-clicking on projects/files. The build system availability depends on the installation of Sublime Text.

laravel installation code laravel installation code Apr 18, 2025 pm 12:30 PM

To install Laravel, follow these steps in sequence: Install Composer (for macOS/Linux and Windows) Install Laravel Installer Create a new project Start Service Access Application (URL: http://127.0.0.1:8000) Set up the database connection (if required)

How to solve complex BelongsToThrough relationship problem in Laravel? Use Composer! How to solve complex BelongsToThrough relationship problem in Laravel? Use Composer! Apr 17, 2025 pm 09:54 PM

In Laravel development, dealing with complex model relationships has always been a challenge, especially when it comes to multi-level BelongsToThrough relationships. Recently, I encountered this problem in a project dealing with a multi-level model relationship, where traditional HasManyThrough relationships fail to meet the needs, resulting in data queries becoming complex and inefficient. After some exploration, I found the library staudenmeir/belongs-to-through, which easily installed and solved my troubles through Composer.

git software installation git software installation Apr 17, 2025 am 11:57 AM

Installing Git software includes the following steps: Download the installation package and run the installation package to verify the installation configuration Git installation Git Bash (Windows only)

vscode cannot install extension vscode cannot install extension Apr 15, 2025 pm 07:18 PM

The reasons for the installation of VS Code extensions may be: network instability, insufficient permissions, system compatibility issues, VS Code version is too old, antivirus software or firewall interference. By checking network connections, permissions, log files, updating VS Code, disabling security software, and restarting VS Code or computers, you can gradually troubleshoot and resolve issues.

MongoDB vs. Oracle: Choosing the Right Database for Your Needs MongoDB vs. Oracle: Choosing the Right Database for Your Needs Apr 22, 2025 am 12:10 AM

MongoDB is suitable for unstructured data and high scalability requirements, while Oracle is suitable for scenarios that require strict data consistency. 1.MongoDB flexibly stores data in different structures, suitable for social media and the Internet of Things. 2. Oracle structured data model ensures data integrity and is suitable for financial transactions. 3.MongoDB scales horizontally through shards, and Oracle scales vertically through RAC. 4.MongoDB has low maintenance costs, while Oracle has high maintenance costs but is fully supported.

See all articles