PHP optimized configuration -- accelerate your VBB, phpwind, Discuz, IPB, MolyX

Source: Internet
Author: User
PHP optimized configuration -- accelerate your VBB, phpwind, Discuz, IPB, and MolyX to make the forum faster. PHP accelerated configuration: Zend Optimizer optimized the PHP program.

Zend Optimizer V2.5.7 For Windows
Software Language: English
Running environment: Win9x/NT/2000/XP

Zend Optimizer V2.5.7 For Windows:

Zend Optimizer uses code optimization methods to speed up the execution of PHP 4.0 applications. The principle of implementation is to optimize the code generated by the Run-Time Compiler before it is finally executed. Generally, the execution of a PHP program using Zend Optimizer is 40% to 100% faster than that without Zend Optimizer. This means that the visitor of the website can browse the webpage faster, so as to complete more transactions and create better customer satisfaction. Faster response also means saving hardware investment and enhancing the services provided by the website. Therefore, using Zend Optimizer improves the profitability of e-commerce. Zend Optimizer can bring many benefits to PHP users, especially those who operate websites. Quick running of the PHP program can significantly reduce the server's CPU load and reduce the response time by half, that is, the time between the visitor clicking the link to the server and reading the page.

Install Zend Optimizer to optimize the PHP program

Zend Optimizer is a free PHP optimization software developed by Zend technology, the creator of the PHP core engine "Zend" http://www.zend.com. According to Zend, using this software can improve performance by at least 30% in some cases! Now let's take a look at how to configure this software.

Zend Optimizer is easy to install

1. run the installation file, first prompt you to select the installation directory, select a directory you like, and click "Next ".
2. the installation wizard requires you to select the current WEB server (Apache, IIS, or other), select the server, and click "Next"
3. the installation wizard prompts you to confirm php. ini location (C: \ WINDOWS \ by default) click "Next" and the prompt "back up php. ini to C: \ WINDOWS \ php. ini-Optimizer-bak. when the software is uninstalled, it can be restored to the original php. ini) click "Next ".
4. the installation wizard prompts "you need to restart the IIS service to continue the installation.) click" yes "and the installation program starts to restart the IIS service, then, the installer prompts "IIS service restarted successfully", click "OK", and then click "finish" to complete the installation.
5. after the installation is complete, the program will automatically modify php. ini based on your choice to help you start the engine. The following describes the configuration options of Zend Optimizer to help you customize reasonable configurations.

[Zend]
Zend_optimizer.optimization_level = 15 // In My configuration file, zend_optimizer.optimization_level = 1023
Zend_extension_ts = "C: \ Inetpub \ Zend \ lib \ ZendExtensionManager. dll" // This is related to your installation path
Zend_extension_manager.optimizer_ts = "C: \ Inetpub \ Zend \ lib \ Optimizer-2.5.5"

Now we will introduce the meanings of the above configuration files:
Zend_optimizer.optimization_level = degree of optimization. Here we define how many optimization processes are started.
Zend_optimizer.encoder_loader = whether to allow processing of PHP files encrypted by Zend Encoder.
Zend_extension_ts '= The directory where the optimizer is located.
Zend_extension_manager.optimizer_ts = The directory where the optimizer is managed.

Zend_optimizer.optimization_level

Take a closer look at the most important part here! Zend Opt has a total of 10 optimization processes. Theoretically speaking, the more Zend Opt, the better the performance. Of course, there is always a gap between theory and practice. The more the optimization process is enabled, the higher the performance consumption. The 10 optimization processes of Zend Opt are different, that is, the effect is not average. Zend defines the maximum value (High mode) as 15. Here 15 refers to enabling the optimization process from 1 to 4. Of course, many friends are not satisfied with this. after all, up to four optimization processes are enabled, even half of the total number. The numeric code (value) corresponding to each optimization process is as follows:

Do not use 0 <= if this is the case, it is better not to install, but also save some memory!
Optimization Process 1 (PASS1) 1
Optimization Process 2 (PASS2) 2
Optimization process 3 (PASS3) 4
Optimization Process 4 (PASS4) 8
Optimization process 5 (PASS5) 16
Optimization process 6 (PASS6) 32
Optimization process 7 (PASS7) 64
Optimized process 8 (PASS8) 128
Optimization process 9 (PASS9) 256
Optimization procedure 10 (PASS10) 512

The method in which the optimization process is enabled is controlled by the sum of the numeric code (value) and the parameter value used as the parameter value of this parameter. For example, in my configuration file, zend_optimizer.optimization_level = 1023. here, 1023 is the sum of all the numerical codes (values) in the optimization process 1 to the optimization process 10, indicating that all 10 optimization processes are enabled. The High mode value defined by Zend is 15, which indicates that the optimization process 1-4 is enabled at the same time.

The encryption code supports zend_optimizer.encoder_loader.

Most of the users who have not read the Zend Opt FAQ document do not know this parameter. This parameter is used to tell Zend Opt whether to support code encrypted by Zend Encoder. By default, Zend Opt supports encrypted code. If you do not use the encrypted code, we recommend that you disable this option. This function involves the process of unpackage and decomcode, which will increase the system load. My friend has developed the corresponding decompilation tool, which is expected to be released after the Spring Festival.

The value of this parameter is disabled only by two zeros, and 1 is enabled. The default value is 1, and the recommended value is 0.

The installation path of zend_extension_ts and zend_extension_manager.optimizer_ts on the hard disk of Zend Optimizer.

6. how do I know if Zend Optimizer is running?
The answer is very simple. you only need to use the PHP function phpinfo () for detection, as shown below:
Phpinfo ();
?>

The Zend Optimizer section in the displayed result is like the following: (different PHP versions may have different information. my name is PHP4.3.11)


[Copy to clipboard] [-] CODE:
This program makes use of the Zend Scripting Language Engine:
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies with Zend Extension Manager v1.0.6, Copyright (c) 2003-2004, by Zend Technologies with Zend Optimizer v2.5.7, Copyright (c) 1998-2004, by Zend Technologies

Indicates that Zend Optimizer for PHP has been optimized successfully.

PHP optimization configuration 2
Acceleration with eAccelerator (formerly Truck MMCache)
What is eAccelerator?
----------------------
EAccelerator is a free open source PHP accelerator, optimizer, encoder and
Dynamic content cache for PHP. It increases performance of PHP scripts
Caching them in compiled state, so that the overhead of compiling is almost
Completely eliminated. Also it uses some optimizations to speed up execution
Of PHP scripts. eAccelerator typically reduces server load and increases
Speed of your PHP code by 1-10 times.

EAccelerator is a fork of TurckMMCache
EAccelerator (formerly Truck MMCache)

I believe many of my friends know MMCache, but a long time ago, the developer was hired by Zend, so MMCache has never had an official new version... to support the latest PHP4.4.0 or PHP5.04, you need to compile the source code by yourself... don't be discouraged. we also have eAccelerator!

1. First, we download the compiled Module.
Https://www.php1.cn/
Select to download the eAccelerator corresponding to your system and PHP version

2. rename it as eaccelerator. dll (win version) or eaccelerator. so (for linux) is then moved to your php extentions folder, and its path is defined in the php. ini

3. Depending on your system, there are generally two installation methods: Zend extension and PHP extension.

Follow the Zend extension to open the php. ini file, find extension = php_zip.dll, and add
Win edition


[Copy to clipboard] [-] CODE:
Zend_extension_ts = "c: \ php \ extensions \ eaccelerator. dll" // The path depends on your system. the file extension is also
Eaccelerator. shm_size = "16" // based on your system memory, the default value is 16 MB, which can be changed to 64 MB.
Eaccelerator. cache_dir = "C: \ php \ tmp" // manually created. for example, C: \ php \ tmp in WIN, make sure that the permission is read/write, and do not change this directory in the future.
Eaccelerator. enable = "1"
Eaccelerator. optimizer = "1"
Eaccelerator. check_mtime = "1"
Eaccelerator. debug = "0"
Eaccelerator. filter = ""
Eaccelerator. shm_max = "0"
Eaccelerator. shm_ttl = "0"
Eaccelerator. shm_prune_period = "0"
Eaccelerator. shm_only = "0"
Eaccelerator. compress = "1"
Eaccelerator. compress_level = "9"

Linux


[Copy to clipboard] [-] CODE:
Zend_extension = "/usr/lib/php4/eaccelerator. so" // The path depends on your system. the file extension is also
Eaccelerator. shm_size = "16" // based on your system memory, the default value is 16 MB, which can be changed to 64 MB.
Eaccelerator. cache_dir = "/tmp/eaccelerator" // you need to manually create it to ensure that its permissions are read/write and do not change this directory in the future.
Eaccelerator. enable = "1"
Eaccelerator. optimizer = "1"
Eaccelerator. check_mtime = "1"
Eaccelerator. debug = "0"
Eaccelerator. filter = ""
Eaccelerator. shm_max = "0"
Eaccelerator. shm_ttl = "0"
Eaccelerator. shm_prune_period = "0"
Eaccelerator. shm_only = "0"
Eaccelerator. compress = "1"
Eaccelerator. compress_level = "9"

If security mode is enabled, you must use "zend_extension_ts" to replace "zend_extension ".

Appendix: create a cache directory in linux


[Copy to clipboard] [-] CODE:
Mkdir/tmp/eaccelerator
Chmod 0777/tmp/eaccelerator

PHP extension installation mode, open the php. ini file, find extension = php_zip.dll, and add


[Copy to clipboard] [-] CODE:
Extension = "eaccelerator. so" // The path depends on your system. the file extension is the same. in Win, the file extension is dll (for example, c: \ php \ extensions \ eaccelerator. dll)
Eaccelerator. shm_size = "16"
Eaccelerator. cache_dir = "/tmp/eaccelerator" // need to be created manually. in WIN, for example, C: \ php \ tmp, make sure that the permission is read/write, and do not change this directory in the future.
Eaccelerator. enable = "1"
Eaccelerator. optimizer = "1"
Eaccelerator. check_mtime = "1"
Eaccelerator. debug = "0"
Eaccelerator. filter = ""
Eaccelerator. shm_max = "0"
Eaccelerator. shm_ttl = "0"
Eaccelerator. shm_prune_period = "0"
Eaccelerator. shm_only = "0"
Eaccelerator. compress = "1"
Eaccelerator. compress_level = "9"

The eAccelerator can be compatible with Zend, but the above code is in php. before ini must define code related to Zend, it is strongly recommended that you do not use Zend and eAccelerator at the same time unless you have to use Zend code, but they do not conflict with each other and can accelerate the process. why not?

After completing the above work, save your php. ini and restart apache or IIS to see if phpinfo is different? Then let's see if the execution time of the phpwind footer is much faster?
After correct installation, you can see the following information in the Zend section of phpinfo: (different PHP versions may have different information. my PHP version is PHP4.3.11. generally, with eAccelerator is successful)


[Copy to clipboard] [-] CODE:
This program makes use of the Zend Scripting Language Engine:
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies with eAccelerator v0.9.3, Copyright (c) 2004-2005 eAccelerator, by eAccelerator with Zend Extension Manager v1.0.6, Copyright (c) 2003-2004, by Zend Technologies with Zend Optimizer v2.5.7, Copyright (c) 1998-2004, by Zend Technologies

Very simple. You only need to back up php. ini before the operation. if the backup fails, the backup will be restored. Restart apache or IIS services.


After loading the eAccelerator on the forum, the execution time of the footer is shortened from 0.02X seconds to 0.01X seconds... more than twice faster. ^_^
Note:

1. if your system has installed the ZEND accelerator, the above configuration must be placed in front of ZEND in PHP. INI; otherwise, Apache cannot be started;
2. eAccelerator. shm_size = "64". here, 64 is the CACHE memory used by the acceleration system. The default value is 16 MB. it is adjusted according to your system memory;
3. eAccelerator. cache_dir = "C: \ php \ tmp", which is the directory where temporary files are generated during accelerator operation. create a folder in the corresponding directory to store cached files and Grant read and write permissions, if the default directory space is small during installation, we recommend that you adjust it.

Effect: The system now has ZEND and eAccelerator accelerators. PHP execution speed is faster than the original one. ZEND optimization has been enabled to the maximum. in the PHP System, BBS is the most obvious, and software download background program output HTML static page speed is very fast, and only some pause when ZEND.

If you encounter any problems during the installation process, please visit https://www.php1.cn/to help us solve them as much as possible!

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.