0

I used facebook debugger to check my server's image. Here is the facebook debugger.

But, I received an error of "Curl Error : OPERATION_TIMEOUTED Operation timed out after 10000 milliseconds with 444276 out of 524288 bytes received".

enter image description here

My server timeout setting

Here are the settings (php 7 and php 5.6) in Cpanel

enter image description here

enter image description here

Here is the setting using ssh to find php.ini

enter image description here

Then vim /etc/opt/rh/rh-php56/php.ini

enter image description here

Wondering why the error says timeout is 10sec. Any suggestions?

Pak Ho Cheung
  • 1,382
  • 6
  • 22
  • 52
  • Max execution time is for the PHP script as a whole. It has no effect on CURL timeout (other than the case where CURL's timeout is longer than max execution time) I'd suggest you read PHP's CURL documentation to determine how to configure CURL's timeout. – GordonM Nov 13 '18 at 14:47
  • PHP's CURL uses the php.ini setting default_socket_timeout. The default value is 60, the unit is seconds. – nforced Nov 13 '18 at 14:49
  • @nforced just checked all default_socket_timeout in php.int. All are 60. Wondering why facebook returns an error saying 10 sec? – Pak Ho Cheung Nov 13 '18 at 14:55
  • @GordonM But the curl timeout should be on Facebook side as I only provide an url for them to fetch an image? I'm a newbie in server development. Correct me if I am wrong. Thanks – Pak Ho Cheung Nov 13 '18 at 15:07
  • Where do you see this error? In your error_logs or on the https://developers.facebook.com/tools/debug/og/object/ url? @PakHoCheung – nforced Nov 13 '18 at 15:16
  • @PakHoCheung Depends on which is longer. If Facebook's timeout is shorter than the one you specify in CURL then Facebook should trigger a timeout (probably with a HTTP error code). If CURL's timeout is shorter then it should give up and disconnect before Facebook times out. – GordonM Nov 13 '18 at 15:24
  • https://stackoverflow.com/questions/2582057/setting-curls-timeout-in-php may be more helpful. – GordonM Nov 13 '18 at 15:25
  • @nforced I attached a screenshot of the error from Facebook. – Pak Ho Cheung Nov 13 '18 at 15:27
  • @GordonM But I don't need write any code. I only need to provide a url. So, I guess the timeout should be completely based on Facebook's timeout. – Pak Ho Cheung Nov 13 '18 at 15:28

1 Answers1

0

The reason comes from slow connection.

Solutions:

  1. upgrade your server

  2. compress your image

  3. increase timeout

Pak Ho Cheung
  • 1,382
  • 6
  • 22
  • 52