×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Memcache Not working

Memcache Not working

Memcache Not working

(OP)
I have memcache installed on my RHEL machine. The following script works perfectly when I execute the php script at the command prompt. However, when I try to execute this script from a browser, it returns 'Could not connect'.

I have:
- changed localhost to 127.0.0.1
- checked the port 11211 and it is open
- ps -eaf | grep memcached returns
00:00:00 memcached -d -p 11211 -u memcached -m 255 -c 1024 -/var/run/memcached/memcached.pid
which means any IP is allowed on port 11211.

What am I missing?

$memcache = new Memcache;
$memcache->connect('localhost', 11211) or die ('Could not connect');

$version = $memcache->getVersion();
echo 'Server’s version: '.$version;

$tmp_object = new stdClass;
$tmp_object->str_attr = 'test';
$tmp_object->int_attr = 123;

$numb = array("numb" => 45, "Love" => "Life");

$memcache->set('GOLD', 44, false, 5000) or die ('Failed to save data at the server');

$_SESSION['client_id'] = 45;
echo 'Store data in the cache (data will expire in 10 seconds)';

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close