Alternative PHP Cache

" />
x
Loading
 Loading
Hello, Guest | Login | Register

Optimizing PHP, Part Two

Learn how to install and configure the Alternative PHP Cache

The previous “Tech Support” column (http://www.linux-mag.com/content/view/2586/) showed you how to utilize memcached, a high-performance, distributed memory object caching system, to alleviate database load and speed up your PHP applications. In this months column, let’s move down a little in the stack and look at a way that to serve your existing PHP code faster.
PHP is an interpreted language, which means the Zend Engine must parse your PHP source code into byte code every time the script is run. While interpretation offers you flexibility and convenience as compared to a compiled language, the process of producing byte code again and again is wasteful and time-consuming.
Enter the Alternative PHP Cache (APC), a free, open, and robust framework for caching and optimizing PHP intermediate code. A major part of the APC framework is a cache that allows PHP to generate the opcode the first time a script is run and then use the cached copy on subsequent executions. APC, which is licensed under the same license as PHP, is available for download at http://pecl.php.net/package/APC.
You have two options when installing APC. The first is to install it directly from PECL. That’s as easy as running pecl install APC as root. However, this can be problematic in some situations, and you may prefer to perform the installation manually. To do that, unpack the APC tarball and run the following commands:
$ phpize
$ ./configure ––enable-apc \
––enable-apc-mmap \
––with-php-config=/usr/local/bin/php-config \
––with-apxs=/usr/local/apache2/bin/apxs
$…

Please log in to view this content.

Not Yet a Member?

Register with LinuxMagazine.com and get free access to the entire archive, including:

  • Hands-on Content
  • White Papers
  • Community Features
  • And more.
Already a Member?
Log in!
Username

Password

Remember me

Forgotten your password?
Forgotten your username?
Read More
  1. Helpful Tools for Software Developers
  2. The Github Hall of Fame
  3. Book'em, Github.
  4. This Week on Github: Stupid Ruby Tricks
  5. A Veritable Scatter Shot!
Follow Linux Magazine
Rackspace