Optimizing PHP_PHP tutorial using APC

WBOY
Release: 2016-07-13 17:35:59
Original
989 people have browsed it

PHP is perhaps the most popular website building language among Linux developers, and is also a language available to programmers on other platforms. PHP is fully supported, fast and quite flexible.

However, PHP has a flaw. Because PHP is a scripting language, it can be edited before any specific idle script is executed. But with most modern systems being able to do so quickly these days, it's always a good thing to get the one with the best performance that stands out in the network.

Alternative PHP Cache (APC) is an open source cache tool for PHP that can hide edited scripts. So for later commands, PHP can only re-edit the script if it has changed.

But this will only result in modest performance gains on certain scripts, and may make more sense for more complex scripts. Unlike some of its competitors, APC is open source and widely available. You can download the source code from the APC website.

A free commercial version is also available: Zend Optimizer for Zend. (Zend is the company that writes the engine PHP, the editor script.) However, independent reports have published that APC's gains are more meaningful than those of Zend's optimizers.

Installing APC is very convenient; as long as you download the source code of APC, there is no need to configure anything else to make it work outside the box. The latest version is 2.0.4. Perform the following operations to install APC:

# 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 is not under /usr, you must call phpize from the bin/ directory under your installation directory. For example, if you have installed PHP under /usr/local/php, you must Need to 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 content to the end:

extension="/usr/local/php/lib/php/extensions/no-debug-non-zts-20050922/apc.so"

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

Open this page in your browser. You'll see part of the APC on the output. You can now use APC to speed up your PHP scripts.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/508270.htmlTechArticlePHP is perhaps the most popular website building language among Linux developers, but also among programmers on other platforms Available languages. PHP is fully supported, fast and quite flexible. However...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template