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.