HOWTO: Install PECL APC Cache with XAMPP on Linux

Posted Mar 13, 2008 // 4 comments
Irakli:

XAMPP is a packaged, self-contained distribution of Apache, Mysql, PHP and tons of hard-to-install PHP extensions. Not only does it make sysadmin's life easier, by solving 99.9% of LAMP problems out-of-the-box, but it also allows PHP-vendors to create packaged distributions of complex systems. Even with a long list of packaged extensions that XAMPP ships with, it still does not contain everything. One crucial missing PECL plug-in is the Alternative PHP Cache (APC). APC is a rock-solid op-cache for PHP script pre-compilation and caching. It is used in massive deployments like Yahoo!. XAMPP comes packaged with eAccelerator, another popular PHP op-cache. Both eAccelerator and APC used to suffer from the infamous Segmentation Fault bug that freezes Apache randomly. Due to this bug, one could only use the benefits of the op-caches in redundant deployments. Fortunately, the bug was fixed in the latest release of APC, making APC even more appealing than before. Following is a 5-minute run-through of APC installation on XAMPP/Linux:

  1. Make sure you uninstall or disable all and any PHP installations you may have had before. Same goes for legacy PECL and PEAR installations.
  2. Download and install the latest XAMPP distribution.
  3. (Optionally) Add /opt/lampp/bin to your PATH
  4. Download and install XAMPP Development Package.
    Caution: this step will overwrite any configuration changes you might had made to XAMPP, previously.
  5. Download APC version 3.0.16 or later.
  6. $ sudo su - (or change to root in any other way you can)
  7. # cd APC-3.0.16
  8. # /opt/lampp/bin/phpize
  9. # ./configure
  10. # make (ignore the request to run "make test")
  11. # make install
  12. Edit /opt/lampp/etc/php.ini and add the following lines: extension="apc.so" apc.enabled="1" apc.shm_size="30"
  13. Restart Apache by issuing: /opt/lampp/lampp restart
  14. Make sure APC got installed by issuing: "/opt/lampp/bin/php -m" and looking at the list of installed PHP extensions.
* * *
About Irakli

As our Director of Product Development, Irakli revels in developing packaged, turn-key solutions using open-source technologies and cutting-edge, semantic APIs. He brings vast expertise in the areas of: product design, development, ...

more >

Read Irakli's Blog

Comments

by leon (not verified) on Thu, 12/25/2008 - 04:17

thanks

very helpful article. when I try in debian, the configure will not find php-config so I must run this way: ./configure --with-php-config=/opt/lampp/bin/php-config

by Anonymous (not verified) on Fri, 05/01/2009 - 10:40

Hi, could you give more

Hi, could you give more details about steps 7 and 8? I dont understand...

Thanks!

by guo (not verified) on Tue, 08/03/2010 - 04:13

Unable to load dynamic library '/opt/lampp/lib/php/extensions...

hi, after run /opt/lampp/lampp restart i got following info: Unable to load dynamic library '/opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/apc.so'

by paulhomebus (not verified) on Tue, 09/14/2010 - 15:30

Problems installing APC...

I had a problem,

php.ini didn’t recognize this as a line… #992 extension=”apc.so” apc.enabled=”1″ apc.shm_size=”30″ PHP: syntax error, unexpected ‘=’ in /opt/lampp/etc/php.ini on line 992

so I seperated it.. #992 extension=”apc.so” #993 apc.enabled=”1″ #994 apc.shm_size=”30″

Now I have…. Warning: PHP Startup: apc.shm_size now uses M/G suffixes, please update your ini file

Only a warning, much better than apc.so not loading.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
  • Allowed HTML tags: <a> <strong> <code> <p> <img> <ul> <ol> <li> <h2> <h3> <h4> <b> <u> <i>
  • You may insert videos with [video:URL]

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.