[英]Phpredis and apache
Is redis compatible with an apache server? Redis与apache服务器兼容吗? I'm trying to run redis from a php script stored in my apache servers web directory. 我正在尝试从存储在我的apache服务器Web目录中的php脚本运行redis。
<?php
//Connecting to Redis server on localhost
$redis = new Redis();
$redis->connect('127.0.0.1', 6379);
echo "Connection to server sucessfully";
//check whether server is running or not
echo "Server is running: ".$redis->ping();
?>
When I try loading my web page I get a 505 programming error. 当我尝试加载网页时,出现505编程错误。 Does my apache setup even matter? 我的apache设置是否重要? I'm thinking my phpredis extension might not be setup correctly. 我以为我的phpredis扩展名可能未正确设置。 I'm able to ping redis from the raspberry pi terminal. 我可以从树莓派终端ping Ping Redis。 If that is my issue does anybody have any good tutorials on adding a redis extension to php? 如果那是我的问题,那么有人在向PHP添加Redis扩展方面有任何好的教程吗?
Ok, lots of probably beginner mistakes, but I figured it out. 好的,很多可能是初学者的错误,但我发现了。 I didn't have and still don't have a start up script, so I had to start Redis from the raspberry pi terminal using this command I assume I'm going to need to do this after each restart: pi@raspberrypi:~ $ redis-server. 我没有并且仍然没有启动脚本,因此我不得不使用以下命令从raspberry pi终端启动Redis,我认为每次重启后我都需要这样做:pi @ raspberrypi:〜 $ redis服务器。 The quickstart guide on the official Redis page gave me the solution https://redis.io/topics/quickstart . Redis官方页面上的快速入门指南为我提供了解决方案https://redis.io/topics/quickstart 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.