![]() |
Services | Software | Partners | Articles | Contact |
Installing PHP APC on GNU/Linux Ubuntu Gutsy Gibbon 7.10 (and Debian)Complex PHP applications, such as Drupal, can gain a lot of performance benefits from running a PHP op-code cache/accelerators. APC, Alternate PHP Cache, is now the most maintained free/open source op-code cache, and is being used more and more as it emerges to be the most stable. The instructions here detail how to get APC running on an Ubuntu server running Gutsy Gibbon 7.10. First, we need the pecl command so we can download and install APC from the repositories. Do to so, we execute the following command: aptitude install php-pear But, this will not run on its own, we need the following package for the phpize command: aptitude install php5-dev We also need the apxs command, which is installed via the following package: aptitude install apache2-dev Now we have all the software we need, so we install apc via the pecl command: pecl install apc Once that finishes, we need to enable apc in Apache's configuration. the following command should do this for us. echo "extension=apc.so" > /etc/php5/apache2/conf.d/apc.ini Then we restart Apache: /etc/init.d/apache2 restart And we are all done. Watch for less execution time per page, and decreased memory usage per Apache process compared to what you had before. |




APC and ZendOptimizer
Few months ago I have installed Zend Optimizer in my Drupal site.
To improve performance I have installed APC and my site is crashing.
Is there a problem with Zend Optimizer and APC? How can I uninstall APC?
Most of my users are unregistered. Would I use Zend or APC?
Removing APC
Did you install APC using pecl? If so then issue this from the command line:
pecl uninstall APCOtherwise, just prevent APC from getting loaded. Find in your php.ini the place that has apc.so, and add a semicolon (;) before that line. That will have the same effect.
apt-get
I had problems getting this to work on PHP 5.2.12-0.dotdeb.1 This link explains the .dotdeb version does not override the default php-config to php-config5 necessary for phpize.
I tried this:
Running
pecl install apc --with-php-config=/usr/bin/php-config5But it gave me this error:
Attempting to discover channel "--with-php-config=/usr/bin"...Attempting fallback to https instead of http on channel "--with-php-config=/usr/bin"...
unknown channel "--with-php-config=/usr/bin" in "--with-php-config=/usr/bin/php-config5"
invalid package name/package file "--with-php-config=/usr/bin/php-config5"
:(
Finally I just ran this:
apt-get install php-apcEverything seems fine!
Depends on version and repository
I always advocate using the long term support (LTS) server version (8.04 at present), and only the official repositories. This makes things easier and more contained. For 8.04 LTS, there is no pre-built APC package in the official repositories.
Ubuntu 9.10 has a php-apc package, but it is not a long term support version, and hence not suitable for live servers.
this worked :) and on the
this worked :) and on the latest version of ubuntu...
Thanks!
Hi, thank you for the
Hi, thank you for the tutorial. I was unable to complete the pecl command and encountered this error message:
however, this was resolved with
Thank you. This is on an installation of Debian 5.
On Ubuntu, I also had to
On Ubuntu, I also had to install apache2-threaded-dev:
sudo apt-get install apache2-threaded-dev
Before running:
sudo pecl install apc
and then:
gksudo gedit /etc/php5/apache2/conf.d/apc.ini
...paste in the file:
extension=apc.so
and save it.