Zend Gdata include path issue (Loader.php)

大兔子大兔子 提交于 2020-01-06 08:51:24

问题


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



来源:https://stackoverflow.com/questions/5812938/zend-gdata-include-path-issue-loader-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!