1

I have installed redis packages on my AWS ubuntu server and everything is working fine from the command line.

I have run the below things from command line and it shows me correct response.

netstat -nlpt | grep 6379 tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN 23504/redis-server 

so my redis server is running correctly on 6379 port also I have added this port on aws security group so firewall is also not blocking.

Also when I check my redis log it also seems to be fine. below is my log.

The server is now ready to accept connections on port 6379 

But when I run the below code from my PHP and I get the below error.

$redis = new Redis(); $redis->connect('localhost'); $redis->set('param',999); echo $redis->get('param');die; 

Error I am getting...

The mcook.co.in page isn’t working mcook.co.in is currently unable to handle this request. HTTP ERROR 500 

enter image description here

I have tried the below solution mentioned in stackoverflow.com but none of are working for me.

Redis - Connect to Remote Server.

7
  • What are the entries of your server error log or other logs? Commented Aug 16, 2016 at 18:41
  • a 500 error is a generic "something went wrong" error. But it could be a thousand things that caused it. You need to look at the server error logs to see what the issue was. That will give you more details. On debian systems (ubuntu, etc), the error logs default to /var/log/apache2/error.log and on centos systems (centos, redhat, etc), the logs default to /var/log/httpd/error.log or similar. After you find that, go look the error up on the php error reference page. Commented Aug 16, 2016 at 18:46
  • @JonathanKuhn : I have already checked the my php log which is not showing and major error or warning. that's why I am confused why redis class gives this error because the same thing on my localhost working fine. Commented Aug 16, 2016 at 19:01
  • "not showing any major error or warning". Depending on the settings of the server, even a simple warning or notice can show a 500 error, even completely unrelated to this code. You should break down the problem into the most simple/basic script and test that. You can also try turning on error_reporting and display_errors in the server config (apache htaccess would work) and see if you can get the errors displaying to the page. Commented Aug 16, 2016 at 19:03
  • 1
    Depending how you installed it, you may need to add it to the php.ini file. extension=redis.so or something similar. If you installed it via package manager it will normally get added via a conf.d directory. But via PECL it will not. Commented Aug 16, 2016 at 19:44

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.