This worked for me also. Though I'm wondering how I could have it work with SELinux enforcing.
I suspect that I don't have the iptable setup correctly (since I didn't add anythign for 11211) or that I configured things wrong. tcp 0 0 0.0.0.0:11211 0.0.0.0:* LISTEN tcp 0 0 :::11211 :::* LISTEN udp 0 0 0.0.0.0:11211 0.0.0.0:* udp 0 0 :::11211 :::* Thx for any direction on this. Cheers, Steve On Friday, August 24, 2012 4:47:08 AM UTC+10, Xun wrote: > > To Geoffrey, the extension is loaded, memcache.so is enabled, and the > process is running. > > Instead, the problem is on SELinux. Thanks to Rathish, here is the > solution (at least for me). > > My system is CentOS 6.3 > > Solution: > > #command to check if SELinux is on > > getenforce > > > > #Disable SELinux using the following command > > setenforce 0 > > Xun > > On Thu, Aug 23, 2012 at 11:17 AM, Geoffrey Hoffman > <[email protected]<javascript:> > > wrote: > >> if you do >> >> php -i | grep memcache >> >> is the extension loaded? You have the memcache.so enabled in php.ini? >> >> ps aux | grep memcache >> >> to check the process is running. >> >> >> >> On Thu, Aug 23, 2012 at 10:09 AM, Xun TANG <[email protected]<javascript:> >> > wrote: >> >>> Forgot to say, another weird thing is, I tried nmap 127.0.0.1, >>> but port 11211 isn't listed. >>> >>> >>> On Thu, Aug 23, 2012 at 9:57 AM, Xun <[email protected] >>> <javascript:>>wrote: >>> >>>> netstat -an | grep 11211 >>>> gives me >>>> tcp 0 0 127.0.0.1:11211 0.0.0.0:* >>>> LISTEN >>>> udp 0 0 127.0.0.1:11211 0.0.0.0:* >>>> >>>> I've also added the rule to iptables as shown below >>>> Chain INPUT (policy ACCEPT) >>>> target prot opt source destination >>>> ACCEPT tcp -- anywhere anywhere tcp >>>> dpt:memcache >>>> >>>> I am able to telnet and check version, stats of memcache via command >>>> telnet 127.0.0.1 11211 >>>> >>>> However, I am not able to reach memcached via the browser. >>>> i.e. this line "memcache->connect('localhost', 11211) " returns false. >>>> >>>> Where did I forgot to set? How come I am able to telnet to memcached, >>>> but not via the browser? >>>> >>>> Any insight welcome. I am stuck here for two days... >>>> >>>> BTW, I pecl installed memcache. I tried memcached but got a bunch of >>>> errors. "make failed". >>>> What exactly is the difference, and which is recommended? >>>> >>>> P.S. I was following this instruction >>>> >>>> http://www.webdeveloperjuice.com/2010/01/25/10-baby-steps-to-install-memcached-server-and-access-it-with-php/ >>>> >>>> >>>> Thanks, >>>> Xun >>>> >>>> On Monday, April 25, 2011 6:00:05 AM UTC-7, rspadim wrote: >>>>> >>>>> humm try to run memcache daemon, and >>>>> netstat -an | grep 11211 >>>>> >>>>> to check if port is open or not >>>>> >>>>> 2011/4/25 Dan Golob <[email protected]>: >>>>> > I have tried connecting both via localhost and 127.0.0.1 ... same >>>>> results. >>>>> > I connected to telnet from the same machine, using 'telnet >>>>> localhost:11211' >>>>> > ... not too familiar with telnet, to be honest, but I connected to >>>>> something >>>>> > and couldn't figure out how to get out. >>>>> > The php error logs only have those two that I mentioned ... just >>>>> can't >>>>> > connect: >>>>> > [24-Apr-2011 17:15:01] PHP Warning: Module 'memcache' already >>>>> loaded in >>>>> > Unknown on line 0 >>>>> > [24-Apr-2011 17:15:01] PHP Notice: Memcache::connect(): Server >>>>> localhost >>>>> > (tcp 11211) failed with: Connection refused (111) in >>>>> > /var/www/html/mizozo.com/**algorithm.php<http://mizozo.com/algorithm.php> >>>>> > on >>>>> line 131 >>>>> > I have been avoiding the firewall, because for one I know little >>>>> about it, >>>>> > but also because since I am connecting locally and didn't think that >>>>> the >>>>> > firewall would be a problem. Maybe this is the reason? >>>>> > Also, is there a way that I can be sure to remove everything so that >>>>> I can >>>>> > start from scratch? I probably installed one too many (or 3 too many) >>>>> > modules, some may be conflicting. For example, if I had installed >>>>> memcached >>>>> > and pecl's version, would they work in unison or break one another? >>>>> As I had >>>>> > mentioned before, at this point I have no idea what I installed ... >>>>> I have >>>>> > gone through so many different instruction sets that anything is >>>>> possible. I >>>>> > try to remove things, but often get caught up in the moment and >>>>> forget. >>>>> > Thanks for all your help, by the way >>>>> > >>>>> > On Sun, Apr 24, 2011 at 10:24 PM, Geoffrey Hoffman >>>>> > <[email protected]> wrote: >>>>> >> >>>>> >> Sorry, I see you provided error output. >>>>> >> Connection refused, eh? >>>>> >> Are you connecting to localhost or another server running memcached? >>>>> >> Try opening port 11211 with iptables (if CentOS - did you say what >>>>> distro >>>>> >> you are using?) >>>>> > >>>>> > >>>>> > -- >>>>> > My Mizozo Profile - >>>>> > http://shark.mizozo.com/ >>>>> > >>>>> >>>>> -- >>>>> Roberto Spadim >>>>> Spadim Technology / SPAEmpresarial >>>>> >>>>> >>> >> >
