Introducing several PHP site performance optimization methods_PHP Tutorial

WBOY
Release: 2016-07-15 13:34:48
Original
904 people have browsed it

If it can be used reasonably

1: object code cache

Every time a request occurs, it needs to be Recompile your object code. If you use caching, you avoid recompilation, which can make your scripts execute faster and improve PHP site performance.

The following packages are available:

A) Ioncube: http://www.ioncube.com/

B) Zend Encoder: http://www. zend.com/products/zend_safeguard

C) Turckl MMCache: http://freshmeat.net/projects/turck-mmcache/

2: Template system

The template system provides a different form of caching. Content caching. Templating systems are helpful when you have a lot of static data and many pages that don't need to be reloaded. The caching system also separates code and HTML, which not only improves the execution time of the code, but also makes future maintenance easier and improves PHP site performance.

A) Smarty Templates: http://smarty.PHP.net/

B) Pear Templates: http://pear.PHP.net/package/html_template_it/redirected

C) PHP savant: http://PHPsavant.com/yawiki/

3: Distributed object caching system

The most commonly used is memcached

This system puts the database data in a large memory pool, which makes your website run very fast and optimizes the performance of the PHP site.

4: Set some PHP variables

variables_order = 'GPC'

register_argc_argv = 'Off'

register_globals = 'Off '

always_populate_raw_post_data = 'Off'

magic_quotes_gpc = 'Off'

5: Output Compression

Almost all browsers All support the Gzip compression method. Gzip can reduce the output by 80%, at the cost of approximately 10% more CPU calculations. But what you gain is that not only the bandwidth occupied is reduced, but your page loading will become faster, optimizing the performance of your PHP site.

You can turn it on in PHP.ini

zlib.output_compression = On

zlib.output_compression_level = (level)(level may be a number between 1-9 , you can set different numbers to suit your site)

If you use apache, you can also activate the mod_gzip module, which is highly customizable.

6: Others

When you use a database, only get the data you need to use, and avoid using sentences like select * from mytable.

In addition, using indexes is also very helpful for optimizing PHP site performance.


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/445952.htmlTechArticleIf you can use it reasonably 1: object code cache Every time a request occurs, you need to re-write your object code Compile it again. If you use caching, you will avoid re-...
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