edit-icon download-icon

ApsaraDB for Redis saves PHP session variable

Last Updated: Aug 09, 2017
  1. Install phpredis extension.

    1. wget https://github.com/nicolasff/phpredis/archive/master.zip
    2. unzip master.zip
    3. cd phpredis-master
    4. /data/apps/php5.5.0/bin/phpize
    5. **NOTE**: The phpize path must be replaced by the actual path in your environment.
    6. ./configure with-php-config=/data/apps/php5.5.0/bin/php-config
    7. **NOTE**: The php-config path must be replaced by the actual path in your environment.
    8. make
    9. make install
  2. Modify the following php.ini parameters:

    1. extension = redis.so
    2. session.save_handler = redis
    3. session.save_path = tcp://connection address of your ApsaraDB for Redis instance?auth=password of your ApsaraDB for Redis instance”

    See the following figure:

  3. Restart the Web service after setup.

  4. Compile a PHP session generation page to verify whether the settings are saved to ApsaraDB for Redis.

    The content of test.php is as follows:

    Use php test.php to parse the PHP page to ensure the settings are saved to ApsaraDB for Redis.

Thank you! We've received your feedback.