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

Phpredis configuration completed, test failed

WBOY
Release: 2023-03-02 10:50:01
Original
1289 people have browsed it

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>
Copy after login
Copy after login

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>
Copy after login
Copy after login

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template