user583507
user583507

Reputation:

Dropbox API Architecture issue

I have a problem while using dropbox API and I have no been able to find any solutions. I am using the example code from their site and having issues.

<?php
require_once "../../dropbox/lib/Dropbox/autoload.php";
use \Dropbox as dbx;
$appInfo = dbx\AppInfo::loadFromJsonFile("../../key.json");
$dbxConfig = new dbx\Config($appInfo, "PHP-Example/1.0");
$webAuth = new dbx\WebAuth($dbxConfig);
list($requestToken, $authorizeUrl) = $webAuth->start('http://example.com');
?>

This code gives me an error and an exception on the final line. This is the exception

PHP Fatal error:  Uncaught exception 'Exception' with message 'The Dropbox SDK at least a 64-bit build of PHP, but it looks like we're running a 32-bit build    (PHP_INT_MAX=2147483647).  Library: "/var/dropbox/lib/Dropbox/RequestUtil.php"' in /var/dropbox/lib/Dropbox/RequestUtil.php:15
Stack trace:
#0 /var/dropbox/lib/Dropbox/autoload.php(27): require_once()
#1 [internal function]: Dropbox\autoload('Dropbox\Request...')
#2 /var/dropbox/lib/Dropbox/WebAuth.php(73): spl_autoload_call('Dropbox\Request...')
#3 /var/www/home/index.php(12): Dropbox\WebAuth->start('http://example....')
#4 {main}
  thrown in /var/dropbox/lib/Dropbox/RequestUtil.php on line 15

I don't know what to do because I'm pretty sure I'm using a 64bit system... here is my uname output...

Linux me 3.2.0-45-generic #70-Ubuntu SMP Wed May 29 20:12:06 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

Any ideas or insight into why I am getting this error, or how to install a 64bit version of php...? If it helps, this is my php -v output

root@me:/var/www/home# php -v PHP 5.4.6-1ubuntu1.2 (cli) (built: Mar 11 2013 14:54:18) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies

Upvotes: 2

Views: 2718

Answers (2)

Takava
Takava

Reputation: 1

In my case the problem was resolved when I installed the php5-curl package. I use:

$php --version 

PHP 5.6.1 (cli) Copyright (c) 1997-2014 The PHP Group Zend Engine
v2.6.0, Copyright (c) 1998-2014 Zend Technologies

$ php -r 'echo PHP_INT_MAX;'

9223372036854775807

Upvotes: 0

Kannan Goundan
Kannan Goundan

Reputation: 5222

It looks like the version of PHP you're using only supports 32-bit integers, but the Dropbox SDK requires 64-bit integers.

See this post for more information: https://stackoverflow.com/a/864402

Are you using Ubuntu's standard PHP package? On my installation of Ubuntu, the standard PHP does support 64-bit integers. Type which php on the command-line to see which PHP binary you're running.

Upvotes: 1

Related Questions