Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP PhantomJS doesn't work on web server

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();
like image 988
Artyom Sosonko Avatar asked Apr 27 '26 20:04

Artyom Sosonko


1 Answers

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.

like image 172
Brian Avatar answered Apr 30 '26 10:04

Brian



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!