Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have RHEL6.1 with php. I've installed libmemcached-1.0.2 from src.rpm and compiled php-memcached 2.0.0b2. If I try to setSaslAuthData('user','pass') and write something to memcached (Couchbase server) I always end up with return code 5 (WRITE FAILURE). Commenting setSaslAuthData out turns to work with default bucket. But I need to get it working with SASL. Any ideas on what's wrong with my setup?

P.S. of course binary protocol is ON

share|improve this question
    
Why someone can think this question is so bad to down-vote it? What is wrong with my question? In't it clear enough? –  Dmytro Leonenko Dec 6 '11 at 17:34
add comment

migrated from stackoverflow.com Dec 1 '11 at 15:27

This question came from our site for professional and enthusiast programmers.

2 Answers

Are you sure memcached is compiled with sasl?

$ memcached -S

You should see this output if memcached wasn't compiled with SASL: "This server is not built with SASL support."

share|improve this answer
    
It's not memcached in clear form. As I said it's CouchBase Server (v2.0 DP). It uses memcachable protocol. PHP native realization works just fine –  Dmytro Leonenko Dec 7 '11 at 8:55
add comment

When you setup a bucket you can provide a password. Then use SASL to connect to Couchbase Server by using the name of the bucket as username and the password you provided earlier.

Extended, 2011-12-11

I've been reading the source of the memcached extension. Generally, it seems like they are not too many things you can do wrong on the PHP side.

Additional questions:

  • Can you make sure no other errors are exposed in the PHP error_log? E.g. "Failed to initialize SASL library." or something like that?
  • Did you set memcached.use_sasl = 1 in your php.ini?
  • Did you check Couchbase Server's log for errors when you try to set a key?

I'm not an expert on Couchbase Server though I know my way around CouchDB. In case you have to debug it, I'd try to figure out how to crank up the log level to something like DEBUG and then see if you can gather any useful information.

I think unless it's one of the first two things then this error is not on the PHP side but maybe in the Couchbase Server release. It looks like the write error is something libmemcached exposes so this means that it's coming from Couchbase Server directly.

share|improve this answer
    
How does it answer to my question? I was doing exactly what you've said with result I described –  Dmytro Leonenko Dec 9 '11 at 12:55
    
You did not share how got the information which you used to connect to Couchbase. You said you used a username and password and I didn't know where you got that from. Pretty harsh to downvote this and it doesn't make me want to help you further. –  Till Dec 9 '11 at 18:52
    
As I wrote in comment to ckliborn's answer many days ago SASL works with native PHP implementation. And of course I know that backet name is username than. –  Dmytro Leonenko Dec 11 '11 at 17:45
    
1. No any errors on PHP side. Exact error description for error code 5 I got by modifying source code of extension to write error desc. to log file, because error code 5 could mean other things also. 2. "memcached.use_sasl = 1". No, haven't set it. I'll try and update original post. 3. Couchbase log is almost empty on authentication. So no, no any errors. I think the problem may be on php-memcached side as I can connect successfully with native PHP implementation. –  Dmytro Leonenko Dec 12 '11 at 9:56
    
But maybe problem is really on couchbase server side as their implementation of extension to communicate with couchbase server disables sasl part for some reason. Their extension is based on the same php-memcached extension which again relay on libmemcached –  Dmytro Leonenko Dec 12 '11 at 10:35
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.