Home  >  Article  >  Database  >  How to add redis to php's Yii framework

How to add redis to php's Yii framework

王林
王林forward
2023-05-26 10:31:061509browse

1. Download the Rediscache plug-in

Extract the plug-in to helloyii/app/protected/extensions:

The location of the plug-in file after deployment should be: helloyii/ app/protected/extensions/redis/CredisCache.php

Add the yii-redis component in yii’s web.php configuration file

2. Install the redis extension of yii2

cd /www/html/basic
php composer.phar require --prefer-dist yiisoft/yii2-redis

3. Add the yii-redis component to the yii web.php configuration file

In the yii config directory, edit web.php and go to components Plus:

  'redis' => [
                'class' => 'yii\redis\Connection',
                'hostname' => 'localhost',
                'port' => 6379,
                'database' => 0,
        ],

What are the PHP development environment building tools?

1. phpStudy is the most commonly used development environment for novices to get started.

2. WampServer, WampServer is also as simple to operate as phpStudy and is more friendly to novices.

3. XAMPP, XAMPP (Apache MySQL PHP PERL) is a powerful integrated website building software package;

4. MAMP, MAMP is divided into two types: MAMP and MAMP Pro for Mac.

5. Pagoda Panel, Pagoda Panel is a server management software that supports Windows and Linux systems.

6. UPUPW, UPUPW is currently the most distinctive web server PHP suite under the Windows platform.

The above is the detailed content of How to add redis to php's Yii framework. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete