This article was originally published on 2023-02-01 and migrated here from an old blog. Compiled by: Hermes
Tutorial: Installing memcache for PHP7 on Windows Xiaopi (phpstudy)
Step 1: Confirm PHP Version
First, set up the Xiaopi environment and check the PHP version of your website.
💡 Tip: You can view detailed PHP version information using the
phpinfo()function.
Step 2: Download the Corresponding DLL File
Download the memcache.dll extension file corresponding to your PHP version.
📥 Download Link: PHP-memcache-dll Download
Step 3: Configure php.ini
- Open the Xiaopi panel and locate the corresponding PHP version.
- Edit the
php.iniconfiguration file. - Add the following line to enable the extension:
extension=php_memcache.dll- Save and restart PHP.
Step 4: Install the memcached Service
- Download memcache-x64-1.4.4-14.zip.
- Extract it to a specified directory, such as
C:\memcached. - Run Command Prompt as an administrator and execute:
cd C:\memcached
memcached.exe -d install
memcached.exe -d startStep 5: Verify Installation
<?php
if (extension_loaded('memcache')) {
echo "✅ memcache extension installed successfully!";
}
$memcache = new Memcache;
if ($memcache->connect('localhost', 11211)) {
echo "
✅ Successfully connected to the memcached service!";
}
?>⚠️ Note: Testing shows that success is not guaranteed. It is recommended to use Redis instead.