Optimize PHP with APC

Source: Internet
Author: User
Tags apc

PHP may be the most popular website building language for Linux developers and a language available to programmers on other platforms. PHP is fully supported, fast and flexible.

However, PHP has a defect. Because PHP is a scripting language, it can be edited before executing any specific idle and mixed script. However, most modern systems can do this quickly, so it is always a good thing to get the best performance that stands out in the network.

Alternative PHP Cache (APC) is an open-source high-speed buffer storage tool for PHP, which can hide edited scripts. Therefore, if the subsequent command has changed, PHP can only re-edit the script.

However, this can only result in obtaining the optimum performance on some scripts, and it makes more sense for more complex scripts. Unlike some of its competitors, APC is an open source and widely used. You can download the source code from the APC website.

Free commercial versions are also available: Zend optimizers of Zend. (Zend is the company that compiles the engine PHP and edits the script.) However, the results of the independent report published by APC are more meaningful than those of Zend optimizers.

It is very convenient to install APC. Once you download the APC source code, you do not need to configure it to 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 in/usr, you must call up phpize from the bin/directory under your installation directory. for example, if you have installed php in/usr/local/PHP, You need to execute/usr/local/php/bin/phpize.

Next, use a text editing software 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 named info. php somewhere in your network tree, including:

<? Php phpinfo ();?>

Open this page in your browser. You will see a part of APC in the output. Now you can use APC to accelerate your PHP script.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.