Search code examples
phpoauthpeardropbox-apidropbox-php

How to get the dropbox-php library with pear HTTP_OAUTH to work?


I've been struggelig to get the dropbox-php library to work, but the page where I try to use the classes outputs an error:

Warning: include(HTTP/OAuth/Consumer.php) [function.include]: failed to open stream: No such file or directory in /home/sensured/public_html/sensured.net/Dropbox/OAuth/PEAR.php on line 47   

Warning: include(HTTP/OAuth/Consumer.php) [function.include]: failed to open stream: No such  file or directory in /home/sensured/public_html/sensured.net/Dropbox/OAuth/PEAR.php on line 47

Warning: include() [function.include]: Failed opening 'HTTP/OAuth/Consumer.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/sensured/public_html/sensured.net/Dropbox/OAuth/PEAR.php on line 47

Fatal error: Uncaught exception 'Dropbox_Exception' with message 'The HTTP_OAuth_Consumer class could not be found! Did you install the pear HTTP_OAUTH class?' in /home/sensured/public_html/sensured.net/Dropbox/OAuth/PEAR.php:51 Stack trace: #0 /home/sensured/public_html/sensured.net/Dropbox/getmetadata.php(11): Dropbox_OAuth_PEAR->__construct('', '') #1 {main} thrown in /home/sensured/public_html/sensured.net/Dropbox/OAuth/PEAR.php on line 51  

The pear HTTP_OAUTH class is installed (v 0.2.3), but its done though cpanel so I'm unsure where and don't even know if that has anything to say.


Solution

  • You need to make sure that PEAR's PHP directory is in your include_path.

    Find the path with

    $ pear config-get php_dir
    

    then add it to your php.ini's include_path directive. Restart your web server software afterwards to activate the new settings .