Da li netko ima iskustva s instalacijom i korištenjem memcachea?
naime, nama lokalno sve s njim radi, ali kad smo instalirali memcache na server masinu dogadjaju nam se problemi i nikako da skuzimo u cemu je problem.
Napisali smo malu skripticu da testiramo memcached koja izgleda ovako:
Code:
<?
require("lib/cache.class.php");
echo "<h2>memcache test</h2>";
$cache = new Cache;
$ok = $cache->connect("localhost", 11211);
echo "Connection to memcached: " . ($ok? "OK": "FAILED") . "<br>";
$cache->set("somefragment", "Ovo sam sprashinyao u cache", 10 );
$value = $cache->get("somefragment");
echo "Cached value: " . $value;
echo "<hr>";
echo "<pre>";
var_dump( $cache->get_server_stats() );
echo "</pre>";
?>
<?
require("lib/cache.class.php");
echo "<h2>memcache test</h2>";
$cache = new Cache;
$ok = $cache->connect("localhost", 11211);
echo "Connection to memcached: " . ($ok? "OK": "FAILED") . "<br>";
$cache->set("somefragment", "Ovo sam sprashinyao u cache", 10 );
$value = $cache->get("somefragment");
echo "Cached value: " . $value;
echo "<hr>";
echo "<pre>";
var_dump( $cache->get_server_stats() );
echo "</pre>";
?>
.. port 11211 je otvoren, skripta je na istom hostu kao i memcached, tako da localhost treba raditi.
E sad, kad to pokrenemo, server (tj. skripta) vrati ovo:
Citat:
memcache test
Warning: Memcache::connect() [memcache.connect]: Can't connect to localhost:11211, Connection refused (111) in /home/xyz/public_html/lib/cache.class.php on line 28
Connection to memcached: FAILED
Warning: Memcache::set() [memcache.set]: Failed to extract 'connection' variable from object in /home/xyz/public_html/lib/cache.class.php on line 39
Warning: Memcache::get() [memcache.get]: Failed to extract 'connection' variable from object in /home/xyz/public_html/lib/cache.class.php on line 34
Cached value:
Warning: Memcache::getextendedstats() [memcache.getextendedstats]: Failed to extract 'connection' variable from object in /home/xyz/public_html/lib/cache.class.php on line 53
NULL
Warning: Memcache::connect() [memcache.connect]: Can't connect to localhost:11211, Connection refused (111) in /home/xyz/public_html/lib/cache.class.php on line 28
Connection to memcached: FAILED
Warning: Memcache::set() [memcache.set]: Failed to extract 'connection' variable from object in /home/xyz/public_html/lib/cache.class.php on line 39
Warning: Memcache::get() [memcache.get]: Failed to extract 'connection' variable from object in /home/xyz/public_html/lib/cache.class.php on line 34
Cached value:
Warning: Memcache::getextendedstats() [memcache.getextendedstats]: Failed to extract 'connection' variable from object in /home/xyz/public_html/lib/cache.class.php on line 53
NULL
Anyone?
P.S. Instaliran je posljednji memcached s posljednjim PECLom...