So looking into using memcache in my web application I am reading up about memcache and memcached. Just looking to clarify some things. First when they say install memcached that means install memcache right? Just the d is for the daemon correct? There isnt something different to install for memcached vs memcache correct?
Then the second is the php library, memcache vs memcached. Which I understand Im just a bit confused with the installation part when someone says install memcache then I read other posts that says install memcached. This is the url I was planning to use to install memcache, of course with the latest versions:
http://mrphp.com.au/code/install-memcache-cpanel-running-centos
You need to:
install memcached library into your OS
install the php-client to work with memcache. It could be Memcache or Memcached.
if you'll choose Memcached, you will need to install necessary libevent version
Memcache client is more stable, but Memcached has some interesting features.
Look at differences in functionality (just few functions) and if you really need these new features - take Memcached, otherwise - Memcache.
Related
I already know that it is possible to install memcache (not memcached, that is another program!) for PHP on windows to be used with xampp.
I am wondering if there are any solutions for a working memcached (mind the d at the end :))?
I have put several hours into this already, I have found out that you can install it with ease on linux.
And that HHVM has this preinstalled, you just need some dependencies such as libmemcached and so on.
But I develop on windows using xampp, so I would like to be able to use the memcached class from php on windows, too. I don't think swapping the database and using redis is an option for me because it is slow.
Even thoough phpredis is a fast C extension, but it is incompatible with HHVM.
There are countless tutorials on the web marketing how to install "memcache" on windows, but they are all just for the php memcache class (no d), not memcached.
The dll file you need to copy to D:\xampp\php\ext only exists for memcache and not memcached.
Can I develop with HHVM and memcached on windows using the php memcached class instead of the memcache one?
I followed the instruction in this tutorial on how to install nginx, php, and mysql including the php5-memcache.
I'm wondering if I still need to install the memcache or memcached without the "php5" prefix .
As of now my WordPress site is complaining the ff:
The following memcached servers are not responding or not running:
Page Cache: 127.0.0.1:11211.
Database Cache: 127.0.0.1:11211.
Object Cache: 127.0.0.1:11211.
This message will automatically disappear once the issue is resolved.
If it is needed to be installed, will it not conflict with php5-memcache? Or something like an overkill usage of the two version?
And what is the best version to use? Memcache or Memcached? php5-memcache or php5-memcached.
I heard that memcached with "d" is just a service or daemon. But somebody is trying to compare the two as what I have seen here.
The names of these extensions are confusing.
Actually, both php5-memcache and php5-memcached are PHP extensions for working with the memcached service (Memcached server). They both give your PHP processes, the ability to be clients to the memcached service, i.e. to connect to memcached over the network, and to speak the memcached protocol, in order to use the memcached API.
The php5-memcached extension is more stable and has more features in my opinion, so I would suggest, that it should be tried first. Most of its operations are faster too (php source for the benchmark that produced these results).
You still do need the actual memcached service started somewhere, and its address, in order to connect to it. The memcached service may be started on the same host, or on another host/hosts, if you want a distributed cache.
memcache and memcached are 2 different servers, each has some features and stuff, you can read the differences as there's so many previous questions about that check google search
The ones starting with php are the extentions used to access the service, just like to use mysql you need php5-mysql, and to use curl you need php5-curl.
So you have php5-memcache for memcache, and php5-memcached for memcached, you can read about what each provide from those links: memcached lib and memcahe lib
EDIT: Just want to correct the wrong info I wrote above, both php5-memcache and php5-memcached connect to the memcached server, they are just different extensions for the same server, I guess just like php5-mysql vs php5-mysqli
You can still use both together, there's no conflict, but i believe you only need one not both, because most features are available with both, some provide little more features, another candidate service is redis, you should read into that too, it has some features not available in the memcached servers.
In php, there are 2 modules that can be used when programming with memcached.
Memcache and Memcached
In the document, it said that php5-memcached using libmemcached to connect memcached. And there are more function available in php5-memcached module.
Which one should I choose?
Take a look at this discussion. It's an extensive one on whether memcache or memcached is better. One reply suggests that memcached is better as there are methods to access error codes. Hope it helps.
memcached is better, but memcache is works too
I was thinking to use opcode caching for performance profit
what is the easiest way for opcode caching with PHP/Apache ?
and what are the performance improvements ?
I have read about xDebug but I was wondering if there are more options ?
I use the APC extension as an opcode cache on both my personnal server, and on the servers we are using at work -- and I've almost never run into any kind of trouble with it.
Installation is pretty easy : depending on your Linux distribution, you might want to use something like :
sudo aptitude install php5-apc
But you'd not necessarily have the last stable version... And I generally prefer using :
sudo pecl install apc
Which will fetch the last version from PECL and compile it (Note : you'll probably need to installed a package called php5-dev).
You'll then have to configure it ; see Runtime Configuration for the directives you can configure.
The performance improvements can vary depending on your server/application, but, on a server that only serves PHP pages (i.e. if your DB is on another machine) you might see a drop in CPU load that's quite important (I've seen CPU load go from 80% to 40-50% on a server, once)
Xdebug is not related to opcode caching nor performance : as its name indicates, it's useful for debugging.
And Xdebug should not be installed on a production server : it can be a pain, when it comes to performances -- I suppose it's because it "hooks" into PHP and add lots of stuff, like logging many informations useful for debugging ; which means more calculations to do -- which takes time and CPU.
Try APC : been using it with Mediawiki and the results are significant.
Other popular options are eAccelerator and APC.
Performance improvements will depend on the web app you're caching. Here are some benchmarks for the Drupal CMS using APC and eAccelerator, and here's the same site's tutorial on installing APC (nice and easy).
On Debian/Ubuntu, try:
sudo aptitude install php5-xcache
A commercial solution is from Zend, http://www.zend.com
What is the simplest way to install memcached on CentOS for someone new to the world of Linux? What is the best way to enable it for Apache and PHP
Unless Apache and PHP have some option to utilize memcached for internal workings (of which I am unaware of), you typically don't "enable" it for such apps. Instead, you would get a client library to use memcached from within your application, then start up memcached on whatever servers you want to provide memory with, then just use the client library API to store and retrieve cached data across multiple servers.
The easiest way is to find a reilable source of the RPM's needed to install memcached and memcached for PHP. There is a blog post which addresses this concern:
http://blog.gahooa.com/2009/02/08/update-on-fedora-vs-redhat-enterprise-linux/
We have been using EPEL (Extra Packages for Enterprise Linux) for exactly that on RedHat Enterprise 5.3. I believe it is a stated goal of EPEL to support Centos.
http://fedoraproject.org/wiki/EPEL
Essentially, it is a YUM repository which contains lots of extra packages from Fedora that were compiled for RHEL. Super easy to use.