php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #58731 memcache.php doesn't support unix socket
Submitted: 2009-06-18 19:09 UTC Modified: 2011-03-10 21:40 UTC
From: s dot loeuillet at gmail dot com Assigned:
Status: Closed Package: memcache (PECL)
PHP Version: 5.2.6 OS: Linux Debian Lenny
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: s dot loeuillet at gmail dot com
New email:
PHP Version: OS:

 

 [2009-06-18 19:09 UTC] s dot loeuillet at gmail dot com
Description:
------------
"Attached" is a patch against 1.1.2.3 (latest version from 3.04) that
makes it support TCP sockets as well as Unix domain sockets.

Find it there :
http://new.leroutier.net/memcache.php_unixsocket_support.patch

A full version with this change + an additional merge from APC page :
http://new.leroutier.net/memcache.php-sl



Reproduce code:
---------------
http://new.leroutier.net/memcache.php_unixsocket_support.patch

http://new.leroutier.net/memcache.php-sl


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-06-14 13:21 UTC] hradtke@php.net
The provided links do not work.  Please update the links or paste the patch directly into the comments.
 [2010-06-15 02:05 UTC] s dot loeuillet at gmail dot com
I'll try to find it in the next days somewhere on my harddrives.
 [2010-06-15 06:21 UTC] s dot loeuillet at gmail dot com
Index: memcache.php
===================================================================
--- memcache.php	(r?vision 300461)
+++ memcache.php	(copie de travail)
@@ -48,12 +48,24 @@
 
 ///////////MEMCACHE FUNCTIONS /////////////////////////////////////////////////////////////////////
 
+function get_host_port_from_server($server){
+	$values = explode( ':', $server );
+	if ( ($values[0] == 'unix' ) && ( !is_numeric( $values[1] ) ) )
+	{
+		return Array( $server, 0 );
+	}
+	else
+	{
+		return values;
+	}
+}
+
 function sendMemcacheCommands($command){
     global $MEMCACHE_SERVERS;
 	$result = array();
 
 	foreach($MEMCACHE_SERVERS as $server){
-		$strs = explode(':',$server);
+		$strs = get_host_port_from_server($server);
 		$host = $strs[0];
 		$port = $strs[1];
 		$result[$server] = sendMemcacheCommand($host,$port,$command);
@@ -110,7 +122,7 @@
 }
 
 function dumpCacheSlab($server,$slabId,$limit){
-    list($host,$port) = explode(':',$server);
+    list($host,$port) = get_host_port_from_server($server);
     $resp = sendMemcacheCommand($host,$port,'stats cachedump '.$slabId.' '.$limit);
 
    return $resp;
@@ -118,7 +130,7 @@
 }
 
 function flushServer($server){
-    list($host,$port) = explode(':',$server);
+    list($host,$port) = get_host_port_from_server($server);
     $resp = sendMemcacheCommand($host,$port,'flush_all');
     return $resp;
 }
@@ -842,7 +854,7 @@
         $theKey = htmlentities(base64_decode($_GET['key']));
 
         $theserver = $MEMCACHE_SERVERS[(int)$_GET['server']];
-        list($h,$p) = explode(':',$theserver);
+        list($h,$p) = get_host_port_from_server($theserver);
         $r = sendMemcacheCommand($h,$p,'get '.$theKey);
         echo <<<EOB
         <div class="info"><table cellspacing=0><tbody>
@@ -865,7 +877,7 @@
         }
         $theKey = htmlentities(base64_decode($_GET['key']));
 		$theserver = $MEMCACHE_SERVERS[(int)$_GET['server']];
-		list($h,$p) = explode(':',$theserver);
+		list($h,$p) = get_host_port_from_server($theserver);
         $r = sendMemcacheCommand($h,$p,'delete '.$theKey);
         echo 'Deleting '.$theKey.':'.$r;
 	break;
 [2011-03-10 21:40 UTC] hradtke@php.net
This bug has been fixed in SVN.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.


 [2011-12-13 20:05 UTC] signatichev at yandex dot ru
function get_host_port_from_server($server){
	$values = explode( ':', $server );
	if ( ($values[0] == 'unix' ) && ( !is_numeric( $values[1] ) ) )
	{
		return Array( $server, 0 );
	}
	else
	{
!		return values;
	}
}

This code contents an error. 
"return values;" => "return $values;"
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 13 23:01:33 2024 UTC