WebFaction
Community site: login faq

I tracked down a recent issue we've been experiencing to our use of PHP's implementation of curl on WebFaction. We consistently get a 504 Gateway Timeout when accessing certain URLs. The exact same code and page URLs work flawlessly on a different hosting company's hosting service.

Is there some way that WebFaction has PHP configured that would affect how curl loads webpages? For reference, here is the code in question (again, the code and URLs accessed are exactly the same in both cases, only WebFaction displays a 504 error):

$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_URL, 'http://test.nimblehost.com/rsprostack/index.php');
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);
if ( ini_get('open_basedir') == '' && strtolower(ini_get('safe_mode')) == 'off' ) {
    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($curl, CURLOPT_MAXREDIRS, 3);
}
curl_setopt($curl, CURLOPT_USERAGENT, 'RapidSearch Pro 1.2.0');
$html = curl_exec($curl);
$headers = curl_getinfo($curl);
curl_close($curl);
if( $html === false ) {
    throw new Exception('Unable to open URL');
}

Would appreciate any assistance to figuring out the cause and potential workarounds.

asked 27 Feb '13, 01:11

Jonathan Head
3147
accept rate: 100%

I think the problem is when you try to access your website using IP6 rather than IP4. You can check it at terminal.

when I try: curl -v -6 http://test.nimblehost.com/rsprostack/index.php

I got: getaddrinfo(3) failed for test.nimblehost.com:80 Couldn't resolve host 'test.nimblehost.com' * Closing connection #0 curl: (6) Couldn't resolve host 'test.nimblehost.com'

but when I try curl -v -4 http://test.nimblehost.com/rsprostack/index.php

I got: About to connect() to test.nimblehost.com port 80 (#0) Trying 108.59.9.135... connected * Connected to test.nimblehost.com (108.59.9.135) port 80 (#0)

One of my domain got this problem about two weeks ago and the temporary solution was to make that domain only accessible via IP4 while webfaction engineers fix that problem. You can set it up on your webfaction control panel > domains/websites > domains > your-ip6-troubled-domain

But now, my domain is accessible via IP4 and IP6. If you already open support ticket and explain your problem, webfaction will fix it.

(27 Feb '13, 15:50) Maverick Bozo

@Jonathan - I can't seem to reproduce this issue on your server at this time. If it's still happening for you, then feel free to open a support ticket.

(27 Feb '13, 18:05) seanf

@Maverick Bozo, many thanks for the response. Both the base and sub-domain test.nimblehost.com are already setup for IP4-only in our control panel, and since it's still not working I'm guessing that's not part of the issue in this particular case.

@seanf, appreciate it, will submit one shortly.

(27 Feb '13, 19:38) Jonathan Head

When I try curl --head http://test.nimblehost.com/rsprostack/index.php on my machine, I get HTTP/1.0 200 OK but when I try this on web323, I get HTTP/1.1 200 OK. How can I get two different responses from the same server ?

(28 Feb '13, 01:22) epqrs

@epqrs - the version of curl on your local machine probably doesn't support HTTP 1.1.

(01 Mar '13, 18:09) seanf
Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×262
×18
×15

question asked: 27 Feb '13, 01:11

question was seen: 8,711 times

last updated: 01 Mar '13, 18:09

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2020 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM