Optimize PHP with APC

3rd Party Package Requesting

Postby El Machete » Wed Aug 11, 2004 1:01 pm

I read this article in a website named TechRepublic. My second favourite Tech site after the forums.
It talks about optimizing PHP with APC.

Has anybody use this?

Can somebody compile this for Freesco?

Thanks






Optimize PHP with APC

PHP is perhaps the most popular language for Web site development among Linux developers and arguably for developers on other platforms as well. PHP is well-supported, fast, and very flexible.

However, PHP does have one drawback. Because PHP is a scripting language, it therefore compiles any given script on the fly prior to executing it. But while most modern systems can do this quickly, obtaining the most performance one can squeeze out of Web services is always a good thing.

Alternative PHP Cache (APC) is an open source caching tool available for PHP, which caches compiled scripts. So on subsequent calls, PHP only has to recompile the script if it has changed.

While this can lead to only a modest performance gain on some scripts, it can lead to a fairly significant increase on more complex scripts. Unlike some of its competitors, APC is open source and freely available. You can download the source code from the APC Web site.

A free commercial offering is also available: Zend Optimizer from Zend. (Zend is the company that wrote the engine PHP uses to compile scripts.) However, independent reports have shown that APC's gains over Zend Optimizer's can be fairly significant.

Installing APC is a snap; there's nothing to configure to make it work "out of the box." Just download the APC source code; the latest version is 2.0.4. To install APC, execute the following:

# tar xvzf APC-2.0.3.tgz
# cd APC-2.0.3
# /usr/bin/phpize
# ./configure --enable-apc
# make
# make install

If your PHP installation isn't located in /usr, you must call phpize from the bin/ directory under your installation directory. For instance, if you've installed PHP in /usr/local/php, you would execute /usr/local/php/bin/phpize.

Next, use a text editor to edit the php.ini file (usually /etc/php.ini), and add the following to the bottom:

extension=apc.so

Save the file, and restart Apache. Then, create a file called info.php somewhere in your Web tree that contains the following:

<?php phpinfo(); ?>

Open this page in your browser. You should see a section for APC in the output. You can now take advantage of APC to speed up your PHP scripts.
El Machete Main Site<br><a href='http://elmachete.dyndns.org' target='_blank'>http://elmachete.dyndns.org</a><br><br><b><i>Information wants to be free. Use open source</b></i><br><br>Other sites by El Machete:<br><br><a href='http://laoficina.mine.nu/' target='_blank'>El Machete Group Office</a><br>
User avatar
El Machete
Senior Member
 
Posts: 78
Joined: Fri Aug 09, 2002 3:05 am
Location: Alberta Canada

Return to 3rd Party Package Requesting

Who is online

Users browsing this forum: No registered users and 7 guests

cron