Zend Gdata include path issue (Loader.php)

2019-08-24 18:05发布

问题:

I've been trying to install Zend Gdata. I'm running from a dev environment so have access to php.ini.

I've set the include path and when I run the verification script I get the following..

Ran PHP Installation Checker on 2011-04-28T02:25:20+00:00 PHP Extension Errors Tested No errors found Zend Framework Installation Errors Tested No errors found SSL Capabilities Errors Tested No errors found YouTube API Connectivity Errors Tested No errors found

But when I try to run any of the demo files I get the floowing error...

Warning: require_once(Zend/Loader.php): failed to open stream: No such file or directory in /usr/lib/php/ZendGdata/demos/Zend/Gdata/blogger.php on line 37

Fatal error: require_once(): Failed opening required 'Zend/Loader.php' (include_path='.:/usr/lib/php') in /usr/lib/php/ZendGdata/demos/Zend/Gdata/blogger.php on line 37

The most logical conclusion is that there is a problem with the include path, but I have checked it and it seems right.

Here's what I have for it...

.:/usr/lib/php/ZendGdata/library/Zend:/usr/lib/php/ZendGdata/library/

Any suggestions would be greatly appreciated.

回答1:

Put this in the beginning of Blogger.php

set_include_path('/usr/lib/php/ZendGdata/library' . PATH_SEPARATOR . get_include_path());

You say you're setting the include path in a configuration file but that doesn't seem to be affecting CLI. Make sure you're editing the right php.ini file with php --ini



回答2:

$clientLibraryPath = 'ZendGdata/library';
$oldPath = set_include_path(get_include_path() . PATH_SEPARATOR . $clientLibraryPath);

if you do not know the root path of the server, use relative path for accessing library. Its pretty handy to use.

above two lines should be written on the top of any file{page1,page2,page3} having folder structure as below

  • Website
    • Page1.php
    • Page2.php
    • Page3.php
    • ZendGdata

You can use your relative path as per your need