0

I am working on a laravel project where I am trying to use php wrapper of phantom js made by jonnyw. I have done everything written in the docs.

I have downloaded the 32 bit executable file and set the path in my code, but it still gives me the following error: sh: 1: /usr/local/bin/: Permission denied

My code looks like this

$client = PhantomJs::getInstance();
$client->getEngine()->setPath('/usr/local/bin/');

I have read some related issues already.

I am using laravel 5.4 and 4.0 version of jonnnnyw/php-phantomjs.

Tahir Raza
  • 726
  • 1
  • 7
  • 20

1 Answers1

1

After exploring the internet and hours of deep digging I have been able to identify the solution.

Actually the solution is two fold:

  1. We have to specify the relative path of phantomjs executeable file, not the folder containing it.
  2. The phantom js executable file should be inside the laravel project, particularly in this case.

So in my case the correct path is

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

Where phantomjs is the executable file itself not the folder/directory containing it.

I hope it will be helpful for people like me.

Tahir Raza
  • 726
  • 1
  • 7
  • 20