Home > Backend Development > PHP Tutorial > Common acceleration methods of yii_PHP tutorial

Common acceleration methods of yii_PHP tutorial

WBOY
Release: 2016-07-20 11:14:10
Original
771 people have browsed it

1. Enable APC and cache the yiilite.php file

Regarding opening APC, although Yii itself can load the required files according to the needs, it still takes a lot of time to judge what should be loaded and what should not be loaded every time. Since it is commonly used, it is not as good as resident memory. Comes conveniently.

How to:

Modify the index.php file and change the referenced yii.php to yiilite.php (this file is included in YiiFramework).

Secondly, install the php_apc extension. My system is ubuntu, so it is more convenient. Just apt-get install php_apc. After the installation is completed, it will have a startup item file in /etc/php5/apache2/conf.d , restart apache directly to take effect (apachectl restart or service apache2 restart)

In addition, there is a pac.php file in the apc source code to check the running status of pac in the system. Of course, if you don’t check it, it will actually have no effect

2. Turn off debug option

Remember to turn off the debug of index.php.

3. Cache the regular loading of ActiveRecord.

When using ActiveRecord, it will load a lot of general information. When the table structure does not change, this information will not change. Therefore, the method for caching is to add an additional field schemaCachingDuration

in the configuration.

'db' => array(
'connectionString' => 'mysql:host=localhost;dbname=XXX',
'emulatePrepare' => true,
'schemaCachingDuration'= >'3600',
'username' => 'root',
'password' => 'root',
'charset' => 'utf8',
),

4. When operating large-scale databases, please use DAO. . . . .

That’s all for now.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/440318.htmlTechArticle1. Turn on APC and cache the yiilite.php file. Regarding turning on APC, although yii itself can be loaded as required Required files, but in fact, it is still necessary to judge what should be loaded and what should not be loaded every time...
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