Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error when executing PhantomJS procedure in PHP-PhantomJS

I'm trying to use PHP Phantom with Laravel project on Ubuntu (php version > 5.5). Followed the installation steps mention here : http://jonnnnyw.github.io/php-phantomjs/ .

I'm getting the following error:

Error when executing PhantomJs procedure - File does not exist or is not executable: bin/phantomjs

Even tried to set bin directory using $client->setBinDir('/path/public/bin'). Also tried both absolute and relative path but following error was thrown:

Call to undefined method JonnyW\PhantomJs\Client::setBinDir()

Tried everything found over the internet to fix this.

like image 478
Chirag Avatar asked Mar 24 '26 19:03

Chirag


1 Answers

From the docs:

By default the PhantomJS library will look for the PhantomJS executable in the bin folder relative to where your script is running ~/bin/phantomjs. If the executable cannot be found or if the path to your PhantomJS executable differs from the default location, for example you have installed PhantomJS globally, you will need to define the path to your PhantomJS executable manually.

$client->getEngine()->setPath('/path/to/phantomjs');

Please note that you have to provide not just the folder, but the full path to PhantomJS binary file.

like image 136
Vaviloff Avatar answered Mar 27 '26 08:03

Vaviloff