How to install Predis
Posted
by
user782860
on Server Fault
See other posts from Server Fault
or by user782860
Published on 2011-09-07T17:26:50Z
Indexed on
2012/10/28
17:04 UTC
Read the original article
Hit count: 293
I am trying to install Predis, but keep getting a 500 Server errror. Here is what I have done.
1.) Have apache and php installed on Ubuntu Natty.
2.) Used the instructions on this page http://redis.io/download to download Redis.
3.) Ran the following example to confirm that Redis is working:
$ src/redis-cli
redis> set foo bar
OK
redis> get foo
"bar"
4.) Have a local website at /home/user/Dropbox/documents/www/mywebsite.com/index.php and have confirmed that php is working.
5.) Downloaded the .zip version of Predis ( https://github.com/nrk/predis Version: v0.6.6-PHP5.2 ), and unzipped the contents to /home/user/Dropbox/documents/www/mywebsite.com/. So now Predis is here: /home/user/Dropbox/documents/www/mywebsite.com/nrk-predis-3bf1230/
6.) Opened the /home/user/Dropbox/documents/www/mywebsite.com/index.php page. Here is its contents:
<?
define("PREDIS_BASE_PATH", "nrk-predis-3bf1230/lib/");
spl_autoload_register(function($class) {
$file = PREDIS_BASE_PATH.strtr($class, '\\', '/').'.php';
if (file_exists($file)) {
require $file;
return true;
}
});
$redis = new Predis_Client();
$redis->set('foo', 'bar');
$value = $redis->get('foo');
?>
I have tried changing:
$redis = new Predis_Client();
to:
$redis = new Predis\Client();
Have tried changing the the PREDIS_BASE_PATH to:
/nrk-predis-3bf1230/lib
/home/user/Dropbox/documents/www/mywebsite.com/nrk-predis-3bf1230/lib/
/home/user/Dropbox/documents/www/mywebsite.com/nrk-predis-3bf1230/lib
Have done a chmod +x on both:
/home/user/Dropbox/documents/www/mywebsite.com/nrk-predis-3bf1230/
/home/user/Dropbox/documents/www/mywebsite.com
And doing all of the above always results in a 500 server error.
What am I doing wrong?
© Server Fault or respective owner