Yii : 1.1.12 : upgrade PHP from 5.3 to 5.5 and stuck with Yii Cache coonfiguration

I am using Yii 1.1.12 and upgraded PHP from 5.3 to 5.5. The PHP5.5 does not have APC support and its mentioned all across on the internet that PHP5.5 provide native cache support in shape of OPCACHE so APC cache is not supported. If this is the case, then what changes do I need to make in the Yii main.config in order to tell Yii that there is some cache available so that my following code is executable.




Yii::app()->cache->set('some data to be cached', $CACHE_VARIABLES);

$get_var=Yii::app()->cache->get($CACHE_VARIABLES);



I am totally stuck and pretty worried if I have to make changes in my code !!

Worst case, configure the CDummyCache in the configuration file:

http://www.yiiframework.com/doc/api/1.1/CDummyCache

other cache types are available too ‘CFileCache, CDbCache’ -> they are listed in the left hand menu on the link above.

Thanks for your reply. Actually, I had tried that as well, the problem with Dummy is that it does not actually store anything, it’s there just to provide an interface in case one moves from Non-Cache to Cache mode.

That’s said, I am more inclined towards using CZendDataCache but unfortunately, despite searching for hours, I am not able to find this extension. Can you provide some directions?

In your expert opinion, please suggest if at all I should move to Apache2.4 and PHP5.5? Currently I have, Apache 2.2.22 and PHP5.3 with APC. if this move is not going to give me substantial gains then I would probably wouldn’t bother much!!!

Many thanks

Hi

These caches are part of the ‘core’.

Read http://www.yiiframework.com/doc/guide/1.1/en/caching.overview for more information about the configuration.

Basically you have to refer to the class with




        'cache'=>array(

            'class'=>'system.caching.CZendDataCache'

        ),

With regards to wheter you should upgrade or not.

My personal approach to this is:

  1. If there is no need to upgrade, keep the working system;

  2. Go along with technology as it is. That is, if I have to move to another system which is more current, then I’ll try to adapt.

  3. Be vigilant about reasons to upgrade: security, maintanance, … .

I haven’t made an indepth analysis of PHP5.3 vs PHP5.5 or apache evolutions - I do not think it is critical to upgrade today.

However in your situation it looks like the new versions are the default versions, so I’ld take the opportunity to make & investigate the change.

I made the change as your suggested but Yii is throwing error. If “CZendDataCache” is in core then it shouldn’t give error, attached is the screen shot of error that I am receiving.

Actually what the error says is that PHP needs the zend extension (a .so on *nix, or .dll on windows) must be loaded. That is: it must be present and configured in the php.ini.

A call to ‘phpinfo()’ can help you identify the available extensions. Just create a .php file with ‘<?php phpinfo();’ and check the result.