Php code optimization method-php Tutorial

Source: Internet
Author: User
Php code optimization method 1. use zend optimizer
Add methods in php. ini
Zend_optimization_level = 15
Zned_extendsion = "path/to/zendOptimizer. so"
Zend_loader.enable = off


Note that zend_loader can be switched off only when zend Enocder Runtime is not applicable.


The role of the last line: not executing zend_loader can slightly speed up Opimizer.


2. use cache (large program size)
Zend cache, Afterburner Cache, apc


3. webpage compressed content
Gzip compressed webpage


4. tips:
Replace I = I + 1 with I + = 1;
Use PHP internal functions whenever possible
Use single quotation mark strings whenever possible when single quotation marks can be used.
Foreach traverses the array instead of while

Database:
Improve database performance
Upgrade the server or create a load balancing environment
Do not underestimate the effect of content compression

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.