Home >Backend Development >PHP Tutorial >Automatically added string interception function_PHP tutorial
One of the advantages of PHP is that it is very fast, which is sufficient for general website applications. However, if the site's traffic is high, bandwidth is narrow, or other factors cause performance bottlenecks on the server, you may have to think of other ways to further increase the speed of PHP. This article will introduce how to do this from several aspects, so as to make users browse more "cool".
Code Optimization
I don’t want to tell you again
how to write cleaner code. I think everyone knows this. When speed is needed, you may have already optimized the PHP source code. A lot of work has been done, but what is proposed here is that this tedious work can be completed by other tools. This is Zend Optimizer, a program available for free from Zend Technologies' website (http://www.zend.com/). Its principle is simple, by detecting the intermediate code generated by the Zend engine and optimizing it to obtain higher execution speed. I think optimizing code is a rather tedious task, and the optimized code may become difficult to understand, especially when you put down the PHP program for a while and suddenly the customer asks you to make some changes, you may not know what to do yourself. Got it ;-). Therefore, I recommend that you use Zend Optimizer to do this optimization work when the PHP source code is relatively complex. The advantage is that it will not make your code complicated and difficult to understand.
Installing Zend Optimizer is very simple. Just download the relevant precompiled libraries according to the platform you are using, add two lines to your php.ini, and restart your web server!
zend_optimizer.optimization_level=15zend_extension="/path/to/ZendOptimizer.so" zend_loader.enable=Off
You may be a little surprised, didn't it say two lines, why did it become three lines. However, the third line is optional. It seems that disabling this zend_loader will make the optimization faster, so you might as well add this line to your php.ini file. It should be noted that zend_loader can only be disabled when you are not using Zend Encoder Runtime. Zend Encoder Runtime will be mentioned below.
Want to go faster? Use cache