WAMP sunucu WINDOWS XP MEMCACHE yapmak nasıl

4 Cevap php

Iam WAMP sunucu ve sadece etkin php_memcache uzantısı çalışan ve kod denedim

<?php

$memcache = new Memcache;
$memcache->connect('localhost', 11211) or die ("Could not connect");

$version = $memcache->getVersion();
echo "Server's version: ".$version."<br/>\n";

$tmp_object = new stdClass;
$tmp_object->str_attr = 'test';
$tmp_object->int_attr = 123;

$memcache->set('key', $tmp_object, false, 10) or die ("Failed 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);

?>

ve ben şu hata var

Notice: Memcache::connect() [memcache.connect]: Server localhost (tcp 11211) failed with: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (10060) in C:\wamp\www\memcache\test1.php on line 4

Warning: Memcache::connect() [memcache.connect]: Can't connect to localhost:11211, A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (10060) in C:\wamp\www\memcache\test1.php on line 4
Could not connect

4 Cevap

PHP memcached sunucusuna bağlanmak çok şeyler PHP tarafında memcache uzatma, fonksiyonu sağlar.

Ama var:

  • yüklemek böyle bir server (or several or them, as memcached works as a cluster of servers)
  • başlatın
  • configure it : mainly, indicate
    • kullanmak ne kadar bellek,
    • Her port üzerinde bu bağlantıları dinler

Burada, are you sure that you installed a memcached server yerel makinenizde?

Eğer WAMP kullanıyor olsanız bile sizin php.ini dosyasına bu satırı eklemek gerekir. (: C: mine oldu \ wamp \ bin \ php \ php5.3.10 \ php.ini)

extension=php_memcache.dll

Eğer 64 bit WAMP çalıştırıyorsanız:

Yaygın servis ve uzantıları sizin için çalışmaz.

64 bit memcached hizmetini yükleyin:

http://s3.amazonaws.com/downloads.northscale.com/memcached-win64-1.4.4-14.zip

Ve bu php uzantıları (php sürümüyle eşleşen) bir:

Php 5.3: http://www.mediafire.com/download.php?o60feet9sw71six

Php 5.4: http://www.mediafire.com/download.php?8d3vd26z3fg6bf1

Aşağıdaki gibi bağlantı kodlarını değiştirmeyi deneyin

$memcache = new Memcache;
$memcache->connect('127.0.0.1', 11211) or die ("Could not connect");

Bu sadece takip Brill rehberdir

Installing Memcached for PHP 5.3 on Windows 7