Updated: December 28, 2010php
First off, all credits go to this guy. I’m just listing the steps on how I did it in Windows 7 with PHP 5.3. Also, I tested this using WampServer but I believe it should work on any PHP install.windows
c:\memcached
). There should be a memcached.exe
in there.Install memcached as a service. Go to the memcached directory, type and run:memcached
memcached -d install
If you get an error saying 「MSVCP71.dll is missing」, see this page for a solution.wordpress
Start the memcached service by running:ui
memcached -d start
You can verify if memcached is running by executing this in the command line:this
wmic process get description, executablepath | findstr memcached.exe
You should see a result list showing memcached.exe and its full path.spa
php_memcache.dll
in your PHP extensions yet.
php_memcache.dll
. Extract the archive to your php extensions directory. On my system (WampServer), this was C:\wamp\bin\php\php5.3.0\ext
.Edit php.ini
, add this line to enable the extension:.net
extension=php_memcache.dll
Or if you’re using WampServer, restart it and enable the extension through the WampServer system tray menu.rest
Test the installation using the sample PHP code here: http://www.php.net/manual/en/memcache.examples-overview.php.code
若是沒有文件查不到的能夠跟我要,呵呵
參考資料:http://pureform.wordpress.com/2008/01/10/installing-memcache-on-windows-for-php/
http://shikii.net/blog/installing-memcached-for-php-5-3-on-windows-7/
$memcache = new Memcache; $memcache->connect('localhost',11211); $version = $memcache->getversion(); echo "Server's version: ".$version; $tmp_object = new stdClass(); $tmp_object->str_attr = 'test'; $tmp_object->int_attr = 123; $memcache->set('key',$tmp_object,false,10) or die ('faild to save data at the server'); echo "Store data in the cache (data will expire in 10 seconds)<br />\n"; $get_result = $memcache->get('key'); echo "Data from the cache:<br />\n"; var_dump($get_result); print_r($get_result);