3

Have the next problem: installed php phantomjs on MAMP. Made all using instructions from here: enter link description here

Everything is ok... Then i copied all my site files to my web hosting site folder and nothing worked. Made a var_dump of response and saw that:

object(JonnyW\PhantomJs\Http\Response)#156 (8) { ["headers"]=> NULL ["status"]=> NULL ["content"]=> NULL ["contentType"]=> NULL ["url"]=> NULL ["redirectURL"]=> NULL ["time"]=> NULL ["console"]=> NULL }

Why it doesn't work, why all is NULL? My code is:

require __DIR__ . '/vendor/autoload.php';

use JonnyW\PhantomJs\Client;

$client = Client::getInstance();

$request = $client->getMessageFactory()->createRequest('http://jonnyw.me', 'GET');

$response = $client->getMessageFactory()->createResponse();

var_dump($response);

$client->send($request, $response);


echo $response->getContent();
1
  • Can you login to your server via SSH? Commented Feb 12, 2016 at 17:46

2 Answers 2

1

The most likley things is if it's shared hosting, they will more than probably not allow you to execute arbitrary executables... i.e. the executable in ~/bin/phantomjs

To execute non-standard i.e. user installed stuff, you'll need a VPS or Dedicated server.

Sign up to request clarification or add additional context in comments.

3 Comments

thanx, and is any solution of this problem?
@ArtyomSosonko Yes, buy a VPS from one of many hosting providers: digitalocean.com or flops.ru
I've got a VPS but my problem persist. What configuration I'm missing?
0

Problem was about executable downloaded by composer, so following issue #86 I put this on my code:

$client->getEngine()->setPath('/usr/bin/phantomjs');

So now I'm using default binaries and works great.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.