1
votes

I`m trying here to work with memcache obj, but I have a little problem.

I do this:

$memcache = new Memcache;
$memcache->connect('localhost', 11211) or die ("Could not connect");
$value = "123"; // for example
$memcache->set('mykey', $value, false, 10) or die ("Failed to save data at the server");

$get_result = $memcache->get('mykey');
var_dump($get_result);

This code work perfectly when I executed the script from command line, but it`s not working when I tried to execute the script from web browser.

The browser gives me that error: "Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data."

Please help,

Best Regards

1
Why did you decide that problem is connected with memcache? - u_mulder
Other scripts are working ok? Error happens in other browsers? - u_mulder
Yep everything works perfectly. The same error gives every browser (FF,Chrome,etc). Im starting to think that apache cant access memcache or something like this , because from command line works great. - viktor
You have tagged memcached but are talking about memcache these are two different extensions. - Marcel Gwerder

1 Answers

0
votes

You might double check that your web executable's php.ini settings match the ones for PHP CLI. Usually these settings live in the corresponding module's ini file:

$ sudo find / -name memcached.ini
/etc/php5/mods-available/memcached.ini

These also can appear in the main ini file:

$ sudo find / -name php.ini
/etc/php5/fpm/php.ini
/etc/php5/apache2/php.ini
/etc/php5/cli/php.ini

My guess is that memcached is configured in cli/php.ini but not in fpm/php.ini or apache2/php.ini, so the browser request fails because it can't find memcached.