Reputation: 42778
I have tried by myself to install Rediska (Redis PHP client) into my codeigniter application, but without any success. I'll get insane amounts of "No such file or directory"-errors when trying to put it into the plugins folder of Codeigniter:
Severity: Warning
Message: require_once(Rediska/Connection/Exception.php) [function.require-once]: failed to open stream: No such file or directory
Filename: Rediska/Connection.php
Line Number: 6
Have anyone succeeded to install Rediska into Codeigniter before me?
From looking at the Rediska install manual, It appears to be a simple and easy drop-in installation: http://rediska.geometria-lab.ru/documentation/get-started/
Since it's only about path-based errors right now, I'll assume that there's should be some handy PHP setting that I can change to make it all work?
Thanks!
Upvotes: 1
Views: 6676
Reputation: 11
Just noticed the note from phil Sturgeon about plugins being made redundant.....
I'm working on rolling Rediska into a CI library at the moment, but for general use you can using the following to include files based on the CI application path
include(APPPATH.'libraries/rediska/Exception.php');
Would include the Exception.php in system/applications/libraries/rediska/
Upvotes: 1
Reputation: 638
I didn't get the ini_set solution to work, but a variant of that line works great: set_include_path(get_include_path() . PATH_SEPARATOR . APPPATH.'libraries/');
Upvotes: 1
Reputation: 4962
It's a simple include_path-related problem. In other words, PHP is unable to automatically load files that library you are trying to use (in your case Rediska) is trying to load.
I have assumed that you have extracted contents of Rediska library directory into system/application/libraries directory of Code Igniter (so that in libraries dir you have Rediska.php and Rediska directory). You will have to insert following code:
ini_set('include_path', ini_get('include_path').';'.APPPATH.'libraries/');
...into ONE of following places (it's up to you to choose which one):
Then, you should be able to load rediska using following lines (from your controller, or even some other library):
$this->load->library('rediska');
$rediska = new Rediska();
Alternatively, instead of manually loading library, you might want to auto-load Rediska library. See http://codeigniter.com/user_guide/general/autoloader.html for more info.
Hope it helps.
Upvotes: 2