Home >Backend Development >PHP Tutorial >Phpredis configuration completed, test failed

Phpredis configuration completed, test failed

WBOY
WBOYOriginal
2016-12-01 01:27:261312browse

Configured phpredis according to the online tutorial, and wrote a test page, which reported a 500 error and no display. The test code is as follows

<code><?php 
$redis = new Redis(); 
$redis->connect('127.0.0.1',6379); 
$redis->set('Jay13','www.jb51.net'); 
echo 'Jay13:'.$redis->get('Jay13'); 
echo '</br>'; 
echo 'Jay12:'.$redis->get('Jay12'); 
?>
</code>

How to find out where the problem is? This error report is too broad

Reply content:

Configured phpredis according to the online tutorial, and wrote a test page, which reported a 500 error and no display. The test code is as follows

<code><?php 
$redis = new Redis(); 
$redis->connect('127.0.0.1',6379); 
$redis->set('Jay13','www.jb51.net'); 
echo 'Jay13:'.$redis->get('Jay13'); 
echo '</br>'; 
echo 'Jay12:'.$redis->get('Jay12'); 
?>
</code>

How to find out where the problem is? This error report is too broad

I can’t see the error and can’t give you a reply

  1. Try to use the command line to connect to redis redis-cli 127.0.0.1 and see if it is successful

  2. I suspect that your Redis extension is not installed

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn