Search code examples
phpfacebookfacebook-php-sdk

Uploading photo times out


I am uploading photo using facebook php sdk and I am receiving this error even though I have set_time_limit(0);

Fatal error: Uncaught exception 'Facebook\FacebookSDKException' with message 
'Operation timed out after 60000 milliseconds with 0 bytes received' 
in E:\Local server\htdocs\localhost\lib\Facebook\HttpClients\FacebookCurlHttpClient.php:142

Stack trace: 
#0 E:\Local server\htdocs\localhost\lib\Facebook\FacebookRequest.php(248): Facebook\HttpClients\FacebookCurlHttpClient->send('https://graph.f...', 'POST', Array) 
#1 E:\Local server\htdocs\localhost\upload.php(102): Facebook\FacebookRequest->execute() #2 {main} thrown in E:\Local server\htdocs\localhost\lib\Facebook\HttpClients\FacebookCurlHttpClient.php on line 142

Solution

  • This time limit comes from php.ini file. But using facebook api better to have time limit, 30seconds by default installation, because there is no need to have - 0 - no time limit. However problem is that you have to catch FacebookSDKException exception, so wrap you called function with try catch block