php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #57070 doc not updated
Submitted: 2006-06-08 08:07 UTC Modified: 2006-06-09 09:02 UTC
From: vincent dot dupont at ausy dot be Assigned:
Status: Closed Package: memcache (PECL)
PHP Version: 4.3.11 OS: winXP
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: vincent dot dupont at ausy dot be
New email:
PHP Version: OS:

 

 [2006-06-08 08:07 UTC] vincent dot dupont at ausy dot be
Description:
------------
hi,

I'm testing memcached module and PECL extension. 
I downloaded the PHP4.3.11 win32 php_memcache.dll.
I also downloaded the sources if this dll, where a script file example.php is provided.
This example works on my system with :
$memcache = memcache_connect('localhost', 11211) or die ("Could not connect");

however, the PHP documentation states :
$memcache = new Memcache;
$memcache->connect('localhost', 11211) or die ("Could not connect");

this last script does not work. So it seems the PHP documentation of this memcache implementation is not up-to-date.

Do you know where I can find an up-to-date doc?

thank you
Vincent




Reproduce code:
---------------
<?php
//this code comes from the php_extensions sources.
//this  works
$memcache = memcache_connect('localhost', 11211);

if ($memcache) {
    echo("connected<br>");
	$memcache->set("str_key", "String to store in memcached");
	$memcache->set("num_key", 123);

	$object = new StdClass;
	$object->attribute = 'test';
	$memcache->set("obj_key", $object);

	$array = Array('assoc'=>123, 345, 567);
	$memcache->set("arr_key", $array);

	var_dump($memcache->get('str_key'));
	echo("<br>");
	var_dump($memcache->get('num_key'));
	echo("<br>");
	var_dump($memcache->get('obj_key'));
}
else {
	echo "Connection to memcached failed";
}
?>


Actual result:
--------------
PHP error because the $memcache->connect() is no more implemented

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-06-08 12:54 UTC] mikael at synd dot info
$memcache = new Memcache;
($result = $memcache->connect('localhost', 11211)) or die ("Could not connect");
var_dump($result);

Works fine for me and outputs "bool(true)" as expected, if you don't have a memcached listening on localhost:11211 then you get "Can't connect to localhost:11211 .." also as expected. Using memcache 2.0.4 on Linux 2.6

Are you sure the extension was loaded correctly, you can test this using "var_dump(extension_loaded('php_memcache.dll'));" which should output "bool(true)"

If the problem persists could you attach the exact error message produced as well as the script you are using.

//Mikael
 [2006-06-09 09:02 UTC] vincent dot dupont at ausy dot be
Well, This works now.
I'm terribly sorry about this bad request. Maybe the module was not loaded properly until I restarted the computer this morning?...

Thank you for your support anyway.
Vincent
 [2006-12-31 02:17 UTC] jae at xaton dot com
Hi, I have exactly the same issue reported below, but when I test with: var_dump(extension_loaded('php_memcache.dll')); I get "bool(false)", so the extension is not loaded correctly. The question, why not? The memcache output from phpinfo lead me to believe all was well... 

Here's a summary of my set up: XP SP2, PHP 4.4.4, Apache 2.0.52, php_memcache.dll 4_4. phpinfo output has:

Active persistent connections  0  
Revision  $Revision: 1.70 $  
memcache.allow_failover 1 1 
memcache.chunk_size 8192 8192 
memcache.default_port 11211 11211 
memcache.max_failover_attempts 20 20 

Any ideas how I can proceed? I'd be very grateful for your help.

Thanks in advance!
 [2006-12-31 02:24 UTC] jae at xaton dot com
I'm still having trouble, but now realize that:

print_r(get_loaded_extensions());
lists 'memcache' as one of the loaded module, and therefore

var_dump(extension_loaded('memcache'));
returns 'bol(true)'.... 

Any ideas?
 [2007-01-01 07:34 UTC] jae at xaton dot com
I finally found the answer.

For linux users the PHP documentation seems clear. But for win32 users, the documentation fails to mention that, in addition to downloading php_memcache.dll and configuring php.ini, you must also install and start the win32 memcache service. Full instructions and binaries are available at http://jehiah.cz/projects/memcached-win32. I just followed the steps as provided and it worked without any problems.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 19:01:28 2024 UTC