Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to run Phantomjs (most specifically Casperjs) on a Amazon EC2, using Ubuntu latest image (12.4). To be sure, I tried with two different builds. One compiled on my dev machine (Phantomjs 1.6.0) and another built in the EC2 itself (Phantomjs 1.6.1).

Both with same results: The connection doesn't happen.

Using the pizza example:

I can

wget ''

and I get the requested page, but when I run

phantomjs examples/pizza.js

I get

Unable to access network.

There are no rules active on iptables.

Any hints on what might be causing that? Or what should I do to get more details about the issue?


share|improve this question

In that example, the Phantom script will throw "unable to access network" if the request doesn't return 'success'. In fact, a request to the URL in your example returns a 301 'moved permanently' and redirects back to I believe the example is outdated and Yelp have since updated their website UI.

Url format is now:

And the address now sits in an <address> element.

Update the url and the selector to something like:


Also,the example script you've linked to is for Phantom 1.2. The following is deprecated:

var page = new WebPage();

And replaced by the following in newer versions:

var page = require('webpage').create();

Same example for Phantom 1.6. Remember to update the url and selector:

share|improve this answer
Thanks rbaker86, but that is not the issue. – alfetopito Jul 17 '12 at 12:13
I added that just as an example which would throw some kind of error in case it failed. The root cause is that the Ubuntu image I was using somehow blocked phantomjs connections (could not figure out why/how) I just instantiated an Amazon Linux AMI and it worked without any issue out of the box. – alfetopito Jul 17 '12 at 12:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.