Reputation: 272
I am trying to use Zend's Gbase library, but I cannot figure out how to do so without actually installing it in the PHP path.
The complication comes from wanting to make a module for Drupal that is not constrained by the server it is installed on, but can access the library by having it installed in a subfolder of the module.
Does anyone know how to do this? I have tried doing an include of Zend's Loader and then loading the classes I want, but this keeps throwing errors. Do I NEED to install the library on the server, or is there a way around this, to only have it used on this application?
This is the code:
require_once 'library/Zend/Loader.php'; Zend_Loader::loadClass('Zend_Gdata_Gbase');
I get the folowing messages:
Warning: Zend_Loader::include(Zend/Gdata/Gbase.php) [zend-loader.include]: failed to open stream: No such file or directory in /srv/www/ftp-www/tests/gdata/library/Zend/Loader.php on line 83
Warning: Zend_Loader::include() [function.include]: Failed opening 'Zend/Gdata/Gbase.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /srv/www/ftp-www/tests/gdata/library/Zend/Loader.php on line 83
Warning: Zend_Loader::require_once(Zend/Exception.php) [zend-loader.require-once]: failed to open stream: No such file or directory in /srv/www/ftp-www/tests/gdata/library/Zend/Loader.php on line 87
Fatal error: Zend_Loader::require_once() [function.require]: Failed opening required 'Zend/Exception.php' (include_path='.:/usr/share/php:/usr/share/pear') in /srv/www/ftp-www/tests/gdata/library/Zend/Loader.php on line 87
Upvotes: 1
Views: 2454
Reputation: 6254
You need to specify where to look for the class files. Try:
Zend_Loader::loadClass('Zend_Gdata_Gbase', 'library/')
Or you may want to set the library folder in your php include path
Upvotes: 2
Reputation: 401162
What about using set_include_path to configure your include_path, adding to it the directory in which Zend Framework's code is ?
This way, you can have it whereever you want -- whitout having to modify the include_path
in the php.ini configuration file.
For instance, something like this might do :
$path = '/PATH_TO_THE_FRAMEWORK/';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
Wouldn't that help ?
Upvotes: 6