将 Zend Gdata 框架加载到 Wordpress 时出错
我正在尝试将 Zend Gdata 框架与 wordpress 一起使用,但遇到一些问题。 现在,当我使用 XAMPP 在本地主机上进行测试时,一切都工作得很好。然而在我的网络服务器上我的代码崩溃了。
这是我包含框架的代码。
`set_include_path(TEMPLATEPATH . '/includes/');
require_once ('Zend/Loader.php');
Zend_Loader::loadClass('Zend_Gdata_Youtube');`
该代码产生以下错误。
警告:Zend_Loader::include_once(Zend/Gdata/Youtube.php) [zend-loader.include-once]:无法打开流:/home/damain/public_html/mysite.com/wp-content 中没有此类文件或目录/themes/mysite/includes/Zend/Loader.php 第 146 行
警告:Zend_Loader::include_once() [function.include]:打开失败'Zend/Gdata/Youtube.php' 用于包含 (include_path='/home/damain/public_html/mysite.com/wp-content/themes/mysite/includes/') 在 /home/damain/public_html/mysite.com/ wp-content/themes/mysite/includes/Zend/Loader.php 第 146
行致命错误:未捕获异常“Zend_Exception”,消息为“File” “Zend/Gdata/Youtube.php”不存在,或者在 /home/damain/public_html/mysite.com/wp-content/themes/mysite/includes/Zend/Loader 中的文件中找不到类“Zend_Gdata_Youtube”。 php:99 堆栈跟踪: #0 /home/damain/public_html/mysite.com/wp-content/themes/mysite/includes/modules/yt_link_checker.php(19): Zend_Loader::loadClass('Zend_Gdata_Yout...') #1 /home/damain/public_html /mysite.com/wp-includes/plugin.php(405): load_zend_gdata('') #2 /home/damain/public_html/mysite.com/wp-admin/admin.php(111): do_action('load_zend_gdata', Array) #3 /home/damain/public_html/mysite.com/wp-admin/index.php (10): require_once('/home/damain/...') #4 {main} 抛出/home/damain/public_html/mysite.com/wp-content/themes/mysite/includes/Zend/Loader.php 第 99 行
我似乎无法弄清楚这个问题。有人可以帮忙吗?
I am trying to use the Zend Gdata framework with wordpress but I am having some issues.
Now everything works perfectly fine when I test on localhost with XAMPP. However on my web server my code breaks down.
Here is my code to include the framework.
`set_include_path(TEMPLATEPATH . '/includes/');
require_once ('Zend/Loader.php');
Zend_Loader::loadClass('Zend_Gdata_Youtube');`
That code produces the following error.
Warning: Zend_Loader::include_once(Zend/Gdata/Youtube.php) [zend-loader.include-once]: failed to open stream: No such file or directory in /home/damain/public_html/mysite.com/wp-content/themes/mysite/includes/Zend/Loader.php on line 146
Warning: Zend_Loader::include_once() [function.include]: Failed opening 'Zend/Gdata/Youtube.php' for inclusion (include_path='/home/damain/public_html/mysite.com/wp-content/themes/mysite/includes/') in /home/damain/public_html/mysite.com/wp-content/themes/mysite/includes/Zend/Loader.php on line 146
Fatal error: Uncaught exception 'Zend_Exception' with message 'File "Zend/Gdata/Youtube.php" does not exist or class "Zend_Gdata_Youtube" was not found in the file' in /home/damain/public_html/mysite.com/wp-content/themes/mysite/includes/Zend/Loader.php:99 Stack trace: #0 /home/damain/public_html/mysite.com/wp-content/themes/mysite/includes/modules/yt_link_checker.php(19): Zend_Loader::loadClass('Zend_Gdata_Yout...') #1 /home/damain/public_html/mysite.com/wp-includes/plugin.php(405): load_zend_gdata('') #2 /home/damain/public_html/mysite.com/wp-admin/admin.php(111): do_action('load_zend_gdata', Array) #3 /home/damain/public_html/mysite.com/wp-admin/index.php(10): require_once('/home/damain/...') #4 {main} thrown in /home/damain/public_html/mysite.com/wp-content/themes/mysite/includes/Zend/Loader.php on line 99
I cannot seem to figure this issue out. Can anyone help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在这种情况下,最好的解决方案是运行需要 Zend Loader 的脚本并使用 var_dump(get_include_path()) 来查看服务器所说的路径是什么。然后继续修改 php.ini include_path 直到脚本找到它。
就您而言,我不确定“damain”是否应该是“domain”。我最终起作用的包含路径是:
/home2/thelove6/public_html/zf/ZendGdata/library”
thelove6
是用户名。The best solution in this case is to run the script requiring the Zend Loader and use
var_dump(get_include_path())
to see what the server says the path is. Then keep modifying the php.ini include_path until the script finds it.In your case, I'm not sure if 'damain' is supposed to be 'domain'. My include path which finally worked was:
/home2/thelove6/public_html/zf/ZendGdata/library"
thelove6
being the username.您是否查看这些目录中是否存在这些文件? (/mysite/includes/Zend/Loader.php) 他们有正确的权限吗?听起来这很可能就是问题所在。使用简单的
phpinfo()
检查的另一件事是您是否已将所有库安装在实时服务器上。Did you look to see if those files exist in those directories? (/mysite/includes/Zend/Loader.php) and they have the correct permissions? It sounds like that could very well be the issue. The other thing to check with a simple
phpinfo()
would be that you have all of the libraries install on the live server.好的,可能的原因是:您没有使用正确的类名大小写。对于版本 1.11.11,它将是
Zend_Gdata_YouTube
而不是 Zend_Gdata_Youtube。Windows 操作系统忽略大小写,而 Linux 服务器则不会。希望这能解决您的问题,只需查看类或文件名的正确大小写即可。
Ok, the possible reason is: You're not using the proper case for the classname. For the version 1.11.11, it will be
Zend_Gdata_YouTube
rather than Zend_Gdata_Youtube.Windows OS is ignoring the case, whereas the Linux server does not. Hope this will solve your problem, just look at the proper case of the Class or filenames.