This article mainly introduces the performance optimization method of Yii to improve the number of concurrency. It has a certain reference value. Now I share it with you. Friends in need can refer to it
Turn on YII's APC cache
Add under the config/main.php components component:
'apccache'=>array( 'class'=>'system.caching.CApcCache' ),
Download php_apc.dll, file Put it under php/ext, it may be more troublesome to search....
Add the php_apc extension in php.ini:
extension=php_apc.dll apc.rfc1867 = on capc.max_file_size = 100M upload_max_filesize = 100M post_max_size = 100M
Restart apache, use Function info(), check whether there is apc extension.
Usage:
Yii::app()->apccache->get(id); Yii::app()->apccache->set(id,value,time);
2. Use yiilite.php
Import yii.php into the entry file index.php , change to introduce yiilite.php
run();
Note:
Open apc cache and then introduce yiilite.php, because there are some classes in this file that are not currently used will also be loaded in.
If apc cache is not turned on, website performance will be reduced.
The above is the entire content of this article. I hope it will be helpful to everyone’s study. For more related content, please pay attention to the PHP Chinese website!
Related recommendations:
yii2’s preventive measures against csrf attacks
The above is the detailed content of About Yii's method to improve the performance optimization of concurrent numbers. For more information, please follow other related articles on the PHP Chinese website!