Tuesday, August 10, 2010

Fatal error: Class 'Zend_Uri_Http' ZendGdata (YouTube API)

I followed the YouTube API - Developer's Guide: PHP, yet I got this error running their code, don't know why they are not updating the guide.

Fatal error: Class 'Zend_Uri_Http' not found in /home/path/public_html/ZendGdata/library/Zend/Gdata/App.php

As the error show us the fix is really simple, just load the Class 'Zend_Uri_Http'

require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata_YouTube');
$yt = new Zend_Gdata_YouTube();

Zend_Loader::loadClass('Zend_Gdata_AuthSub');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Uri_Http');

2010/08/14 Note: you have to load this class in your page where you call the YouTube API service (not in any zend php client library files.)

Freelance Jobs

11 comments:

  1. I added those to the top of "App.php" and the error goes away, but I get this new error,

    =======
    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/thespore/public_html/zend/library/Zend/Loader.php:99 Stack trace: #0 /home/thespore/public_html/zend/library/Zend/Gdata/App.php(25): Zend_Loader::loadClass('Zend_Gdata_YouT...') #1 /home/thespore/public_html/zend/library/Zend/Gdata.php(27): require_once('/home/thespore/...') #2 /home/thespore/public_html/zend/library/Zend/Gdata/Media.php(27): require_once('/home/thespore/...') #3 /home/thespore/public_html/zend/library/Zend/Gdata/YouTube.php(27): require_once('/home/thespore/...') #4 /home/thespore/public_html/zend/library/Zend/Loader.php(146): include_once('/home/thespore/...') #5 /home/thespore/public_html/zend/library/Zend/Loader.php(94): Zend_Loader::loadFile('Zend/Gdata/YouT...', NULL, true) #6 /home/thespore/public_html/lfp/gdata.php(3): Zend_Loader::loadClass('Zend_Gdata_YouT...') #7 {main} thrown in /home/thespore/public_html/zend/library/Zend/Loader.php on line 99
    =======

    and the InstallationChecker.php file didnt give me errors, but once I added your code, that's the error it gives me everywhere, too.

    ReplyDelete
  2. @Brenden - you have to add the line Zend_Loader::loadClass('Zend_Uri_Http');
    not in app.php or (any file in the zend folder)

    Example: let say you have file called load_my_video.php
    when you run that file if you get the error "Fatal error: Class 'Zend_Uri_Http' not found"
    load the Zend_Uri_Http class to that page.

    ReplyDelete
  3. it works~
    thanks :D

    ReplyDelete
  4. i love zend framework, everything they do doesn't quite work so you have to add more code.

    ReplyDelete
  5. Hola Friend.

    Added that line to my index.php file and it works perfect!

    Thanks So much!

    ReplyDelete
  6. Thanks alot.
    Same error in the Google Book Search API Example...
    Who's going to wake up the Google guys?

    ReplyDelete
  7. hi

    please use zend framework 1.10.2
    to solve
    Class 'Zend_Uri_Http' not found

    problem




    thanks

    Ehsan-ul-ha
    http://pmedia4u.com
    http://iehsan.com

    ReplyDelete
  8. eheh, sometimes searching google for the error is pretty usefull :D
    Thanks for the fix!

    ReplyDelete
  9. Thank you very much, mate.
    I don't know why the **** google doesn't update de API Docs.

    ReplyDelete
  10. thanks so much. this was a lifesaver.

    ReplyDelete