First, we run apt-get to get what we need, if it is already not there.
I am using Apache2 and PHP5 on the development server. Adjust the versions above if necessary to match your environment.
Since I am using Apache2, the apxs is named differently, and pecl will fail if I do not work around this. So, I had to provide an apxs which is just a symbolic link.
Next we use pecl to download, compile and install APC.
The same Ubuntu version on my Pentium III test server does not have this error at all. It has the same Apache and PHP versions as well.
Others have encountered this problem, and the workaround as provided in this page, is to adjust the memory inside the script (it does not work in the php.ini).
Now you can run the above pecl command once more.
Now you have a code cache that should speed up Drupal, and you can benefit.
APC is not the only op-code cache / accelerator.
You can read more in PHP op-code caches / accelerators Drupal big site study.
There is also a benchmark of APC and eAccelerator using Drupal.
Matthew Carroll provided the outline for the procedure above.
Darrel O'Pry on Debian and APC provides an alternative method.
Benchmarks of various web servers with Drupal by Dries. APC makes a huge difference.
List of PHP op code caches.
I've been considering installing a cache but was worried that it would be a difficult install and that I'd end up losing a day being a sysadmin instead of actually programming. So I've waited. But you lay it out so nice and easy, I think I'm now brave enough to give it a go.
You are welcome. Ask for help if you need to. You have my email.
I have done it on two machines, with no ill effects so far, but they are development/testing.
I will be doing the same to the production server once I upgrade it to Dapper though.
What a small world it is! I was just looking around to see if anyone had run into problems using APC with Drupal (Gallery 2 doesn't play nice).
Anyway, I'm glad the time I spent fumbling around with APC has been of use to a few people.
I'm about to install APC on a dedicated server running Debian (though using Lighttpd instead of Apache), so it's good to see that it looks like a straightforward procedure these days.
BTW, any particular reason to still use apt-get instead of its newer and better successor, aptitude?
Regarding apt-get vs. aptitude, it is just a matter of preference. They both do the same thing, but from a different interface. I am an old UNIX hand (almost 20 years now), so the command line is my preferred interface, not GUIs or TUIs (Text User interface).
As for lighttpd, I ran it on my test server for a while, and it basically works. Memory footprint is less than Apache, but there are a few rough edges (no mechanism for per directory/per user .htaccess equivalent). I reverted back to Apache. I plan to write the details of how to configure lighty for Drupal, since that part may be useful for others.
So far, apt-get does what I need. I never had an inconsistency that needed aptitude.
For package removed, I use --purge.
I am sure that aptitude has more features and such, but all I am saying is that I have not needed any of them so far.
Good tute, and yes, aptitude did help!
I just ran through this how-to, it's certainly easier than last time I did it.
Whatta ya know? It DID!
Downgrade? Oh, it's from the previous core version. I guess there may be a reason for that. No idea what pq5 is anyway.
So I crossed my fingers and let it run. And all is now sweet in Hardy-Heron.
Old version. Newer version instructions.
The above is for an older version.
It is best if you go for Hardy (8.04.1) which is an LTS version.
Details on how to install APC are in our article: Installing a dedicated server or a VPS with Ubuntu Server 8.04 LTS Hardy Heron Drupal 6.x.